-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashrc
213 lines (175 loc) · 4.83 KB
/
bashrc
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
if [ -f $HOME/.profile ]; then
. $HOME/.profile
fi
# Key bindings
if [ -f $HOME/.bash_key_bindings ]; then
bind -f $HOME/.bash_key_bindings
fi
# Git autocomplete
if [ -f $HOME/.git-completion ]; then
source $HOME/.git-completion
source $HOME/.git-prompt
fi
# for mac
# PYTHONBIN=/Library/Frameworks/Python.framework/Versions/2.7/bin
# Set Python warnings back to the default level for Python 2.7+
#export PYTHONWARNINGS="d"
# VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
# for mac
# VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/2.7/bin/python
# Virtualenv wrappers. Make sure this directory has been created already.
export WORKON_HOME=$HOME/.virtualenvs
if [ ! -d $WORKON_HOME ]; then
mkdir $WORKON_HOME
fi
VENV_SH=/usr/local/bin/virtualenvwrapper.sh
if [ -f $VENV_SH ]; then
source $VENV_SH;
fi
if [ -f $HOME/.bbucket ]; then
source $HOME/.bbucket
fi
if [ -f $HOME/.tmuxinator.bash ]; then
source $HOME/.tmuxinator.bash
fi
# This is required to build certain things on OSX 10.6+
# export ARCHFLAGS="-arch i386 -arch x86_64"
# pip bash completion start
_pip_completion()
{
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
PIP_AUTO_COMPLETE=1 $1 ) )
}
complete -o default -F _pip_completion pip
# pip bash completion end
export HISTFILESIZE=3000
export LSCOLORS=cxfxcxdxbxegedabagacad
# GOLANG
export GOPATH=$HOME/go
if [ ! -d $GOPATH ]; then
mkdir $GOPATH
fi
# Add a few things
PATH=/usr/local/git/bin:/usr/local/bin:/usr/local/sbin:$GOPATH/bin:$HOME/.rvm/bin:$PATH:$HOME/bin:$PYTHONBIN
# Java/Hadoop
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
# Add the git state into the prompt
export PS1='\u@\h$(__git_ps1 "(%s)")\$ '
GIT_PS1_SHOWUPSTREAM="auto"
# Deal with bash completions
for fn in `ls /usr/local/etc/bash_completion.d`; do
source /usr/local/etc/bash_completion.d/$fn
done
if [[ -z "$TMUX" ]]; then
export TERM=xterm-256color
fi
export SVN_EDITOR=vim
export EDITOR=vim
export DO_TOKEN=
export GITHUB_TOKEN=
export HOMEBREW_GITHUB_API_TOKEN=$GITHUB_TOKEN
export EXERCISM_KEY=
export NEWRELIC_API_KEY=
export SPARTAN_SLACK_TOKEN=
# Screen stuff
alias screen='TERM=screen screen'
### brianz aliases
alias ls='ls -G'
alias l='ls -lF'
alias la='ls -alF'
alias lt='ls -lFt'
alias p='pwd'
alias v='vim'
alias c='clear'
alias grep="egrep --color=auto"
alias egrep="egrep --color=auto"
alias cd..='cd ..'
alias gpp='g++'
alias updb='sudo /usr/libexec/locate.updatedb'
alias vg='vagrant'
alias vup='vagrant up'
alias vdown='vagrant suspend'
alias cleanpyc="find . -name '*.pyc' | xargs rm"
alias list_ports="netstat -lnptu"
alias wanip='dig +short myip.opendns.com @resolver1.opendns.com'
alias tm='tmux'
alias camerakill='sudo killall VDCAssistant'
alias weather='curl wttr.in/fnl'
function restartdnsmasq() {
sudo launchctl stop homebrew.mxcl.dnsmasq;
sudo launchctl start homebrew.mxcl.dnsmasq;
}
if [ -d /usr/local/Cellar/clojure-contrib/1.2.0 ]; then
export CLASSPATH=$CLASSPATH:/usr/local/Cellar/clojure-contrib/1.2.0/clojure-contrib.jar
fi
function export_aws_keys() {
export AWS_KEY_PAIR="brianz-aws-console"
export AWS_DEFAULT_REGION="us-west-2"
if [[ "$1" == "rlog" ]]; then
export AWS_KEY_PAIR="brianz-roastlog"
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
elif [[ "$1" == "bz" ]]; then
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
else
export AWS_DEFAULT_REGION=
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
fi
}
function export_intercom_keys() {
if [[ "$1" == "prod" ]]; then
export INTERCOM_KEY='PROD'
export INTERCOM_APPID='PROD'
export INTERCOM_TOKEN='PROD='
else
# test creds
export INTERCOM_KEY='TEST'
export INTERCOM_APPID='TEST'
export INTERCOM_TOKEN='TEST='
fi
}
function grepsrc () {
find . -name "$1" | xargs egrep "$2";
}
function gistme() {
gist -p -s -c -f $1 $@
}
function shorturl() {
if [[ ! $1 ]]; then
return
fi
code=${2:-}
response=$(curl -i -s -L https://git.io \
-F "url=$1" \
-F "code=$code")
echo $response
#| grep Location | awk '{print $2}')
echo $url | pbcopy
echo $url
}
function gitsha() {
gitsha=`git log -1 --format=%h`
echo $gitsha
echo $gitsha | pbcopy
}
function clean_venv() {
deactivate && rmvirtualenv $1 && mkvirtualenv $1
}
function vundle_install() {
vim +PluginInstall +qall
}
function dclean() {
docker rm -v $(docker ps -a -q -f status=exited) 2> /dev/null
docker rmi $(docker images -f "dangling=true" -q) 2> /dev/null
}
export_aws_keys bz
export_intercom_keys