Skip to content

Instantly share code, notes, and snippets.

@dduleone
Last active December 21, 2015 03:19
Show Gist options
  • Save dduleone/6241340 to your computer and use it in GitHub Desktop.
Save dduleone/6241340 to your computer and use it in GitHub Desktop.
bash configuration
echo "Proccessing .bash_aliases"
##
## General & Utils
##
########################################
alias hackchrome='subl -n ~/code/ChromeExtensions/'
alias hackbash='vim ~/.bash_profile && . ~/.bash_profile'
alias showbash='cat ~/.bash_profile'
alias tailbash='tail ~/.bash_profile'
alias resetprompt='export PS1="\h:\W \u\$ "'
alias ls='ls -alOFG'
alias gohome="cd ~"
alias cdp='cd -P'
#--------------------------------------#
##
## NBC
##
########################################
#alias nbcirc='ssh -b 10.10.13.90 -p 10022 [email protected]'
alias nbcirc='ssh -b 10.10.14.196 -p 10022 [email protected]'
alias duleone='ssh [email protected]'
#--------------------------------------#
##
## Apple
##
########################################
alias ipconfig='ifconfig | grep "en0:" -A6 | grep "inet"'
alias flushdns='dscacheutil -flushcache'
#--------------------------------------#
##
## Generic SVN
##
########################################
alias svnstat='svn status | grep -ve "^ M"'
alias getbranch='svn info | grep "URL:" | grep -o "http://.*"'
#--------------------------------------#
##
## Lighthouse Mobile
##
########################################
alias lheast='ssh [email protected]'
alias lhwest='ssh [email protected]'
#--------------------------------------#
##
## UGN
##
########################################
alias ugndev='ssh [email protected]'
alias ugnqa='ssh [email protected]'
alias ugnstage='ssh [email protected]'
alias ugnprod='ssh [email protected]'
alias gotougn='cd /Users/dan/Dropbox/nbc/ugn.dev/'
alias ugn_tags='svn ls $SVNREPO/branches/releases/ | tail -n 1 | grep -oP "[^/]*"'
alias svn_headrev='svn log -r committed|grep -oP "^r\d+"|grep -oP "\d+"'
alias mergetrunkhere='svn merge http://svnrepo.nbcudps.com/svn/leaf/view/ugn/trunk/ ./'
alias listfeatures='svn ls http://svnrepo.nbcudps.com/svn/leaf/view/ugn/branches/features'
alias listreleases='svn ls http://svnrepo.nbcudps.com/svn/leaf/view/ugn/branches/releases'
#--------------------------------------#
##
## Publisher
##
########################################
alias gotopub='cd /Users/dan/Dropbox/nbc/publishing/'
alias pubwebroothere='pwd | xargs -I % ln -s % /var/www_pub'
#--------------------------------------#
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
# Bold
BBlack='\e[1;30m' # Black
BRed='\e[1;31m' # Red
BGreen='\e[1;32m' # Green
BYellow='\e[1;33m' # Yellow
BBlue='\e[1;34m' # Blue
BPurple='\e[1;35m' # Purple
BCyan='\e[1;36m' # Cyan
BWhite='\e[1;37m' # White
# Underline
UBlack='\e[4;30m' # Black
URed='\e[4;31m' # Red
UGreen='\e[4;32m' # Green
UYellow='\e[4;33m' # Yellow
UBlue='\e[4;34m' # Blue
UPurple='\e[4;35m' # Purple
UCyan='\e[4;36m' # Cyan
UWhite='\e[4;37m' # White
# Background
On_Black='\e[40m' # Black
On_Red='\e[41m' # Red
On_Green='\e[42m' # Green
On_Yellow='\e[43m' # Yellow
On_Blue='\e[44m' # Blue
On_Purple='\e[45m' # Purple
On_Cyan='\e[46m' # Cyan
On_White='\e[47m' # White
# High Intensity
IBlack='\e[0;90m' # Black
IRed='\e[0;91m' # Red
IGreen='\e[0;92m' # Green
IYellow='\e[0;93m' # Yellow
IBlue='\e[0;94m' # Blue
IPurple='\e[0;95m' # Purple
ICyan='\e[0;96m' # Cyan
IWhite='\e[0;97m' # White
# Bold High Intensity
BIBlack='\e[1;90m' # Black
BIRed='\e[1;91m' # Red
BIGreen='\e[1;92m' # Green
BIYellow='\e[1;93m' # Yellow
BIBlue='\e[1;94m' # Blue
BIPurple='\e[1;95m' # Purple
BICyan='\e[1;96m' # Cyan
BIWhite='\e[1;97m' # White
# High Intensity backgrounds
On_IBlack='\e[0;100m' # Black
On_IRed='\e[0;101m' # Red
On_IGreen='\e[0;102m' # Green
On_IYellow='\e[0;103m' # Yellow
On_IBlue='\e[0;104m' # Blue
On_IPurple='\e[10;95m' # Purple
On_ICyan='\e[0;106m' # Cyan
On_IWhite='\e[0;107m' # White
# Grep, but ignore svn
#function xgrep() { grep -rn "$@" | grep -v ".svn" | grep -v ".git" ;}
function xgrep() { grep -rn "$@" --exclude-dir=".svn" --exclude-dir=".git" --exclude-dir="cache" ;}
# Case Insensitive Grep, but ignore SVN
#function xigrep() { grep -rni "$@" | grep -v ".svn" | grep -v ".git" ;}
function xigrep() { grep -rni "$@" --exclude-dir=".svn" --exclude-dir=".git" --exclude-dir="cache" ;}
# Tell me how many times string appears in files
#function count() { grep -rc "$@" ./ | grep -ve "^.*:0$" | grep -v ".svn" | grep -v ".git" ;}
function count() { grep -rc "$@" ./ --exclude-dir=".svn" --exclude-dir=".git" --exclude-dir="cache" | egrep ":[^0]\d*$" ;}
# Tell me how many times string appears in files (case-insensitive)
#function icount() { grep -rci "$@" ./ | grep -ve "^.*:0$" | grep -v ".svn" | grep -v ".git" ;}
function icount() { grep -rci "$@" ./ --exclude-dir=".svn" --exclude-dir=".git" --exclude-dir="cache" | egrep ":[^0]\d*$" ;}
#function realcd() { cd "$(ls -P $@ | grep -o '\/[^ ]*\/$')" ;}
function realcd() { cd "$(ls -P /var/www | grep -o '@.*$' | cut -c 6-)" ;}
function svnco() { svn checkout http://svnrepo.nbcudps.com/svn/leaf/view/ugn/$@ ;}
function svnls() { svn ls http://svnrepo.nbcudps.com/svn/leaf/view/ugn/$@ ;}
function magicswitch() { svn ls $SVNREPO/branches/features/ | grep "$@" | xargs -I % svn switch $SVNREPO/branches/features/%/www ;}
function mergefeature() { svn ls $SVNREPO/branches/features/ | grep "$@" | xargs -I % svn merge $SVNREPO/branches/features/% ./ ;}
function retirefeature(){ svn mv $SVNREPO/branches/features/$@ $SVNREPO/branches/features/_archive/$@/ -m "Retiring old $@ feature branch." ;}
function rmfeature(){ svn rm $SVNREPO/branches/features/$@ -m "Deleting/retiring $@ feature branch." ;}
function cofeature(){ svn ls $SVNREPO/branches/features/ | grep "$@" | xargs -I % svn checkout $SVNREPO/branches/features/% ./%/ ;}
function newfeature(){ svn copy $SVNREPO/trunk $SVNREPO/branches/features/$@ -m "Creating new feature branch: $@ from trunk." ;}
function linkwebroot(){ ls -1 /Users/dan/Dropbox/nbc/ugn.dev/ | grep "$1" | grep -o "[^/]*" | xargs -I % ln -s /Users/dan/Dropbox/nbc/ugn.dev/%/www /var/www_ugn$2 ;}
#source /usr/local/git/contrib/completion/git-completion.bash
echo "Proccessing .bash_profile"
export PATH=$PATH:/Users/dan/chromium/depot_tools
export PATH=~/bin:$PATH
export SVNREPO=http://svnrepo.nbcudps.com/svn/leaf/view/ugn
export EDITOR='subl -w'
export SVN_EDITOR='subl -w'
export http_proxy=http://proxyanbcge.nbc.com:80
export HTTP_PROXY=http://proxyanbcge.nbc.com:80
export https_proxy=http://proxyanbcge.nbc.com:80
export HTTPS_PROXY=http://proxyanbcge.nbc.com:80
source ~/.bash_colors
source ~/.bash_aliases
source ~/.bash_functions
#PS1="[\[\e[1;36m\]LOCAL\[\e[0m\]]\u@\h \W"
PS1="\[$IWhite\][\[$Green\]\u\[$IWhite\]@\[$ICyan\]\h \[$IBlue\]\W\[$IWhite\]]\[$Color_Off\]\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment