Skip to content

Instantly share code, notes, and snippets.

@mcfearsome
Created August 22, 2008 14:42
Show Gist options
  • Save mcfearsome/6796 to your computer and use it in GitHub Desktop.
Save mcfearsome/6796 to your computer and use it in GitHub Desktop.
function pid {
ps xc | grep "$1" | awk '{print $1}'
}
# Behold the PATH
export PATH=/sw/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/Applications/Darwine/Contents/bin:/usr/local/maven-2.0.7/bin:/Users/comcast/sh:/Users/comcast/git-tools:/usr/local/pgsql/bin:/opt/local/bin:/opt/local/sbin:/usr/local/git/bin:$PATH
export PATH=/usr/local/bin/synergy:$PATH
# Google App Enging Path Stuff
export PATH=/Users/comcast/code/GoogleAppEngine:/Users/comcast/code/GoogleAppEngine/appengine_monkey:$PATH
# Some Jars
export CLASSPATH=$CLASSPATH:/Users/comcast/jars/
# Man Path
export MANPATH=/usr/local/git/man:$MANPATH
# Python Path
export PYTHONPATH=/users/comcast/code/django-projects:/Users/comcast/code/GoogleAppEngine:/usr/local/google_appengine:/Users/comcast/code/GoogleAppEngine/appengine_monkey:/Users/comcast/Desktop/divisr/src/Divisor:$PYTHONPATH # /Users/comcast/code/django-projects/tagging/svn:
# The ENV
export WEBLOGIC_HOME="/Servers/bea"
export FMPP_HOME="/opt/fmpp/"
export CIM_ENV="local"
# export MIDGARD_ROLE="primary"
# export SCONS_LIB_DIR=/usr/local/bin/scons-0.98.3
export JAVA_HOME='/System/Library/Frameworks/JavaVM.framework/Home'
export GIT_EXTERNAL_DIFF='/Users/Comcast/sh/git_external_diff.sh'
# Load Other Convienence Files
source ~/.LifehackerTerminalTweaks
source ~/.bashrc
source ~/.bash_aliases
source ~/.bash_completion.d/todo_completer.sh
test -r /sw/bin/init.sh && . /sw/bin/init.sh
export DISPLAY=":0.0"
export LC_CTYPE=en_US.UTF-8
# Command MSGmate
echo -e "Kernel Information: " `uname -smr`
# DTerm Additions
if [[ `ps -o ppid -p $$ | tail -1 | awk '{print $1}'` == `pid DTerm` ]]; then # these are only executed when the parent process is DTerm
export TERM="xterm-color"
export CLICOLOR_FORCE="true"
export CLICOLOR="true"
export LSCOLORS="cxgxgxgxaxaxaxbxbxcxcx"
export LS_COLORS='di=1;34:fi=0;32:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rb=90:*.py=95:*.html=92:*.css=91:*.ftl=95:*.xml=33:*.js=36'
export GREP_OPTIONS="--color=always"
echo -e "DTerm-----------------------------\n"
else
export PS1="\[${COLOR_GREEN}\][\[${COLOR_BLUE}\]\t \[${COLOR_RED}\]\u \[${COLOR_BLUE}\]\W\[${COLOR_GREEN}\]]\\$ \[${COLOR_NC}\]"
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*} ${PWD}"; echo -ne "\007"' # user@host path
export PS2='> ' # Secondary prompt
export PS3='#? ' # Prompt 3
export PS4='+' # Prompt 4
function xtitle { # change the title of your xterm* window
unset PROMPT_COMMAND
echo -ne "\033]0;$1\007"
}
echo -e "${COLOR_BROWN}`bash --version`"
echo -ne "${COLOR_GRAY}Uptime: "; uptime
echo -ne "${COLOR_GRAY}Server time is: "; date
fi
# See following for more information: http://www.infinitered.com/blog/?p=19
# Colors ----------------------------------------------------------
export TERM=xterm-color
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
export CLICOLOR=1
alias ls='ls -G' # OS-X SPECIFIC - the -G command in OS-X is for colors, in Linux it's no groups
#alias ls='ls --color=auto' # For linux, etc
# ls colors, see: http://www.linux-sxs.org/housekeeping/lscolors.html
export LS_COLORS='di=1;34:fi=0;32:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rb=90:*.py=95:*.html=92:*.css=91:*.ftl=95:*.xml=33:*.js=36' #LS_COLORS is not supported by the default ls command in OS-X
# Setup some colors to use later in interactive shell or scripts
export COLOR_NC='\e[0m' # No Color
export COLOR_WHITE='\e[1;37m'
export COLOR_BLACK='\e[0;30m'
export COLOR_BLUE='\e[0;34m'
export COLOR_LIGHT_BLUE='\e[1;34m'
export COLOR_GREEN='\e[0;32m'
export COLOR_LIGHT_GREEN='\e[1;32m'
export COLOR_CYAN='\e[0;36m'
export COLOR_LIGHT_CYAN='\e[1;36m'
export COLOR_RED='\e[0;31m'
export COLOR_LIGHT_RED='\e[1;31m'
export COLOR_PURPLE='\e[0;35m'
export COLOR_LIGHT_PURPLE='\e[1;35m'
export COLOR_BROWN='\e[0;33m'
export COLOR_YELLOW='\e[1;33m'
export COLOR_GRAY='\e[1;30m'
export COLOR_LIGHT_GRAY='\e[0;37m'
alias colorslist="set | egrep 'COLOR_\w*'" # Lists all the colors, uses vars in .bashrc_non-interactive
# Misc -------------------------------------------------------------
export HISTCONTROL=ignoredups
shopt -s checkwinsize # After each command, checks the windows size and changes lines and columns
# bash completion settings (actually, these are readline settings)
bind "set completion-ignore-case on" # note: bind used instead of sticking these in .inputrc
bind "set bell-style none" # no bell
bind "set show-all-if-ambiguous On" # show list automatically, without double tab
# Turn on advanced bash completion if the file exists (get it here: http://www.caliban.org/bash/index.shtml#completion)
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# Prompts ----------------------------------------------------------
# export PS1="\[${COLOR_GREEN}\]\w > \[${COLOR_NC}\]" # Primary prompt with only a path
# export PS1="\[${COLOR_GRAY}\]\u@\h \[${COLOR_GREEN}\]\w > \[${COLOR_NC}\]" # Primary prompt with user, host, and path
# This runs before the prompt and sets the title of the xterm* window. If you set the title in the prompt
# weird wrapping errors occur on some systems, so this method is superior
# Navigation -------------------------------------------------------
alias ..='cd ..'
alias ...='cd .. ; cd ..'
# I got the following from, and mod'd it: http://www.macosxhints.com/article.php?story=20020716005123797
# The following aliases (save & show) are for saving frequently used directories
# You can save a directory using an abbreviation of your choosing. Eg. save ms
# You can subsequently move to one of the saved directories by using cd with
# the abbreviation you chose. Eg. cd ms (Note that no '$' is necessary.)
if [ ! -f ~/.dirs ]; then # if doesn't exist, create it
touch ~/.dirs
fi
alias show='cat ~/.dirs'
save (){
command sed "/!$/d" ~/.dirs > ~/.dirs1; \mv ~/.dirs1 ~/.dirs; echo "$@"=\"`pwd`\" >> ~/.dirs; source ~/.dirs ;
}
source ~/.dirs # Initialization for the above 'save' facility: source the .sdirs file
shopt -s cdable_vars # set the bash option so that no '$' is required when using the above facility
# Other aliases ----------------------------------------------------
alias ll='ls -hl'
alias la='ls -a'
alias lla='ls -lah'
# Misc
alias g='grep -i' # Case insensitive grep
alias f='find . -iname'
alias ducks='du -cksh * | sort -rn|head -11' # Lists folders and files sizes in the current folder
alias top='top -o cpu'
alias systail='tail -f /var/log/system.log'
alias m='more'
alias df='df -h'
# Shows most used commands, cool script I got this from: http://lifehacker.com/software/how-to/turbocharge-your-terminal-274317.php
alias profileme="history | awk '{print \$2}' | awk 'BEGIN{FS=\"|\"}{print \$1}' | sort | uniq -c | sort -n | tail -n 20 | sort -nr"
# Editors ----------------------------------------------------------
export EDITOR='mate -w'
# Subversion & Diff ------------------------------------------------
export SV_USER='jmcpherson' # Change this to your username that you normally use on subversion (only if it is different from your logged in name)
export SVN_EDITOR='${EDITOR}'
alias svshowcommands="echo -e '${COLOR_BROWN}Available commands:
${COLOR_GREEN}sv
${COLOR_GREEN}sv${COLOR_NC}help
${COLOR_GREEN}sv${COLOR_NC}import ${COLOR_GRAY}Example: import ~/projects/my_local_folder http://svn.foo.com/bar
${COLOR_GREEN}sv${COLOR_NC}checkout ${COLOR_GRAY}Example: svcheckout http://svn.foo.com/bar
${COLOR_GREEN}sv${COLOR_NC}status
${COLOR_GREEN}sv${COLOR_NC}status${COLOR_GREEN}on${COLOR_NC}server
${COLOR_GREEN}sv${COLOR_NC}add ${COLOR_GRAY}Example: svadd your_file
${COLOR_GREEN}sv${COLOR_NC}add${COLOR_GREEN}all${COLOR_NC} ${COLOR_GRAY}Note: adds all files not in repository [recursively]
${COLOR_GREEN}sv${COLOR_NC}delete ${COLOR_GRAY}Example: svdelete your_file
${COLOR_GREEN}sv${COLOR_NC}diff ${COLOR_GRAY}Example: svdiff your_file
${COLOR_GREEN}sv${COLOR_NC}commit ${COLOR_GRAY}Example: svcommit
${COLOR_GREEN}sv${COLOR_NC}update ${COLOR_GRAY}Example: svupdate
${COLOR_GREEN}sv${COLOR_NC}get${COLOR_GREEN}info${COLOR_NC} ${COLOR_GRAY}Example: svgetinfo your_file
${COLOR_GREEN}sv${COLOR_NC}blame ${COLOR_GRAY}Example: svblame your_file
'"
alias sv='svn --username ${SV_USER}'
alias svimport='sv import'
alias svcheckout='sv checkout'
alias svstatus='sv status'
alias svupdate='sv update'
alias svstatusonserver='sv status --show-updates' # Show status here and on the server
alias svcommit='sv commit'
alias svadd='svn add'
alias svaddall='svn status | grep "^\?" | awk "{print \$2}" | xargs svn add'
alias svdelete='sv delete'
alias svhelp='svn help'
alias svblame='sv blame'
svgetinfo (){
sv info $@
sv log $@
}
# You need to create fmdiff and fmresolve, which can be found at: http://ssel.vub.ac.be/ssel/internal:fmdiff
alias svdiff='sv diff --diff-cmd fmdiff' # OS-X SPECIFIC
# Use diff for command line diff, use fmdiff for gui diff, and svdiff for subversion diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment