Skip to content

Instantly share code, notes, and snippets.

@maxgutman
Forked from xfenix/bash_profile.sh
Created May 30, 2013 06:14
Show Gist options
  • Save maxgutman/5676002 to your computer and use it in GitHub Desktop.
Save maxgutman/5676002 to your computer and use it in GitHub Desktop.
# bash
alias rr=". ~/.bash_profile"
# django
alias dm="./manage.py"
alias dmt="dm test"
function dr() {
COMMAND='./manage.py runserver'
if [ $# -eq 1 ]; then
eval $COMMAND $1
else
eval $COMMAND
fi
}
function drk() {
if [ $# -eq 1 ]; then
PORT=$1
else
PORT=8000
fi
eval fuser -k $PORT/tcp
}
# mysql
function mm() {
INIT='sudo /etc/init.d/mysql '
if [ $1 = 's' ]; then
eval $INIT start
elif [ $1 = 'r' ]; then
eval $INIT restart
else
eval $INIT stop
fi
}
# projects
function pr() {
PATH1='cd ~/web/git/beebill/'
PATH2='domains/bill/'
WORK='workon '
VENV='beebill'
# switch to virtualenv
if [ $# -eq 2 ]; then
eval $WORK$2
else
eval $WORK$VENV
fi
# go to the project root
if [ $# -eq 1 ]; then
eval $PATH1$1
else
# default - bill
eval $PATH1$PATH2
fi
}
# go to django folder and runserver
function prr() {
pr
dr
}
# git
alias gst='git status'
alias gsh='git stash'
alias gl='git pull'
alias gp='git push'
alias gpo='git push origin'
alias gd='git diff | mate'
alias gau='git add --update'
alias gc='git commit -vam'
alias gcv='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gbb='git branch -b'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcot='git checkout -t'
alias gcotb='git checkout --track -b'
alias glog='git log'
alias glogp='git log --pretty=format:"%h %s" --graph'
alias greset='git reset HEAD~1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment