A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| """ | |
| #Eksi entry crawler | |
| #Python 3.5 | |
| #Mongodb - Beautifulsoup example | |
| requirements.txt | |
| ---- | |
| pymongo | |
| requests | |
| beautifulsoup4 |
| alias accio=wget | |
| alias avadaKedavra='rm -f' | |
| alias imperio=sudo | |
| alias priorIncantato='echo `history |tail -n2 |head -n1` | sed "s/[0-9]* //"' | |
| alias stupefy='sleep 5' | |
| alias wingardiumLeviosa=mv | |
| alias sonorus='set -v' | |
| alias quietus='set +v' |
| GIT KOMUTLARI | |
| --------------- | |
| - KULLANICI BILGILERI : | |
| git config --global user.name "kullanıcı adı / rumuz" | |
| git config --global user.email "E-posta" | |
| git config --list # Calisma ve kullanici bilgilerini göster | |
| import pyaudio | |
| import wave | |
| FORMAT = pyaudio.paInt16 | |
| CHANNELS = 2 | |
| RATE = 44100 | |
| CHUNK = 1024 | |
| RECORD_SECONDS = 5 | |
| WAVE_OUTPUT_FILENAME = "file.wav" | |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| <VirtualHost *> | |
| ServerName example.com | |
| WSGIDaemonProcess www user=max group=max threads=5 | |
| WSGIScriptAlias / /home/max/Projekte/flask-upload/flask-upload.wsgi | |
| <Directory /home/max/Projekte/flask-upload> | |
| WSGIProcessGroup www | |
| WSGIApplicationGroup %{GLOBAL} | |
| Order deny,allow |
| import logging, time | |
| from timer import timed | |
| logger = logging.getLogger() | |
| logger.setLevel(logging.DEBUG) | |
| handler = logging.StreamHandler() | |
| handler.setLevel(logging.DEBUG) | |
| logger.addHandler(handler) |
| import pika | |
| connection = pika.BlockingConnection(pika.ConnectionParameters('localhost')) | |
| channel = connection.channel() | |
| channel.queue_declare(queue='hello') | |
| def callback(ch, method, properties, body): | |
| """docstring for callback""" | |
| print "[x] Received: %r" % (body,) |