-
Notifications
You must be signed in to change notification settings - Fork 0
/
zsh_aliases
171 lines (155 loc) · 4.74 KB
/
zsh_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
# modified commands
alias ..='cd ..'
alias ack='grc rg'
alias bc='bc -l'
alias cat='bat'
alias df='dfc'
alias dig='dog'
alias diff='delta'
alias du='ndu'
alias grep='grep --color=always'
alias man='tldr'
alias mkdir='mkdir -p -v'
alias more='less'
alias ping='grc ping -c 5'
alias svi='sudo vim'
alias tails='grc tail'
alias top='glances'
alias tree='ranger'
alias vi='vim'
alias wget='grc wget -c'
# new commands
alias da='date "+%A, %B %d, %Y [%T]"'
alias du1='du -d=1'
alias hist='history | grep $1'
alias openports='sudo lsof -PiTCP -sTCP:LISTEN'
alias pg='grc ps -Af | grep $1'
alias lsop='sudo lsof -i :$1'
alias ip='dig +short myip.opendns.com @resolver1.opendns.com'
# privileged access
if [ $UID -ne 0 ]; then
alias sudo='sudo '
alias scat='sudo cat'
alias svim='sudo vim'
alias root='sudo su'
alias reboot='sudo reboot'
alias halt='sudo halt'
alias netcfg='sudo netcfg2'
fi
# ls
alias ls='exa -GFh'
alias lr='exa -R'
alias ll='exa -al'
alias la='ll -A'
alias lx='ll -BX' # sort by extension
alias lz='ll -rS' # sort by size
alias lt='ll -rt' # sort by date
alias lm='la | more'
# safety features
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i' # 'rm -i' prompts for every file
alias ln='ln -i'
#upgrade
alias reset-ruby='brew uninstall --force --ignore-dependencies ruby && sudo rm -rf /opt/homebrew/lib/ruby && brew install ruby && gem-upgrade && gem install bundler'
alias osx-upgrade="sudo softwareupdate -ia"
alias brew-upgrade="(cd /opt/homebrew && git reset --hard origin/master) && brew update && brew bundle --global && brew upgrade && brew upgrade --cask --greedy && brew cleanup"
alias pip-upgrade="pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U"
alias gem-upgrade="gem update --system; gem update"
alias npm-upgrade="npm update -g"
alias vagrant-upgrade="vagrant plugin update"
alias vim-upgrade="vim +PlugClean! +PlugInstall +PlugUpgrade +qall"
alias zsh-upgrade="zplug clean; zplug install; zplug update"
alias hosts-upgrade="update-hosts; enable-hosts-blocking"
alias upgrade="osx-upgrade; brew-upgrade; pip-upgrade; gem-upgrade; npm-upgrade; vim-upgrade; hosts-upgrade"
#racket
alias rrepl="racket -i -p neil/sicp -l xrepl"
#tmux
alias t="tmux"
alias tn="tmux-new"
alias ta="tmux a -t"
alias tl="tmux ls"
#git
alias g="git"
alias gl="git pl"
alias ga="git aa"
alias gbr="git br"
alias gci="git ci -m"
alias gco="git co --"
alias gdc="git dc"
alias gdf="git df"
alias gfu="git fu"
alias glg="git lg"
alias gmv="git mv"
alias gpl="git pl; git submodule update"
alias gps="git ps"
alias grb="git rb"
alias gre="git remote -v"
alias grm="git rm"
alias gst="git st"
alias guc="git uc"
alias gundo="git reset --soft HEAD~1"
alias gus="git us"
alias rmb="!f() { git branch --merged | grep -v 'master' | while read i; do git branch -d $i; done; }; f"
#bundler
alias bi="bundle install"
alias bu="bundle update"
alias be="bundle exec"
alias ber="bundle exec rake"
#vagrant
alias v="vagrant"
alias vs="vagrant ssh"
alias vu="vagrant up"
alias vp="vagrant provision"
alias vh="vagrant halt"
alias vr="vagrant reload"
alias vd="vagrant destroy"
#docker
alias d="docker"
alias dr="docker run"
alias db="docker build"
alias dp="docker pull"
alias dps="docker ps"
alias di="docker images"
alias dcu="docker-compose up"
alias dcr="docker-compose run --rm"
#rails
alias railss="(bundle check || bundle install) \
yarn & \
bin/rake clear; \
bin/rake heroku:local"
#work session
alias start-working="disable-hosts-blocking; \
brew services start postgresql@14 & \
brew services start [email protected] & \
open -a 'Firefox Developer Edition' & \
open -a Loopback & \
open -a 'Audio Hijack' & \
open -a 'Elgato Control Center' & \
open -a Harvest & \
open -a Home & \
open -a Slack &"
alias stop-working="enable-hosts-blocking; \
brew services stop postgresql@13 & \
brew services stop [email protected] & \
osascript \
-e 'quit app \"Firefox Developer Edition\"' \
-e 'quit app \"Loopback\"' \
-e 'quit app \"Audio Hijack\"' \
-e 'quit app \"Elgato Control Center\"' \
-e 'quit app \"Harvest\"' \
-e 'quit app \"Home\"' \
-e 'quit app \"Slack\"'"
#ruby
alias change_ruby_2="export RUBY_HOME=/opt/homebrew/opt/[email protected]; \
export RUBY_GEMS_HOME=/opt/homebrew/lib/ruby/gems/2.7.0; \
export PATH=$RUBY_HOME/bin:$RUBY_GEMS_HOME/bin:$PATH; \
export LDFLAGS=-L$RUBY_HOME/lib; \
export CPPFLAGS=-I$RUBY_HOME/include; \
export PKG_CONFIG_PATH=$RUBY_HOME/lib/pkgconfig"
alias change_ruby_3="export RUBY_HOME=/opt/homebrew/opt/ruby; \
export RUBY_GEMS_HOME=/opt/homebrew/lib/ruby/gems/3.0.0; \
export PATH=$RUBY_HOME/bin:$RUBY_GEMS_HOME/bin:$PATH; \
export LDFLAGS=-L$RUBY_HOME/lib; \
export CPPFLAGS=-I$RUBY_HOME/include; \
export PKG_CONFIG_PATH=$RUBY_HOME/lib/pkgconfig"