Skip to content

Instantly share code, notes, and snippets.

@kylewelsby
Created October 1, 2010 12:00
Show Gist options
  • Save kylewelsby/606109 to your computer and use it in GitHub Desktop.
Save kylewelsby/606109 to your computer and use it in GitHub Desktop.
My terminal environment setup
# ---------------
# .bash_alias
# ---------------
alias lock='/System/Library/CoreServices/"Menu extras"/User.menu/Contents/Resources/CGSession -suspend' # Lock Computer screen
alias rpass='touch tmp/restart.txt; echo "Passenger Server Restarted"' # Restart ModRails Passenger
alias coffee="say COFFEE TIME"
alias cf='cd ~/Code' # Code folder
alias cwd='pwd | pbcopy' # Copy folder directory to ClipBoard
alias memory='top -o vsize' # System Memory Stats
alias cpu='top -o cpu' # Sytem CPU Stats
alias l='ls -alh' # List all the files in current folder
alias mute="osascript -e 'set volume output muted true'" # Mute computer Sound
alias sound="sudo osascript -e 'set volume 4'" # Turn on computer sound
alias louder="sudo osascript -e 'set volume 10'" # Turn computer sound loudest
# Get readable list of network IPs
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" # Get Privare IP address and DNS server
alias myip="dig +short myip.opendns.com @resolver1.opendns.com" # Get My Public IP Address
alias flush="dscacheutil -flushcache" # Flush DNS cache
# ---------------
# .bash_profile
# ---------------
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
source $HOME/.bash_alias
# Get the current branch of the current git project
function parse_git_branch {
ref=$(git symbolic-reg HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
# Get the RVM Gemset
function parse_rvm_branch {
ref=$(rvm gemset name 2> /dev/null) || return
echo ""${ref#refs/heads/}""
}
# Get the Ruby Version
function parse_ruby_branch {
ref=$(ruby -v | perl -n -e '/(\d\.\d\.\d)/ && print "$1\n"' 2> /dev/null) || return
echo ""${ref#refs/heads/}""
}
# ---------------
# Colours
# ---------------
WHITE="\[\033[0;37m\]"
RED="\[\033[0;31m\]"
LIGHTRED="\[\033[1;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
LIGHTGREEN="\[\033[1;32m\]"
BLUE="\[\033[0;34m\]"
LIGHTBLUE="\[\033[1;34m\]"
CYAN="\[\033[0;36m\]"
LIGHTCYAN="\[\033[1;36m\]"
BLACK="\[\033[0;30m\]"
DARKGREY="\[\033[1;30m\]"
LIGHTGREY="\[\033[0;37m\]"
PURPLE="\[\033[0;35m\]"
LIGHTPURPLE="\[\033[1;35m\]"
BROWN="\[\033[0;33m\]"
YELLOW="\[\033[1;33m\]"
PS1="$GREEN\$(date +%H:%M) $RED\w $CYAN\$(parse_ruby_branch)@$CYAN\$(parse_rvm_branch) $LIGHTPURPLE\$(parse_git_branch)$WHITE \$ "
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment