-
Notifications
You must be signed in to change notification settings - Fork 1
/
aliases
355 lines (308 loc) · 9.5 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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
alias ls='eza -lh --group-directories-first --icons'
alias ll='ls -lah'
alias lt='eza --tree --level=2 --long --icons --git'
alias lta='lt -a'
alias ..='cd ..;'
alias ...='.. ..'
alias g='grep -i'
alias h='history|g'
alias ducks='du -cks * | sort -rn|head -11'
alias top='top -o cpu'
alias v='mvim'
alias ":e"=vim
alias reload="cd .. && cd -"
alias :bp="echo 'Está na aba errada rapá'"
alias :bn="echo 'Está na aba errada rapá'"
alias et="m"
alias home='cd ~' # the tilda is too hard to reach
alias systail='tail -f -n0 /var/log/system.log'
alias aptail='tail -f -n0 /var/log/apache*/*log'
alias l='ls'
alias dbc='cat config/database.yml'
alias c='clear' # shortcut to clear your terminal
alias sprof='source ~/.zshrc'
alias sinstall='ruby ~/.my-dot-files/install.rb && sprof'
# useful command to find what you should be aliasing:
alias profileme="history | awk '{print \$2}' | awk 'BEGIN{FS=\"|\"}{print \$1}' | sort | uniq -c | sort -n | tail -n 20 | sort -nr"
# rails stuff
alias log='tail -f -0 ./log/*.log'
alias tailf="tail -f"
alias asp='autospec'
alias sc='ruby ./script/console'
alias dot='vim ~/sites/my-apps/my-dot-files'
alias cdm='cap deploy deploy:migrate'
alias cpd='cap production deploy'
alias cpds='cap production deploy:setup'
alias csd='cap staging deploy'
alias csds='cap staging deploy:setup'
alias model='script/generate model'
alias mailer='script/generate mailer'
alias controller='script/generate controller'
alias migration='rails g migration'
alias driver="ack 'page.driver.render' spec/requests"
alias migrate='DATABASE_NAME=fresh rake db:migrate db:test:prepare'
alias clean_migrate='DATABASE_NAME=fresh rake db:drop db:create db:migrate db:test:prepare'
alias trollback='rake db:rollback && RAILS_ENV=test rake db:rollback > /dev/null'
alias rollback='DATABASE_NAME=fresh rake db:rollback'
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
alias sconf='mate ~/.ssh/config'
alias r='rails'
alias b='bundle'
alias bx='b exec'
alias dfolha="fab -R staging deploy"
alias itsel='bundle exec infinity_test --test-unit'
alias itcap='CI=true itsel'
alias gcap='CI=true guard'
# alias run='rm -f tmp/capybara/* && clear && CI=true rspec'
# alias run_units='run spec/business && run spec/models'
alias uni="rails s puma -p 8080 -d"
alias fs="foreman start"
alias fsdev="foreman start -f Procfile.development"
alias listing="rails s -p 3001 -b 0.0.0.0"
alias server="rails s -p 3000 -b 0.0.0.0"
alias workers="QUEUE=* rake resque:work"
alias rc="rails c"
alias dcrc="dcr web bundle exec rails c"
alias u="uni"
alias ku="ps aux | grep 'rails s' | grep 'grep' -v | cut -c13-23 | xargs kill -9"
alias ru="ku && u"
alias music='mpg123 -z -C -@ ~/List.lst'
alias couchlog='tail -f /usr/local/var/log/couchdb/couch.log'
alias cassandraconf='mate /opt/cassandra/conf/storage-conf.xml'
alias mongolog='tail -f ~/Sites/Codes/homebrew/Cellar/mongodb/1.2.3-x86_64/mongodb.log'
alias tomcat='sh /Library/Tomcat/Home/bin/startup.sh'
alias sshconfig='mate ~/.ssh/config'
alias pubkey='cat ~/.ssh/*.pub'
alias mhosts='mate ~/.ssh/config'
alias smongo='mongod -f ~/Sites/Codes/homebrew/Cellar/mongodb/1.2.3-x86_64/mongod.conf --fork --logpath /~/Sites/Codes/homebrew/Cellar/mongodb/1.2.3-x86_64/mongodb.log'
alias scassandra='/opt/cassandra/bin/cassandra -f'
alias sredis='redis-server ~/Sites/Codes/homebrew/etc/redis.conf'
# replacement netstat cmd to find ports used by apps on OS X
alias netstat="sudo lsof -i -P"
alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors
function deploy {
echo "Current configuration is for `git config --get heroku.remote`"
echo -n 'Continue? [yn] '
read continue
if [ $continue = 'y' ]; then
git push `git config --get heroku.remote` `git config --get heroku.remote`:master
heroku run rake db:migrate
# say Deploy finished!
fi
}
function f() { find * -name $1; }
function p() {
sites_directory=""
if [ -d $HOME/sites ]
then
sites_directory=$HOME/sites
else
sites_directory=$HOME/code
fi
case "$1" in
"--help")
echo "To use this function:"
echo "p project_name"
echo "p --help (show this!)"
echo "p --list (list all projects)"
;;
"--list")
for f in `ls -1 $sites_directory`; do
echo "Projects in $f:"
for fin in `ls -1l $sites_directory/$f | grep "^d" | awk '{print $7}'`; do
echo " $fin"
done
done
;;
*)
for f in `ls -1 $sites_directory/`; do
if [ -d $sites_directory/$f/$1 ]; then
echo "Project found in $f"
cd $sites_directory/$f/$1
nvim
break
else
echo "Project not found in $f"
fi
done
;;
esac
}
function run() {
clear
case "$1" in
"units") rspec spec/business && rspec spec/decorators && rspec spec/lib && rspec spec/importers && rspec spec/typecasters && rspec spec/enumerations && rspec spec/parsers && rspec spec/models
;;
"business") rspec spec/business
;;
"models") rspec spec/models
;;
"enumerations") rspec spec/enumerations
;;
"models") rspec spec/models
;;
"presenters") rspec spec/presenters
;;
"requests") rspec spec/requests
;;
*) rspec $*
;;
esac
# say Specs Finished!
}
function kexec() {
case $1 in
"help") printf "USAGE:\n\n kexec namespace command\n"
;;
*) namespace=$1
shift
pod=$(kubectl get pods --field-selector=status.phase=Running --output=jsonpath={.items\[0\].metadata.name} -n $namespace)
keti $pod -n $namespace $*
;;
esac
}
function fr() {
find $3 -type f -exec sed -i.bak "s#$1#$2#" {} \;
find . -name '*.bak' -delete
}
function extract() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via >extract<" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
function manpdf() { man -t $@ | open -f -a Preview; }
function osinfo() {
x1="$(/usr/bin/sw_vers -productName)"
x2="$(/usr/bin/sw_vers -productVersion)"
x3="$(/usr/bin/sw_vers -buildVersion)"
x4="$(/usr/bin/arch)"
echo "${x1} - ${x2} - ${x3} - ${x4}"
}
alias configuration_changed='say Configured changed!'
function heroku_write {
echo '[heroku]' > ~/.my_heroku_config
echo " remote=$1" >> ~/.my_heroku_config
echo "$1 configurated"
# configuration_changed
}
function staging4 {
heroku_write staging4
}
function staging3 {
heroku_write staging3
}
function staging2 {
heroku_write staging2
}
function staging {
heroku_write staging
}
function production {
heroku_write production
}
function mobile {
heroku_write mobile
}
alias sdb='cd ~/Sites/Enjoei-databases && fsdev'
alias pubkey='cat ~/.ssh/*.pub | pbcopy && echo "Keys copied to clipboard"'
alias m='mate .'
alias et="m"
alias o='open .'
alias eprof="mate ~/.dot-files"
alias hidefile='/usr/bin/SetFile -a "V"'
alias showfile='/usr/bin/SetFile -a "v"'
alias startpg='sudo /Library/StartupItems/PostgreSQL/PostgreSQL start'
alias mg='rails g migration'
alias pjs='phantomjs'
alias pis='ruby ~/Sites/MyApps/dot-files/pis_pasep_generator.rb'
alias update='bash ~/Sites/Nohup/conversoes/update.sh'
alias raposos='psql raposos_development'
alias pow='powder'
function single {
bundle exec rake test TEST=$1
}
function fresh {
psql fresh_development
}
function hdb {
psql `heroku config:get DATABASE_URL`
}
alias pgps="heroku pg:ps"
alias pgkill="heroku pg:kill -f"
alias hstop="heroku stop"
# azk
alias azks="azk shell"
function azkrails {
azks -c "bundle exec rails $*"
}
function azkrake {
azks -c "bundle exec rake $*"
}
function for_review {
ruby -e "users = ['@andersondias', '@MarceloCajueiro', '@oliveiraethales', '@pedroandrade', '@vyper', '@eduresende', '@fellix']; puts \"#{users.shuffle.first(3).join(' ')}"\"
}
function spacemacs {
TERM=xterm-256color emacs -nw
}
function rcop {
git status --porcelain | awk '{print $2}' | grep -v "spec/" | grep "\.rb" | xargs rubocop -R
}
function drun {
clear
git status --porcelain | awk '{print $2}' | grep "spec/" | xargs rspec
}
function feature {
git flow feature start $*
}
alias codeclimate="docker run \
--interactive --tty --rm \
--env CODECLIMATE_CODE="$PWD" \
--volume "$PWD":/code \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume /tmp/cc:/tmp/cc \
codeclimate/codeclimate"
function update_js {
p saraiva
cd apps/react && yarn install
p saraiva
cd apps/bo && yarn install
}
function ojs {
p saraiva
cd apps/$1/lib/$1/web/static/js/app
}
if [ -f ~/.kubectl-alias ]
then
source ~/.kubectl-alias
fi
# Tmux alias
alias tls="tmux ls"
alias tat="tmux a -t"
alias tn="tmux new -s"
alias docker-compose="nerdctl compose"
# Python alias
alias task="pr task"
alias pip.outdated="pip --disable-pip-version-check list --outdated"
alias env.recreate="rm -rf .venv && python -m venv .venv"
function pt {
py.test -d --tx "`nproc`*popen//python=python" $1
}
alias pac.clear="yay -Qqtd | yay -Rns -"
alias pac.update="yay -Syu"
alias bc="better-commits"
alias tws="tw summary :quarter :ids"