This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events { | |
worker_connections 1024; | |
} | |
http { | |
# Set cache dir | |
proxy_cache_path /var/nginx-cache levels=1:2 keys_zone=microcache:5m; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#good | |
Foo.objects.get(fk=45) | |
#not good | |
Foo.objects.get(fk_id=45) | |
#good | |
Foo.objects.create(fk_id=45) | |
#not good | |
Foo.objects.create(fk=45) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pprint | |
import os | |
import sys | |
import threading | |
import time | |
import traceback | |
_crier = None | |
def init_crier(temp_dir='/tmp'): | |
"Initialzies Crier, ensuring it's only created once in the process" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
pageTracker._trackEvent('Ads', 'Quest Shown', '{{quest.name|slugify}}'); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import threading | |
import redis | |
def worker(): | |
print "starting thread..." | |
r = redis.Redis(db=9) | |
for i in xrange(2000): | |
r.incr('foo') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import Queue | |
q = Queue.Queue() | |
def worker(): | |
while True: | |
msg = q.get(block=True) | |
# do stuff with the message | |
t = threading.Thread(target=worker) |
NewerOlder