Skip to content

Instantly share code, notes, and snippets.

@lilspikey
lilspikey / .bashrc
Created February 22, 2012 15:54 — forked from henrik/.bashrc
Git branch and dirty state in Bash prompt.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
# username@Machine ~/dev/dir[master+]$ # master ahead of origin/master
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
# also add a + if the local branch is ahead of remote
@lilspikey
lilspikey / watch-cp.py
Created April 26, 2010 10:51
watch-cp - monitors files for changes and copies again if changes occur
#!/usr/bin/env python
'''
Script that functions a bit like standard cp (copy),
but monitors source files for changes and copies them
again if they change.
'''
import sys