-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash_profile
208 lines (158 loc) · 6.23 KB
/
bash_profile
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
#!/bin/bash
# -------------------------------------------------------------------------
# This is my .bashrc, a lot of the format and ideas were borrowed from
# http://github.com/rtomayko/dotfiles/blob/rtomayko/.bashrc. Although,
# I have heavily customized for my environment.
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# SHELL VARIABLES
# -------------------------------------------------------------------------
: ${HOME=~}
# -------------------------------------------------------------------------
# SHELL SETUP
# -------------------------------------------------------------------------
# bring in system bashrc
test -r /etc/bashrc && . /etc/bashrc
# notify of bg job completion immediately
set -o notify
# default umask
umask 0022
# -------------------------------------------------------------------------
# PATH & MANPATH
# -------------------------------------------------------------------------
# usr/local/sbin
test -d "/usr/local/sbin" && PATH="$PATH:/usr/local/sbin"
# critical homebrew path
if test -n "$(command -v brew)" ; then
PATH="/usr/local/bin:$PATH"
else
# critical macports paths
test -d "/opt/local/bin" && PATH="/opt/local/bin:$PATH"
test -d "/opt/local/sbin" && PATH="/opt/local/sbin:$PATH"
test -d "/opt/local/share/man" && MANPATH="/opt/local/share/man:$MANPATH"
fi
# include our custom scripts
test -d "$HOME/bin" && PATH="$HOME/bin:$PATH"
# include our ruby gems
test -d "$HOME/.gem/ruby/1.8/bin" && PATH="$HOME/.gem/ruby/1.8/bin:$PATH"
# include mysql executables for custom mysql installation
test -d "/usr/local/mysql/bin" && PATH="/usr/local/mysql/bin:$PATH"
test -d "/usr/local/mysql/share/man" && MANPATH="/usr/local/mysql/share/man:$MANPATH"
# include subversion client for custme svn installation
test -d "/opt/subversion/bin" && PATH="/opt/subversion/bin:$PATH"
test -d "/opt/subversion/man" && MANPATH="/opt/subversion/man:$MANPATH"
# include current directory
PATH=".:$PATH"
# -------------------------------------------------------------------------
# ENVIRONMENT
# -------------------------------------------------------------------------
# virtualenv wrapper
if test -r "/usr/local/bin/virtualenvwrapper.sh" ; then
test -d "$HOME/.virtualenvs" || mkdir "$HOME/.virtualenvs"
export WORKON_HOME="$HOME/.virtualenvs"
export VIRTUALENVWRAPPER_PYTHON="/usr/bin/python"
. "/usr/local/bin/virtualenvwrapper.sh"
fi
# git helper functions
if test -r "$HOME/bin/git_bashrc" ; then
. "$HOME/bin/git_bashrc"
fi
# java & related services and utilities
if [ "$UNAME" = Darwin ]; then
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
fi
if test -n "$(command -v pylint)" && test -r "$HOME/.pylintrc"; then
export PYLINTRC="$HOME/.pylintrc"
fi
# -------------------------------------------------------------------------
# PAGER & EDITOR
# -------------------------------------------------------------------------
# EDITOR
test -n "$(command -v vim)" && EDITOR=vim || EDITOR=vi
export EDITOR
# PAGER
if test -n "$(command -v less)" ; then
PAGER="less -FirSwX"
MANPAGER="less -FiRswX"
else
PAGER=more
MANPAGER="$PAGER"
fi
export PAGER MANPAGER
# -------------------------------------------------------------------------
# LS AND DIRCOLORS (from http://github.com/rtomayko/dotfiles/)
# -------------------------------------------------------------------------
# we always pass these to ls(1)
LS_COMMON="--color=auto -hB"
#LS_COMMON="-hBG"
# setup the main ls alias if we've established common args
test -n "$LS_COMMON" &&
alias ls="command ls $LS_COMMON"
# if the dircolors utility is available, set that up to
dircolors="$(type -P gdircolors dircolors | head -1)"
test -n "$dircolors" && {
COLORS=/etc/DIR_COLORS
test -e "/etc/DIR_COLORS.$TERM" && COLORS="/etc/DIR_COLORS.$TERM"
test -e "$HOME/.dircolors" && COLORS="$HOME/.dircolors"
test ! -e "$COLORS" && COLORS=
eval `$dircolors --sh $COLORS`
}
unset dircolors
# -------------------------------------------------------------------------
# PROMPT HAWTNESS
# -------------------------------------------------------------------------
test -r "$HOME/bin/prompt_bashrc" && . $HOME/bin/prompt_bashrc
# -------------------------------------------------------------------------
# CUSTOM ALIASES FUNCTIONS
# -------------------------------------------------------------------------
# bring in aliases
test -r "$HOME/.bash_aliases" && . $HOME/.bash_aliases
# markdown
function md {
now=`date +"%Y%m%d-%H%M%S"`
perl $HOME/bin/Markdown.pl --html4tags $* > /tmp/$now.html
cat $HOME/.markdown/head.html /tmp/$now.html $HOME/.markdown/foot.html
rm /tmp/$now.html
}
# distribute ssh keys
# from http://github.com/rtomayko/dotfiles/.bashrc
push_ssh_cert(){
local _host
test -f ~/.ssh/id_dsa.pub || ssh-keygen -t dsa
for _host in "$@";
do
echo $_host
ssh $_host 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys' < ~/.ssh/id_dsa.pub
done
}
# OSX specific functions
if [ "$LOGNAME" = jtempleton ] && [ "$TERM_PROGRAM" = Apple_Terminal ]; then
# change the color of our ssh'd terminal
test -r "$HOME/bin/SetTerminalStyle" && {
function ssh {
$HOME/bin/SetTerminalStyle ssh
/usr/bin/ssh "$@"
$HOME/bin/SetTerminalStyle default
}
}
# change the color of a mysql terminal
test -r "$HOME/bin/SetTerminalStyle" && {
function mysql {
$HOME/bin/SetTerminalStyle Ocean
/usr/local/bin/mysql "$@"
$HOME/bin/SetTerminalStyle default
}
}
fi
export PS1="\u-\W$ "
export PATH="$PATH:/Library/PostgreSQL/9.0/bin"
#export PATH="$PATH:/Applications/Flash Player.app/Contents/MacOS"
# Env Vars
export MAVEN_OPTS="-Xmx1024M -XX:MaxPermSize=256M -Dsun.lang.ClassLoader.allowArraySyntax=true"
# -------------------------------------------------------------------------
# bring in other dev environments
# -------------------------------------------------------------------------
# django
test -r "$HOME/bin/django_bash_completion" && . $HOME/bin/django_bash_completion
# git
test -r "$HOME/bin/git-completion.bash" && . $HOME/bin/git-completion.bash