Created
January 14, 2014 18:00
-
-
Save thepatrick/8422719 to your computer and use it in GitHub Desktop.
My .bashrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#~/.bashrc: executed by bash(1) for non-login shells | |
#01;32m: | |
#35 = magenta | |
#34 = blue | |
#32 = green | |
#33 = yellow | |
#31 = red | |
#30 = black | |
#29 = white | |
DEFAULT_COLOR="33" | |
if [ "$OSTYPE" == "darwin13" ]; then | |
DEFAULT_COLOR="29" | |
fi | |
if [ -f /etc/redhat-release ]; then | |
DEFAULT_COLOR="31" | |
fi | |
if [ -f /etc/debian_version ]; then | |
DEFAULT_COLOR="32" | |
fi | |
case "$TERM" in | |
xterm-256color) | |
PS1='[\[\033[${DEFAULT_COLOR};${DEFAULT_COLOR}m\]${USER}@\h\[\033[00m\]] \[\033[32;32m\]${PWD}\[\033[00m\]\$ ' | |
;; | |
xterm-color) | |
PS1='\[\033[${DEFAULT_COLOR};${DEFAULT_COLOR}m\]${USER}@\h\[\033[00m\]:\[\033[32;32m\]${PWD}\[\033[00m\]\$ ' | |
;; | |
xterm-256color) | |
PS1='\[\033[${DEFAULT_COLOR};${DEFAULT_COLOR}m\]${USER}@\h\[\033[00m\]:\[\033[32;32m\]${PWD}\[\033[00m\]\$ ' | |
;; | |
xterm*|rxvt*) | |
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' | |
;; | |
*) | |
;; | |
esac | |
#Top 5 memory hogs | |
function memh() { | |
top -n 5 -o rprvt -l1 | tail -n 5 | awk '{ printf "%5d\t%-10s\t%4.1fMB\n", $1, $2, $(NF-3) }'; | |
} | |
#Back Up and date | |
function bkdate() { | |
cp $1 $1.`date +%Y%m%d`; | |
} | |
# Add a directory to PATH if it exists | |
function add_to_path() { | |
if [ -d $1 ]; then | |
PATH="$1":"${PATH}" | |
fi | |
} | |
add_to_path /usr/bin | |
add_to_path /usr/sbin | |
add_to_path /usr/local/bin | |
add_to_path /usr/local/sbin | |
add_to_path /Library/PostgreSQL8/bin | |
add_to_path /usr/local/lib/erlang/lib/rabbitmq_server-1.4.0/sbin | |
add_to_path ~/SourceCache/from-svn/depot_tools | |
add_to_path ~/bin | |
export PATH | |
if [ -f /usr/bin/nano ]; then | |
export EDITOR="nano" | |
fi | |
if [ -f /usr/bin/pico ]; then | |
export EDITOR="pico" | |
fi | |
if [ -f /usr/local/bin/mate ]; then | |
export EDITOR="mate -aw" | |
fi | |
alias lsl='ls -lFh' | |
alias lsa='ls -laFh' | |
# don't put duplicate lines in the history. See bash(1) for more options | |
export HISTCONTROL=ignoredups | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
if [ "$OSTYPE" == "darwin13" ]; then | |
alias getinfo='xcrun GetFileInfo' | |
alias screenback='/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background &' | |
alias top='top -u' | |
fi | |
if [ "$OSTYPE" == "linux-gnu" ]; then | |
if [ "$TERM" != "dumb" ]; then | |
eval "`dircolors -b`" | |
alias ls='ls --color=auto' | |
fi | |
fi | |
if [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
fi | |
# Allow per-host customization | |
if [ -f ~/.bashrc_local ]; then | |
. ~/.bashrc_local | |
fi | |
if [ "`which git`!" != "!" ]; then | |
alias tag-genocide='for tag in $(git tag | tr "\n" " "); do git tag -d $tag; done' | |
fi | |
if [ -f ~/.git-completion.sh ]; then | |
. ~/.git-completion.sh | |
fi | |
function http(){ | |
curl http://httpcode.info/$1; | |
} | |
### Added by the Heroku Toolbelt | |
export PATH="/usr/local/heroku/bin:$PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment