This file contains 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
""" | |
Trying to see if there's a reasonably fast/safe replacement to the default pickle serializer | |
used by django-redis. | |
See https://github.com/jazzband/django-redis#pluggable-serializer | |
# Adapted from https://raw.githubusercontent.com/Arvind2222/pickle-vs-json/master/pickle_vs_json.py | |
""" | |
import pickle | |
import json |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am sidmitra on github. | |
* I am sidmitra (https://keybase.io/sidmitra) on keybase. | |
* I have a public key ASBJ806NJY-5Co4lI3C6EBU8L4wb7WTlTykAKw8mwAczCgo | |
To claim this, I am signing this object: |
This file contains 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
env: | |
TERM: xterm-256color | |
dimensions: | |
columns: 500 | |
lines: 100 | |
dpi: | |
x: 96.0 | |
y: 96.0 |
This file contains 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
def flatten(lst): | |
for item in lst: | |
# if item is a sublist | |
if isinstance(item, (list,tuple)): | |
# flatten sublist | |
for j in flatten(item): | |
yield j | |
else: | |
yield item |
This file contains 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
module.exports = | |
function (context, req, res) { | |
var Twit = require('twit'); | |
var ejs = require('ejs'); | |
var T = new Twit({ | |
consumer_key: context.data.consumer_key, | |
consumer_secret: context.data.consumer_secret, | |
access_token: context.data.access_token, | |
access_token_secret: context.data.access_token_secret |
This file contains 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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: gunicorn-graphite | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Should-Start: $nginx | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: gunicorn + nginx ubuntu init script | |
# Description: gunicorn + nginx ubuntu init script |
This file contains 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
class ExceptionUserInfoMiddleware(object): | |
""" | |
Adds user details to request context on receiving an exception, so that they show up in the error emails. | |
Add to settings.MIDDLEWARE_CLASSES and keep it outermost(i.e. on top if possible). This allows | |
it to catch exceptions in other middlewares as well. | |
""" | |
def process_exception(self, request, exception): | |
""" |