[color]
diff = auto
status = auto
branch = auto
[user]
name = Your Name
| class CachedCountCloneProxy(object): | |
| ''' This allows us to monkey-patch count() on QuerySets so we can cache it and speed things up. | |
| ._clone is called so we have to monkey-patch that first... | |
| ''' | |
| def __init__(self, queryset): | |
| self._queryset = queryset | |
| self._queryset._clone_original = self._queryset._clone | |
| def __call__(self): |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import urllib2 | |
| gh_url = 'https://api.github.com' | |
| req = urllib2.Request(gh_url) | |
| password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |
| """ | |
| Author: Jeff Triplett | |
| Based off: https://code.djangoproject.com/wiki/PaginatorTag | |
| Thanks to Brent O'Connor for pointing it out. | |
| """ | |
| from django import template | |
| register = template.Library() |
| #!/usr/bin/env python | |
| from checkpid import pidcheck | |
| from time import sleep | |
| import logging | |
| log = logging.getLogger("checkpid") | |
| log.setLevel(logging.INFO) | |
| log.setLevel(logging.DEBUG) | |
| ch = logging.StreamHandler() |
| $ ./pip.sh outdated | |
| Fabric (1.4.3 != 1.5.1) | |
| gunicorn (0.17.0 != 0.17.2) | |
| $ ./pip.sh install -U gunicorn | |
| Downloading/unpacking gunicorn==0.17.2 | |
| Using download cache from /Users/jefftriplett/.pip/download_cache/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fg%2Fgunicorn%2Fgunicorn-0.17.2.tar.gz | |
| Running setup.py egg_info for package gunicorn | |
| Installing collected packages: gunicorn |
| #!/usr/bin/env bash | |
| # This script prints out all of your Redis keys and their size in a human readable format | |
| # Copyright 2013 Brent O'Connor | |
| # License: http://www.apache.org/licenses/LICENSE-2.0 | |
| human_size() { | |
| awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } ' | |
| } |