-
Notifications
You must be signed in to change notification settings - Fork 0
/
mac_bash_profile
262 lines (204 loc) · 6.99 KB
/
mac_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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
function h { history |grep $1; };
function genPass () {
if [ "$1" == "" ]; then
count=8;
amount=4;
else
count=$1;
if [ "$2" == "" ]; then
amount=4;
else
amount=$2;
fi
fi
cat /dev/random| env LC_CTYPE=C tr -dc 'a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?='|fold -w $count| head -n $amount| grep -i '[!@#$%^&*()_+{}|:<>?=]'
}
# Google it!
# @google <search term>
function @google {
open "https://google.com/search?q=$*"
}
alias {goog,goo,g}=@google
if [ $(uname) == Linux ]; then
SUBL=/usr/local/bin/subl
git () {
if [[ -n $(type git-$1 > /dev/null 2>&1 || echo "NO") ]]; then
/usr/bin/git "$@";
else
git-$1;
fi
}
else
SUBL=/Applications/Sublime\ Text\ 2.app/Contents/MacOS/Sublime\ Text\ 2
fi
function sman() {
man "${1}" | col -b | open -f -a SUBL
}
function remote_vim () {
curl $1 | vim -;
}
function shh () {
OKPASS=0;
echo -n "Filename: ";
read file;
if [ "$file" == "" ]; then
echo "Bad filename.";
return 1;
fi
if [ -f "$file.enc.txt" ]; then
echo "File Exists"
return 1
fi
while [[ $OKPASS == 0 ]];
do
unset password
prompt="Password: "
while IFS= read -p "$prompt" -r -s -n 1 char
do
if [[ $char == $'\0' ]]
then
break
fi
prompt='*'
password+="$char"
done
echo;
unset confirm
prompt="Confirm: "
while IFS= read -p "$prompt" -r -s -n 1 char
do
if [[ $char == $'\0' ]]
then
break
fi
prompt='*'
confirm+="$char"
done
echo;
if [[ "$password" == "$confirm" ]]; then
OKPASS=1;
else
echo "Passwords do not match.";
fi
done
echo;
unset text;
echo "Text:";
prompt="";
while IFS= read -p "$prompt" -r -s -n 1 char
do
prompt=".";
if [[ $char == "" ]]; then
echo;
prompt="";
char=$'\n';
fi
if [[ $char == " " ]]; then
echo -n " ";
prompt="";
fi
if [[ $(printf "%d\n" \'$char) == 127 ]]; then
text="${text%?}";
echo -n -e "\b \b";
prompt="";
char="";
fi
if [[ $(printf "%d\n" \'$char) == 4 ]]; then
echo;
echo;
echo -n -e $"$text" | openssl enc -aes-256-cbc -pass pass:$password -out $file.enc.txt;
break;
fi
text+="$char";
done;
}
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
# Set prompt: " username@hostname/directory/tree $ " (with colors)
export PS1="\\[\\e[36m\\]\\W \\[\\e[33m\\]\$(parse_git_branch)\\[\\e[0m\\]\\[\\e[33m\\]\$ \\[\\e[37m\\] "
#export PS1="\\[\\e[32m\\]\\u\\[\\e[0m\\]\\[\\e[32m\\]@\\h\\[\\e[36m\\]\\w \\[\\e[33m\\]\$(parse_git_branch)\\[\\e[0m\\]\\[\\e[33m\\]\$ \\[\\e[37m\\]\n"
#export PS1="\[\e[32;1m\]\u\[\e[0m\]\[\e[32m\]@\h\[\e[36m\]\w \[\e[33m\]\$(parse_git_branch)\[\e[0m\]\[\e[33m\]\$ \[\e[37;40m\]"
#export PS1="\[\e[32;1m\]\u\[\e[0m\]\[\e[32m\]@\h\[\e[36m\]\w \[\e[33m\]\$"
#export PS1='\u@\h \[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)$ '
set -o emacs
export EDITOR=vim
export MANWIDTH=80
#aliases
if [ $(uname) == Linux ]; then
alias ls='ls --color'
alias l='ls -ltrh --color'
else
alias ls='ls -G'
alias l='ls -Gltrh'
alias mysql='/Applications/MAMP/Library/bin/mysql'
alias mysqldump='/Applications/MAMP/Library/bin/mysqldump'
fi
alias a='grep -Ir TODO * > TODO;git add .;git commit -a;git push'
alias grep='grep --color'
alias d='screen bash -c "cd \"$PWD\" && exec $SHELL --login"'
alias vlc=/Applications/VLC.app/Contents/MacOS/VLC
alias matrix='source ~/scripts/matrix-prompt'
alias m='source ~/scripts/matrix-prompt'
alias p='clear;pwd'
# Git aliases
alias co='git checkout'
alias s='git status'
alias gitx='open -a GitX .'
declare -x PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:$HOME/scripts:$PATH"
[[ -s "/Users/davealbert/.rvm/scripts/rvm" ]] && source "/Users/davealbert/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# Tell me the battery percentage when I open bash
#if [ $(uname) != Linux ]; then
#echo -n "BNBMouseDevice" ;ioreg -c BNBMouseDevice | grep BatteryPercent |grep -v max
#echo -n "BNBTrackpadDevice";ioreg -c BNBTrackpadDevice | grep BatteryPercent|grep -v max
#echo -n "AppleBluetoothHIDKeyboard";ioreg -c AppleBluetoothHIDKeyboard | grep BatteryPercent|grep -v max
#fi
export IRCNAME="I have nothing to say here."
COLUMNS=250
##
# Your previous /Users/davealbert/.bash_profile file was backed up as /Users/davealbert/.bash_profile.macports-saved_2012-08-03_at_07:27:59
##
# MacPorts Installer addition on 2012-08-03_at_07:27:59: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
if [ -d /usr/local/pgsql/bin ] ; then
PATH="/usr/local/pgsql/bin:${PATH}"
fi
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
PATH=$PATH:/usr/local/Cellar/binutils/2.23/bin
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
##
# Your previous /Users/davealbert/.bash_profile file was backed up as /Users/davealbert/.bash_profile.macports-saved_2013-04-21_at_17:39:41
##
# MacPorts Installer addition on 2013-04-21_at_17:39:41: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH=/Applications/MAMP/bin/php5/bin:$PATH
alias art='php artisan'
##
# Your previous /Users/DaveAlbert/.bash_profile file was backed up as /Users/DaveAlbert/.bash_profile.macports-saved_2013-07-05_at_08:01:26
##
# MacPorts Installer addition on 2013-07-05_at_08:01:26: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
alias t=phpunit
stty -ixon -ixoff
alias pp='python -mjson.tool'
alias pass='read -p "password: " -s password && echo $password | md5 | pbcopy && unset password'
alias KeeLocal='echo -n ~/code/KeePass/local.key|pbcopy && open -n /Applications/KeePassX.app ~/code/KeePass/local.kdb'
alias KeeOE='echo -n ~/code/KeePass/OE-vault.key|pbcopy && open -n /Applications/KeePassX.app ~/Perforce/dave_albert_eStore/depot/eStore/OE/OE_keychain.kdb'
complete -W "$(echo `cat ~/.ssh/config |grep host |grep -v -e "[h|H]ostname"| grep -v \#|cut -f 2 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh
export PATH=/usr/bin:$PATH
#export DOCKER_HOST=tcp://127.0.0.1:4243 # Symc
#export DOCKER_HOST=tcp://192.168.59.103:2376 # Home
#export DOCKER_CERT_PATH=/Users/davealbert/.boot2docker/certs/boot2docker-vm
#export DOCKER_TLS_VERIFY=1
#declare -x DOCKER_CERT_PATH="/Users/davealbert/.docker/machine/machines/default"
#declare -x DOCKER_HOST="tcp://192.168.99.100:2376"
#declare -x DOCKER_MACHINE_NAME="default"
#declare -x DOCKER_TLS_VERIFY="1"
complete -W "$(docker 2>&1 |tail -n 35|cut -d' ' -f 5)" docker
export GOPATH="/Users/davealbert/code/_Training/go"