-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathzshrccr
More file actions
244 lines (188 loc) · 4.9 KB
/
zshrccr
File metadata and controls
244 lines (188 loc) · 4.9 KB
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
# Ignore case in autocompletes -- hack to make kubectl autocomplete better.
#CASE_SENSITIVE="true"
ZSH=$HOME/.oh-my-zsh
#ZSH_THEME="intheloop"
plugins=(
common-aliases
git
gitextras
gitfast
history
history-substring-search
ssh-agent
kubectl
)
DISABLE_AUTO_UPDATE="true"
source $ZSH/oh-my-zsh.sh
# history search matching entire line
# http://superuser.com/questions/417627/oh-my-zsh-history-completion
bindkey '^[OA' history-beginning-search-backward
bindkey '^[OB' history-beginning-search-forward
# right-aligned timestamp in the prompt
RPROMPT='%D{%L:%M %p}'
TMOUT=60
TRAPALRM() {
zle reset-prompt
}
# Stop creating .pyc files.
export PYTHONDONTWRITEBYTECODE=1
# Various aliases.
alias ll='ls -la'
alias la='ls -la'
alias l='ls -lh'
alias t='tree -C'
alias e='exit'
alias ex='exit'
alias sai='sudo apt install'
alias sagi='sudo apt install'
alias ssn='echo "sudo shutdown now -P\n"; sudo shutdown now -P'
alias pag='ps aux | grep'
alias count-files='find . -type f | wc -l'
alias ss='sudo $(fc -ln -1)'
alias tma='tmux attach-session'
alias ht='htop'
alias rmr='rm -r'
alias rmrf='rm -rf'
# remove things sans confirmation
unalias mv
unalias rm
# timestamped command history
alias history='fc -li -1000'
alias hgi='history | grep'
# git-related aliases
alias gs='git status --ignore-submodules=dirty'
alias gsd='gs'
alias gh='git history'
alias ga='git add'
alias gb='git branch'
alias gd='git-icdiff'
alias gcm='git commit -m'
alias gco='git checkout'
alias gf='git fetch'
alias gcam='git commit -am'
alias gacm='git commit -am'
alias gcma='git commit -am'
alias gbg='git branch | grep'
alias gpo='git push origin'
alias glo='git pull origin'
alias gmm='git merge master'
alias gld='git log --full-diff -p .'
alias gss='git stash save'
alias gsp='git stash pop'
# python-related aliases
alias py='PYENV_VERSION=2.7.15 python'
alias pt='py.test'
alias ptq='py.test -q'
#alias pla='pylama'
alias pyshs='python -m SimpleHTTPServer'
alias pshs='python -m SimpleHTTPServer'
alias jk='py.test -q && pylama'
# neovim-related aliases
alias nv='PYENV_VERSION=3.6.6 nvim'
# aliases for my blog -- write a new post and start a local server
function hnt() {
source ~/conf/virtualenvs/vebsite/bin/activate
hugo new notes/"$@".md;
}
function hs() {
source ~/conf/virtualenvs/vebsite/bin/activate
hugo server --port=8000 --watch --disableLiveReload --preserveTaxonomyNames
}
#{ adding paths
function append-to-path() {
export PATH=$PATH:"$@";
}
# the silver searcher
alias ag='ag --path-to-ignore=~/.agignore'
# docker
alias ds='docker stop -t 1'
alias dss='docker stop -t 1 $(docker ps -aq)'
alias dl='docker logs 2>&1'
alias dps='docker ps'
# universe-specific
function restart-univ-containers() {
if [[ $(docker ps -aq) ]]; then
docker stop -t 1 $(docker ps -aq)
fi
docker system prune --force
docker volume prune --force
cd $HOME/src/universe/orchestration
export ARCH=x86
make vessel backend socat_host jobs
./sim-and-backend.sh
cd - >> /dev/null
}
alias re=restart-univ-containers
function restart-backend-containers() {
if [[ $(docker ps -aq) ]]; then
docker stop -t 1 $(docker ps -aq)
fi
docker system prune --force
#docker volume prune --force
cd $HOME/src/universe/orchestration
export ARCH=x86
make backend
make jobs
./backend.sh
cd - >> /dev/null
#source $HOME/.venvs/linters/bin/activate
}
alias we=restart-backend-containers
function format-from-anywhere() {
deactivate 2>/dev/null # swallow any command-not-found errors
cd $HOME/src/universe
./format.sh
cd - >> /dev/null
}
alias fp=format-from-anywhere
alias pf=format-from-anywhere
function lint-from-anywhere() {
deactivate 2>/dev/null # swallow any command-not-found errors
cd $HOME/src/universe
./lint.sh
cd - >> /dev/null
}
alias pla=lint-from-anywhere
# platformio aliases
alias pb="pio run --project-dir embedded/vessel-teensy"
alias pu="pio run --project-dir embedded/vessel-teensy --target upload"
alias pm="pio device monitor --echo"
# Setup spaceship theme.
source "$HOME/.oh-my-zsh/custom/themes/spaceship.zsh-theme"
SPACESHIP_PROMPT_ORDER=(
dir
venv
git
line_sep
exit_code
char
)
SPACESHIP_USER_SHOW=false
SPACESHIP_DIR_COLOR=222 # a yellow of sorts
SPACESHIP_TIME_SHOW=false
SPACESHIP_GIT_BRANCH_COLOR="blue"
SPACESHIP_GIT_BRANCH_PREFIX=""
SPACESHIP_GIT_STATUS_COLOR="red"
SPACESHIP_DOCKER_SHOW=false
SPACESHIP_VENV_PREFIX="with ("
SPACESHIP_VENV_SUFFIX=") "
SPACESHIP_VENV_COLOR="white"
# golang setup
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
# AWS EB setup.
export PATH=$PATH:~/.local/bin
# Setup pyenv.
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
# Setup yarn bin and node bin (default for npm -g).
export PATH=$PATH:$HOME/.yarn/bin
export PATH=$PATH:/opt/node-v8.9.4-linux-x64/bin
# fd
unalias fd
# k8s
export KUBECONFIG=$HOME/misc/kubeconfig