Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / Redis Connection
Created February 11, 2011 14:30
Clean up redis connections after the termination of each request
from django.conf import settings
from django.core.signals import request_finished
from redis.client import Redis
database = Redis(
host=getattr(settings, "REDIS_HOST", "localhost"),
port=getattr(settings, "REDIS_PORT", 6379),
db=getattr(settings, "REDIS_DB", 0),
password=getattr(settings, "REDIS_PASSWORD", ""))
@ericflo
ericflo / twitter_to_convore.py
Created February 20, 2011 10:02
A small script which takes keywords to track on Twitter and streams them live into a Convore topic.
import base64
import httplib
import threading
import urllib
import tweepy
CONVORE_BOT_USERNAME = ''
CONVORE_BOT_PASSWORD = ''
CONVORE_TOPIC_ID = '7612'
@carljm
carljm / postactivate
Created July 12, 2011 18:21
Yo dawg, I heard you like Ruby...
#!/bin/bash
# This hook is run after every virtualenv is activated.
export OLD_GEM_HOME=$GEM_HOME
export GEM_HOME=$VIRTUAL_ENV/gems/
export GEM_PATH=
export PATH=$VIRTUAL_ENV/gems/bin:$PATH
@cvan
cvan / speed.py
Last active September 28, 2015 20:58
benchmark script for nose tests
#!/usr/bin/env python
import subprocess
import sys
trials = 5
force_drop = True
branch = 'factories'
test_db = 'test_zamboni'
@potch
potch / mozApp.js
Created May 3, 2012 16:22
simple open web app lib
// manage a webapp.
// place <link rel="app-manifest" href="path-to-manifest.webapp"> in your <head>
// mozApp.install() attempts installation
// mozApp.uninstall() removes
// mozApp.isRunning() indicates whether the app is currently installed and open
var mozApp = (function() {
var manLink = document.querySelector('link[rel="app-manifest"]'),
manifestURL = manLink.href;
var self = false;