Skip to content

Instantly share code, notes, and snippets.

@inlinestyle
inlinestyle / .bash_profile
Created August 3, 2012 04:03
A sweet PS1 for displaying git state and virtualenv
red="\[\e[0;31m\]"
green="\[\e[0;32m\]"
yellow="\[\e[0;33m\]"
purple="\[\e[0;35m\]"
cyan="\[\e[0;36m\]"
end="\[\e[0m\]"
GIT_PS1_SHOWUPSTREAM=auto
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWDIRTYSTATE=true
@inlinestyle
inlinestyle / factory_dict.py
Created May 23, 2012 01:15
An extension of collections.defaultdict that I wish were in the stdlib.
import inspect
from types import FunctionType
from collections import defaultdict
class FactoryDict(defaultdict):
"""
>>> fd = FactoryDict(int)
>>> fd['foo'] += 7
>>> fd['foo']
7