Skip to content

Instantly share code, notes, and snippets.

@eliangcs
Last active Jan 18, 2016
Embed
What would you like to do?
Shell shortcuts
# Clear local merged branches
function clearbranches(){
cur_branch=`git rev-parse --abbrev-ref HEAD`
if [[ "$cur_branch" == "master" ]]; then
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
else
echo "Not on master branch!"
fi
}
# Delete *.pyc
alias clearpyc="find . -name '*.pyc' -delete"
# Start a static web server (Twisted required)
function httpserver(){
if [[ "$1" != "" ]]; then
twistd -n web --path "$1"
else
twistd -n web --path .
fi
}
# World time
# Put timezones in ~/.worldclock.zones. Example:
# US/Pacific
# UTC
# Europe/Moscow
# Asia/Taipei
function wt(){
while read zone
do echo $(TZ=$zone date "+%Y-%m-%d %H:%M:%S %z %Z") "($zone)"
done < "$HOME/.worldclock.zones"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment