Skip to content

Instantly share code, notes, and snippets.

@dudarev
dudarev / .bashrc
Created January 12, 2012 13:44 — forked from troolee/.bashrc
prompt
### PROMPT ####################
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
@dudarev
dudarev / gist:1431275
Created December 4, 2011 21:07
Number of Saturdays in odd and even weeks
"""Take third Saturdays of each month.
Calculate number of them in odd and even weeks"""
from datetime import datetime
y = 2012
odd_counter = 0
even_counter = 0