Skip to content

Instantly share code, notes, and snippets.

@dannysmith
Created August 13, 2009 12:16
Show Gist options
  • Save dannysmith/167130 to your computer and use it in GitHub Desktop.
Save dannysmith/167130 to your computer and use it in GitHub Desktop.
My .bash_profile
#This is the path variable for my current projects path. It changes as I change projects.
export CPPATH=~/code/rails/rwp
# Adds Macports and Git to PATH & MANPATH.
export MANPATH=/opt/local/share/man:$MANPATH
export PATH=/usr/local/git/bin:/opt/local/bin:/opt/local/sbin:$PATH
#Sets SVN, GVS and default editors to Textmate
export EDITOR="mate -w"
export CVSEDITOR="mate -w"
export SVN_EDITOR="mate -w"
# common typos
alias mt='mate'
alias amte='mate'
alias atme='mate'
alias mate.='mate .'
#Sets G to an alias for git. Simples.
alias g='git'
#Sets the shell prompt to "DIRECTORY [- GIT_BARNCH]\n→"
export PS1='\w $(git branch &>/dev/null; if [ $? -eq 0 ]; then \
echo " - \[\033[00m\]$(git branch | grep ^*|sed s/\*\ //) "; fi)\[\033[00m\]\n→ '
# More Git aliases
alias gst='git status'
alias gl='git pull'
alias gp='git push'
alias gd='git diff'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
#Allows calling wikipedia using DNS
function wp {
dig +short txt ${1}.wp.dg.cx
}
#Sets up remote matlab session through Uni of Sussex Servers.
function matlab {
ssh -X das25@unix.tn.informatics.scitech.susx.ac.uk 'cd WindowsProfile/My\ Documents/MATLAB\ Work; pwd; matlab -desktop'
killall X11
Echo "Remote MATLAB Session Ended"
}
#Opens an SSH connection to University of Sussex Servers.
function sshuni {
echo "Opening connecton with Sussex server"
ssh das25@unix.tn.informatics.scitech.susx.ac.uk
}
#Opens a mySQL connection to University of Sussex Servers.
function mysqluni {
echo "Opening SQL connecton with Sussex server"
mysql -u das25 -p -h sql.tn.informatics.scitech.susx.ac.uk das25
}
#Creates a new rails project using the template provided as the second argument.
function trails {
template=${2-base}
appname=$1
shift 2
rails $appname -m ~/code/libs_and_repos/rails-templates/$template.rb $@
cd $appname
mate -w .
}
#Sets up an alias to change directory to ~/code/rails
alias cdr="cd ~/code/rails/"
#Sets shortcut for changing to current project path.
alias cr="cd $CPPATH"
#Configuration for RIP
RIPDIR=/Users/danny/.rip
RUBYLIB="$RUBYLIB:$RIPDIR/active/lib"
PATH="$PATH:$RIPDIR/active/bin"
export RIPDIR RUBYLIB PATH
# Don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
#Aliases for ls
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -lh'
alias l='ls $LS_OPTIONS -lhA'
#Alias for Tree Command
alias tree="find . -type d | sed -e 1d -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|-/'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment