Skip to content

Instantly share code, notes, and snippets.

@justinabrahms
justinabrahms / gist:7311596
Created November 5, 2013 00:02
Use a cached virtualenv during CI
VENV_DIR=`md5sum requirements/* | md5sum 2>&1 | awk '{print $1}'`
if [ -e $VENV_DIR ]; then
. /tmp/$VENV_DIR/bin/activate
else
virtualenv --no-site-packages /tmp/$VENV_DIR
. /tmp/$VENV_DIR/bin/activate
pip install --download-cache /var/lib/jenkins/.pip_download_cache -r requirements/ci.txt
fi
# Mixpanel, Inc.
# http://mixpanel.com
max_ring_size = 2**127
def token_percent(token, max):
return round(token / float(max_ring_size), 4)
def calc(ring_load):
highest = {'total': 0, 'percent0': 0, 'percent1': 0}