Skip to content

Instantly share code, notes, and snippets.

@RafeKettler
Created April 16, 2013 22:42
Show Gist options
  • Select an option

  • Save RafeKettler/5400286 to your computer and use it in GitHub Desktop.

Select an option

Save RafeKettler/5400286 to your computer and use it in GitHub Desktop.
# .bashrc
# (C) 2013 Rafe Kettler. Use it however you'd like.
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# environment variables
export EDITOR=emacs
export PATH=${PATH}:${HOME}/scripts:${HOME}/bin
export CLASSPATH=${CLASSPATH}:${HOME}/lib
export BASH_ENV=~/.bash_env
. "$BASH_ENV"
# =========================
# aliases |
# =========================
# programs and scripts
alias shmkx='chmod +x *.sh'
alias pymkx='chmod +x *.py'
alias calc='python -ic "from __future__ import division; from math import *"'
alias spell='spell -on'
alias ipython='ipython -nobanner -noconfirm_exit'
alias irb='irb -r irb/completion'
# safeguard against deletion
alias rm='rm -i'
# navigation
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias back='cd $OLDPWD'
alias home='cd ~'
alias root='cd /'
alias dls='cd ~/Downloads'
alias win='cd /media/OS/Users/rafe'
alias docs='cd /media/OS/Users/rafe/Documents'
alias h='history'
alias j='jobs -l'
alias la='ls -lha'
alias less='less -F'
alias install='sudo apt-get install'
alias gitpush='git push origin master'
alias sul='sudo !!'
# emacs daemon
alias e='emacsclient -c'
# =========================
# functions |
# =========================
# extract archives
extract() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "don't know how to extract '$1'..." ;;
esac
else
echo "'$1' is not a valid file!"
fi
}
clean() {
rm -f \#* *~ *.bak
}
clock() {
while true; do
clear
echo "==========$(date +"%r %A, %B %d, %Y")=========="
sleep 1
done
}
# Shadow man with a more useful function
man() {
/usr/bin/man $@ || (help $@ 2> /dev/null && help $@ | less)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment