Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ijt
Created October 23, 2010 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ijt/642788 to your computer and use it in GitHub Desktop.
Save ijt/642788 to your computer and use it in GitHub Desktop.
.bashrc_common, sourced from my .bashrc files
# Path
#
if echo $PATH | grep -v $HOME/bin > /dev/null; then
export PATH="$HOME/bin:$PATH"
fi
# Recursive search with ack
#
export ACK_ROOT=$HOME
# Recursively searches for a Perl regex from ACK_ROOT.
function ak() {
pushd $ACK_ROOT
ack $*
popd
}
# Sets ACK_ROOT to the current directory.
alias ar='export ACK_ROOT=`pwd`'
# Stolen from standard ubuntu bashrc:
# Enable color support of ls and also add handy aliases.
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
function timestamp() {
date +"%Y-%m-%d-%H:%M:%S $*"
}
# Editing bashrc and bashrc_common
alias re='source ~/.bashrc'
alias b='vim ~/.bashrc_common && cp ~/.bashrc_common{,.bak} && re'
alias brc='vim ~/.bashrc && cp ~/.bashrc{,.bak} && re'
# Directory listing and navigation
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias ..='cd ..'
# Notes
export tn="$HOME/todays-notes"
alias tn="vi $tn"
alias ctn="(echo; date; cat) >> $tn"
# TODO list
# Adds an item to the todo list.
function task_add() {
echo $* >> ~/todo
}
alias task_edit='vi ~/todo'
alias task_current='tail -n 1 ~/todo'
function task_done() {
timestamp `task_current` >> ~/done
# Delete last line of todo file
sed -i .bak '$d' ~/todo
}
alias ta='task_add'
alias te='task_edit'
alias tc='task_current'
alias td='task_done'
# Git
alias ga='git add'
alias gb='git branch'
alias gc='git checkout'
alias gd='git diff'
alias gcm='git commit -m'
alias gcam='git commit -a -m'
alias gl='git log'
alias gs='git status'
# Python
export PYTHONSTARTUP="$HOME/.pythonrc.py"
alias p='python'
alias ipython='ipython-2.6'
alias ip='ipython'
alias py='python'
alias ps='p setup.py'
alias psd='ps develop'
alias psi='ps install'
# Svn
alias sup='svn up'
alias sco='svn co'
# Macports
if [[ `uname` == Darwin ]]; then
# Macports
alias i='sudo port install'
alias s='port search'
fi
# Debian/Ubuntu
if [[ `uname` == "Linux" ]]; then
alias acs='apt-cache search'
alias ai='sudo apt-get install'
alias dl='dpkg -L'
fi
# Exuberant ctags
alias pytags="ctags --languages=python --python-kinds=cfmv -R"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment