397 liens privés
bitbucket:
import os
from sys import platform as _platform
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def tracking():
data = request.get_json()
commit_author = data['actor']['username']
commit_hash = data['push']['changes'][0]['old']['target']['hash'][:7]
commit_url = data['push']['changes'][0]['old']['target']['links']['html']['href']
print 'Webhook received! %s committed %s: %s' % (commit_author, commit_hash, commit_url)
return 'OK'
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)
Voici les options qui vous montrent les capacités de ce script python bien utile:
## OPTIONS
test_mode = True # Setting this to False will actually undertake the actions
verbose = True
delete_tweets = True # Do we want to delete tweets?
delete_favs = True # Do we want to delete favorites
max_favs = 4 # Don't delete a tweet if it has more than this number of favorites
max_rts = 4 # Don't delete a tweet if it has more than this number of retweets
days_to_keep = 2 # How many days tweets to keep?
# Enter IDs of tweets you want to preserve here
tweets_to_save = [
]
# Enter IDS of favorites you want to preserve here
favs_to_save = [
]
# Enter strings that if found, will result in the tweet not being deleted.
strings_to_save = [
"[nd]",
"New Blog Post:",
]
"""
logcat-color - A colorful and highly configurable alternative to the standard "adb logcat" command from the Android SDK
"""
indispensable.
via https://wiki.cyanogenmod.org/w/Doc:_debugging_with_logcat
pyinstaller - PyInstaller official GIT repository
"""
PyInstaller reads a Python script written by you. It analyzes your code to discover every other module and library your script needs in order to execute. Then it collects copies of all those files -- including the active Python interpreter! -- and puts them with your script in a single folder, or optionally in a single executable file.
"""
réviser/apprendre les typages python 2.7
"""
S3QL is a file system that stores all its data online using storage services like Google Storage, Amazon S3, or OpenStack. S3QL effectively provides a hard disk of dynamic, infinite capacity that can be accessed from any computer with internet access running Linux, FreeBSD or OS-X.
S3QL is a standard conforming, full featured UNIX file system that is conceptually indistinguishable from any local file system. Furthermore, S3QL has additional features like compression, encryption, data de-duplication, immutable trees and snapshotting which make it especially suitable for online backup and archival.
"""
Extrêmement prometteur.
"""
Les premiers tests avec pgbouncer donnent des temps de réponses médians de 285ms avec un 99th percentile à 1650ms, toutes les requêtes sont traitées avec succès
Si on débranche pgbouncer le temps de réponses médian croit à 14487ms et surtout le max dépasse 60126ms ce qui donne un nombre croissant de requête en timeout sur la fin du test quand on arrive à pleine charge.
(...)
PgBouncer peut apparaître comme un outil compliqué quand on a pas l'habitude des bases de données, mais il est fort à parier que votre DBA le connait déjà, alors si l'utilisation de vos API croît ayez le réflex PgBouncer !
"""
""'
Il y a des tas de choses qu’on peut vouloir faire au moment où un fichier change :
Faire un backup;
Lancer les tests unittaires;
Démarrer un build;
Recharger un contenu;
Envoyer un email;
Afficher une notification;
Mettre à jour un listing.
Et ce n’est même pas dur à faire en Python grace à la lib watchdog :
pip install watchdog
"""
Synchroniser ses photos dès qu'on les prend, à l'image de ce que fait Owncloud.
serveur: python sur framework bottle
clients: android, python cli, et d'autres à venir dont cozy cloud.
made in Nantes ;)
"""
How we build, package, and deploy Python into versioned artifacts using Debian packages
"""
"""
TL;DR
Often, virtualenv is overkill for the basic task of installing project dependencies and keeping them isolated. We present a simple alternative consisting of:
adding ./.pip to your PYTHONPATH
using pip install -t .pip to install modules locally
executing python from your project's root directory
"""
Bien sûr, le nom du dossier ".pip" est arbitraire.
Quand on se rend dedans on peut ensuite faire ceci:
"""
source env/bin/active
pip install <tonsuperpaquet>
deactivate
"""
Tout simplement.
Bien penser à setter le PYTHONPATH avec le dossier de travail utilisé (".pip" dans l'exemple présent)
"""
pypiserver is a minimal PyPI compatible server. It can be used to upload and serve packages, wheels and eggs to pip or easy_install. The packages are stored inside a regular directory.
"""
EDIT: howto simple https://jamie.curle.io/posts/setting-up-a-custom-pypi-server/