-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaliases
248 lines (194 loc) · 8.71 KB
/
aliases
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
# Adds an alias to the current shell and to this file.
# Borrowed from Mislav (http://github.com/mislav/dotfiles/tree/master/bash_aliases)
add-alias ()
{
local name=$1 value=$2
echo "alias $name='$value'" >> ~/.bash_aliases
eval "alias $name='$value'"
alias $name
}
############################################################
## List
############################################################
if [[ `uname` == 'Darwin' ]]; then
alias ls="ls -G"
# good for dark backgrounds
export LSCOLORS=gxfxcxdxbxegedabagacad
else
alias ls="ls --color=auto"
# good for dark backgrounds
export LS_COLORS='no=00:fi=00:di=00;36:ln=00;35:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;31:'
# For LS_COLORS template: $ dircolors /etc/DIR_COLORS
fi
alias l="ls"
alias ll="ls -l"
alias la="ls -a"
alias lal="ls -al"
# Force less to consume color
alias less='less -R'
############################################################
## Git
############################################################
alias g="git"
alias gb="git branch -a -v"
alias gc="git commit -v"
alias gca="git commit -v -a"
alias gd="git diff"
alias gl="git pull"
alias glr="git pull --rebase"
alias gp="git push"
alias gs="git status"
alias gsr="git cherry -v trunk"
alias gg="git log --pretty=oneline"
alias ggs="git log --stat"
alias gsl="git shortlog -s -n"
alias gclean="git fetch -p && for branch in \`git branch -vv | grep ': gone]' | awk '{print \$1}'\`; do git branch -d \$branch; done"
alias gclean-force="git fetch -p && for branch in \`git branch -vv | grep ': gone]' | awk '{print \$1}'\`; do git branch -D \$branch; done"
# similar to gclean-force
# git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done
# merged but still a local branch
alias gmerged="git branch --merged | egrep -v '(^\*|main|dev)'"
# Useful report of what has been committed locally but not yet pushed to another
# branch. Defaults to the remote origin/master. The u is supposed to stand for
# undone, unpushed, or something.
function gu {
local branch=$1
if [ -z "$1" ]; then
branch=master
fi
if [[ ! "$branch" =~ "/" ]]; then
branch=origin/$branch
fi
local cmd="git cherry -v $branch"
echo $cmd
$cmd
}
function gco {
if [ -z "$1" ]; then
git checkout master
else
git checkout $1
fi
}
function st {
if [ -d ".svn" ]; then
svn status
else
git status
fi
}
############################################################
## Subversion
############################################################
# Remove all .svn folders from directory recursively
alias svn-clean='find . -name .svn -print0 | xargs -0 rm -rf'
############################################################
## OS X
############################################################
# Get rid of those pesky .DS_Store files recursively
alias dstore-clean='find . -type f -name .DS_Store -print0 | xargs -0 rm'
# Track who is listening to your iTunes music
alias whotunes='lsof -r 2 -n -P -F n -c iTunes -a -i TCP@`hostname`:3689'
############################################################
## Ruby
############################################################
alias a="autotest"
export GEMS=/opt/local/lib/ruby/gems/1.8/gems
function findgem {
echo `ls $GEMS | grep -i $1 | sort | tail -1`
}
# Use: cdgem <name>, cd's into your gems directory
# that best matches the name provided.
function cdgem {
cd $GEMS/`findgem $1`
}
# Use: gemdoc <gem name>, opens the rdoc of the gem
# that best matches the name provided.
function gemdoc {
open $GEMS/../doc/`findgem $1`/rdoc/index.html
}
alias rvmcompletion="[[ -r $rvm_path/scripts/completion ]] && source $rvm_path/scripts/completion"
############################################################
## Rails
############################################################
alias ss="script/server"
alias sg="script/generate"
alias sc="script/console"
alias rails3="rvm use ruby-1.9.2-head@rails3"
############################################################
## Miscellaneous
############################################################
alias wgeto="wget -q -O -"
alias sha1="openssl dgst -sha1"
alias sha2="openssl dgst -sha256"
############################################################
############################################################
## nginx
############################################################
alias nginx_restart='nginx_stop; nginx_start'
alias nginx_start='sudo /opt/nginx/sbin/nginx'
alias nginx_stop='sudo kill `cat /opt/nginx/logs/nginx.pid `'
alias passenger_qryptograph='passenger start -a 127.0.0.1 -p 3003 -d'
alias passenger_qryptograph_stop='passenger stop --port 3003'
alias passenger_urlstalker='passenger start -a 127.0.0.1 -p 3001 -d'
alias passenger_retirehq='passenger start -a 127.0.0.1 -p 3004 -d'
alias mongod_start='mongod run --config /usr/local/etc/mongod.conf'
# mongod run --config /usr/local/Cellar/mongodb/2.0.2-x86_64/mongod.conf
# alias mongod_start='sudo mongod --fork --logpath /var/log/mongodb.log --logappend'
# alias mongod_cleanup="sudo rm /data/db/mongod.lock && sudo mongod --repair"
############################################################
## postgres
############################################################
alias pgstart="sudo su postgres -c '/opt/local/lib/postgresql91/bin/pg_ctl -D /opt/local/var/db/postgresql91/defaultdb -l /opt/local/var/db/postgresql91/defaultdb/logfile start'"
alias pgstop="sudo su postgres -c '/opt/local/lib/postgresql91/bin/pg_ctl -D /opt/local/var/db/postgresql91/defaultdb stop -m fast'"
alias pgstatus="sudo su postgres -c '/opt/local/lib/postgresql91/bin/pg_ctl status -D /opt/local/var/db/postgresql91/defaultdb'"
############################################################
## bundler
############################################################
alias b="bundle"
alias bi="b install --path vendor"
alias bu="b update"
alias be="b exec"
alias binit="bi && b package && echo 'vendor/ruby' >> .gitignore"
############################################################
## coffee
############################################################
alias emacs_coffee="export NODE_NO_READLINE=1 && coffee"
alias E="SUDO_EDITOR=\"emacsclient -c -a emacs\" sudo -e"
############################################################
## kajabi
############################################################
alias berc="DISABLE_SPRING=1 be rails c"
alias ber="DISABLE_SPRING=1 be rails s -b 'ssl://127.0.0.1:3000?key=/Users/robchristie/dev/kajabi-products/.ssl/key.pem&cert=/Users/robchristie/dev/kajabi-products/.ssl/cert.pem'"
alias browserstack="java -jar BrowserStackTunnel.jar u8YSVjSTSO7ny5XqQ75z diamond.dev,80,0"
alias kill-sidekiq="killall -9 -m sidekiq"
alias specnojs="be rspec spec --format progress --tag ~@javascript --tag ~@js"
# alias python=/usr/local/bin/python3
# alias pip=/usr/local/bin/pip3
alias aws-docker='docker run --rm -it --tty -v "${HOME}/.aws:/root/.aws" -v "${PWD}:/aws" "amazon/aws-cli"'
alias circleci-pack='circleci config pack config/circleci > ./.circleci/config.yml'
alias awsume=". awsume"
alias tf="terraform"
alias tg="terragrunt"
alias flush-cache="sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder"
# alias eks-dev="aws eks update-kubeconfig --name dev-eks-cluster \
# && kubectl config set-context --current --namespace=kajabi-products"
# alias eks-staging="aws eks update-kubeconfig --name stage-eks-cluster \
# && kubectl config set-context --current --namespace=kajabi-products"
# alias eks-prod="aws eks update-kubeconfig --name prod-eks-cluster \
# && kubectl config set-context --current --namespace=kajabi-products"
alias kc="kubectl"
alias eks-dev="aws-sso-util login && awsume kajabi-development-admin \
&& kubectx dev-eks-cluster && kubens kajabi-products"
alias eks-qa="aws-sso-util login && awsume kajabi-qa-admin \
&& kubectx qa-eks-cluster && kubens kajabi-products"
alias eks-perf="aws-sso-util login && awsume kajabi-perf-admin \
&& kubectx perf-eks-cluster && kubens kajabi-products"
alias eks-stage="aws-sso-util login && awsume kajabi-staging-admin \
&& kubectx stage-eks-cluster && kubens kajabi-products"
alias eks-prod="aws-sso-util login && awsume kajabi-production-admin \
&& kubectx prod-eks-cluster && kubens kajabi-products"
alias ecr-login="aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 937028213865.dkr.ecr.us-east-1.amazonaws.com"
alias k8s-show-ns="kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --show-kind --ignore-not-found -n"
alias ecr-login="aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 937028213865.dkr.ecr.us-east-1.amazonaws.com"
alias sed="gsed"