-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash_profile.txt
193 lines (162 loc) · 5.4 KB
/
bash_profile.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
################################################################################
################################### HELPERS ####################################
################################################################################
# Helper to clean vars
function trimspace() {
echo ${@//[[:blank:]]/}
}
# vars
export HISTCONTRAL=ignoredups
export HISTFILESIZE=10000
export HISTZIE=10000
export HISTIGNORE=""
export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
export LSCOLORS=gxfxcxdxbxggedabagacad
export CLICOLOR=1
# colors
export DIRECTORY_COLOR="\033[38;05;222m"
export GIT_COLOR="\033[38;05;172m"
export STAGED_COLOR="\033[38;05;226m"
export MODIFIED_COLOR="\033[38;05;112m"
export UNTRACKED_COLOR="\033[38;05;117m"
export PROMPT_COLOR="\033[38;05;88m"
export USER_COLOR="\033[38;05;130m"
export HOST_COLOR="\033[38;05;130m"
export RESET_COLOR="\033[m"
# aliases
alias c="clear"
alias l="ls -al"
alias lp="ls -p"
alias lsd='ls -Gl | grep "^d"'
alias reload="source ~/.bash_profile"
alias ..="cd .."
alias ...="cd ../.."
alias update='sudo softwareupdate -i -a; brew update; brew upgrade'
alias edit="sublime ."
alias gd="bundle exec guard"
alias o="open ."
alias work="cd ~/Sites/git/work/"
alias fl="cd ~/Sites/git/freelance/"
alias info="df -h"
alias dl="youtube-dl"
alias tunnel="java -jar ~/bin/BrowserStackTunnel.jar 8vlzgcB58bVTdLITt514 localhost,80,0"
# git
alias gm="git mergetool"
alias gc="git commit -m"
alias gca="git commit -am"
alias gs="git status"
alias gb="git branch"
alias gr="git remote"
alias gco="git checkout"
alias unstage="git reset HEAD --"
alias last="git log -1 HEAD"
alias visual="gitk"
# TOOLs
alias browserstack="java -jar ~/bin/BrowserStackTunnel.jar 8vlzgcB58bVTdLITt514 localhost,80,0"
alias veevastart="git reset --hard HEAD && git pull && git clean -xfd && ant clean && ant globals && ant && ant thumbs && open . && open source/index.html"
alias simulator='open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
alias todos="find . -type f -exec grep -H -n '(TODO|FIX(ME)?):' {} \; 2> /dev/null" # find todo notes in current project
alias asp="xsp2"
alias edit="sublime ."
# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias lanip="ipconfig getifaddr en1"
alias ipl="ipconfig getifaddr en1"
alias localip="ipconfig getifaddr en1"
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
# Enhanced WHOIS lookups
alias whois="whois -h whois-servers.net"
# Flush Directory Service cache
alias flush="dscacheutil -flushcache"
# View HTTP traffic
alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'"
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
# Empty the Trash on all mounted volumes and the main HDD
# Also, clear Apple’s System Logs to improve shell startup speed
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"
# Path
PATH=${PATH}:"/usr/local/bin:/usr/local/sbin:usr/local/lib;/usr/local/mysql/bin:$PATH"
PATH=${PATH}:~/bin
PATH=${PATH}:.
NODE_PATH="/usr/local/bin:/usr/local/lib/node_modules"
# Environment Vars
export LSCOLORS=gxfxcxdxbxggedabagacad
export CLICOLOR=1
export VIM_APP_DIR=/Applications/MacVim-snapshot-62
# git-completion
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
if [ -f ~/.git-flow-completion.sh ] ; then
source ~/.git-flow-completion.sh
fi
if [ -f $HOME/.rvm/scripts/rvm ]; then
source $HOME/.rvm/scripts/rvm
fi
# bashrc
if [ -f ~/.bashrc ] ; then
. ~/.bashrc
fi
if [ -f "$HOME/.zsh" ]; then
. $HOME/.zsh
fi
#if [ -f ~/tag.sh ] ; then
# . ~/tag.sh
#fi
# COLOR RULES
# Attribute codes (ATTR):
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
#
# Text color codes (TEXT):
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
#
# Background color codes (BG):
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
#
# Format: "\033[ATTR;TEXT;BGm]" (The last "m" is important)
#
# For a color list, run ./colors
export TIME="\033[38;05;245m"
export DIRECTORY="\033[38;05;33m"
export GIT="\033[38;05;63m"
export PROMPT="\033[38;05;153m"
export RESET="\033[m"
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
# Return current git branch
function parse_git_branch {
local B=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/')
echo "${B}"
}
# Return number of staged files in folder
function gitstaged() {
local s=$(trimspace $(git diff --cached --numstat 2> /dev/null | wc -l))
if [ "0" == "${s}" ]; then
s=""
else
s=" stg: ${s}"
fi
echo "${s}"
}
# Return number of modified files in folder
function gitmodified() {
local m=$(trimspace $(git diff --numstat 2> /dev/null | wc -l))
if [ "0" == "${m}" ]; then
m=""
else
m=" mod: ${m}"
fi
echo "${m}"
}
# Return number of untracked files in folder
function gituntracked() {
local u=$(trimspace $(git ls-files --exclude-standard --others 2> /dev/null | wc -l))
if [ "0" == "${u}" ]; then
u=""
else
u=" untrk: ${u}"
fi
echo "${u}"
}
PS1="\[$DIRECTORY_COLOR\]\w \[$GIT_COLOR\]\$(parse_git_branch)\[$STAGED_COLOR\]\$(gitstaged)\[$MODIFIED_COLOR\]\$(gitmodified)\[$UNTRACKED_COLOR\]\$(gituntracked)\[$RESET_COLOR\]\n\[$USER_COLOR\]\u\[$PROMPT_COLOR\]→ \[$RESET_COLOR\]"