-
Notifications
You must be signed in to change notification settings - Fork 14
/
zshrc.numenor
294 lines (242 loc) · 7.97 KB
/
zshrc.numenor
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
#################
#
# Oh My ZSH Configuration
#
#################
ZSH=$HOME/.oh-my-zsh
# DISABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true" # export UPDATE_ZSH_DAYS=13
# See: https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
plugins=(git ssh-agent capistrano bundler gem git-extras web-search wd python pip npm last-working-dir virtualenv)
#################
#
# Theme
#
#################
# ZSH_THEME="afowler" #beleriand
# ZSH_THEME="af-magic" # numenor
# ZSH_THEME="avit" # caladan
# ZSH_THEME="Soliah"
# ZSH_THEME="gnzh"
# ZSH_THEME="robbyrussell"
ZSH_THEME="spaceship"
# Customize spaceship THEME
SPACESHIP_USER_SHOW="never"
SPACESHIP_USER_COLOR="blue"
SPACESHIP_HOST_SHOW="always"
SPACESHIP_HOST_COLOR="yellow"
SPACESHIP_HOST_COLOR_SSH="yellow"
SPACESHIP_DIR_TRUNC=0
SPACESHIP_DIR_COLOR="blue"
SPACESHIP_JOBS_SYMBOL="(bg jobs)"
SPACESHIP_JOBS_COLOR="red"
SPACESHIP_EXIT_CODE_SHOW="true"
SPACESHIP_EXIT_CODE_PREFIX="["
SPACESHIP_EXIT_CODE_SUFFIX="]"
SPACESHIP_EXIT_CODE_SYMBOL=""
SPACESHIP_EXIT_CODE_COLOR="black"
SPACESHIP_EXEC_TIME_COLOR="black"
SPACESHIP_VENV_SYMBOL="🐍·"
SPACESHIP_VENV_COLOR="magenta"
#################
#
# Aliases and Functions
#
#################
ssh () { command ssh "$@"; eval "$("$BASE16_SHELL/profile_helper.sh")"; }
# SSH to servers
alias arrakis='ssh -XA [email protected]'
alias caladan='ssh -XA [email protected]'
alias numenor='ssh -XA [email protected]'
alias beleriand='ssh -XA [email protected] -p 2244'
alias motorhome='ssh -XA [email protected] -p 2244'
alias bele='ssh -XA [email protected] -p 2244'
alias solaris='mosh juan@solaris'
alias gondolin='ssh -XA juan@gondolin'
alias cluster='ssh -XA juan@cluster1'
alias cluster1='ssh -XA juan@cluster1'
alias cluster2='ssh -XA juan@cluster2'
alias uqbar='ssh [email protected]'
alias tlon='ssh [email protected]'
# Common operations
alias sc='cs'
alias mv='mv -i'
alias cp='cp -iv'
alias ls='ls --color=auto --group-directories-first'
alias sl='ls --color=auto --group-directories-first'
alias l='ls --color=auto --group-directories-first'
alias ll='ls -alF --color=auto --group-directories-first'
alias la='ls -A --color=auto --group-directories-first'
alias grep='grep -i --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ..='cs ..'
alias cs..='cs ..'
# alias tmux="tmux -2"
alias xclip="xclip -selection primary -f | xclip -selection clipboard"
alias put="xsel -p"
alias haploview='java -jar ~/software/Haploview.jar'
alias fastq-mcf='~/software/ea-utils.1.1.2-537/fastq-mcf'
alias mostusedcomms="history | awk '{CMD[\$2]++;count++;}END { for (a in CMD)print CMD[a] \" \" CMD[a]/count*100 \"% \" a;}' | grep -v \"./\" | column -c3 -s \" \" -t | sort -nr | nl | head -n20"
alias tree='tree -F --dirsfirst --noreport'
alias tree+='tree -hF --du --dirsfirst --noreport'
# replace AWK with Ruby
alias rawk='/usr/bin/ruby2.3 -lane'
alias rawk,='/usr/bin/ruby2.3 -F, -lane'
alias rawk:='/usr/bin/ruby2.3 -F: -lane'
alias rawkt='/usr/bin/ruby2.3 -F"\t" -lane'
alias rawks='/usr/bin/ruby2.3 -F"\s+" -lane'
# Do not run feature specs by default:
alias rspec_no_feature='bundle exec rspec --exclude-pattern "spec/features/*"'
alias be='bundle exec'
# Git related aliases
push_branch() {
branch=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
git push $1 $branch
}
pull_branch() {
branch=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
git pull $1 $branch
}
autoload push_branch
autoload pull_branch
alias s='clear; git status'
alias gpo='git push origin'
alias gpom='git push origin master'
alias gpob='push_branch origin'
alias gfo='git fetch origin'
alias gfu='git fetch upstream'
alias gfot='git fetch origin --tags'
alias gfut='git fetch upstream --tags'
alias gpot='git push origin --tags'
alias gput='git push upstream --tags'
alias gpu='git push upstream'
alias gpum='git push upstream master'
alias gpub='push_branch upstream'
alias glo='git pull origin'
alias glom='git pull origin master'
alias glob='pull_branch origin'
alias glum='git pull upstream master'
alias glub='pull_branch upstream'
alias gadd='git add'
# Bioinformatics
alias gatk='java -jar /software/GenomeAnalysisTK-3.7/GenomeAnalysisTK-3.7.jar'
alias picard='java -jar /software/picard-2.18.2.jar'
alias snpeff='java -jar /software/snpEff-4.3m/snpEff.jar'
alias snpsift='java -jar /software/snpEff-4.3m/SnpSift.jar'
alias vep='/software/ensembl-tools-release-87/scripts/variant_effect_predictor/variant_effect_predictor.pl'
alias igv='/software/IGV_Linux_2.11.4/igv.sh'
alias admixture='/software/admixture_linux-1.3.0/admixture'
alias plink='/software/plink_linux_x86_64/plink'
# Tmux <3
alias tnew="tmux new-session -s"
alias tach="tmux attach-session -t"
#################
#
# Functions
#
#################
rsync_to_cluster1() {
rsync -avzhu --progress $1 juan@cluster1:~/downloads
}
rsync_to_cluster2() {
rsync -avzhu --progress $1 juan@cluster2:~/downloads
}
read_vcf() {
grep -v '^##' $1 | sed 's/^#//' | column -t
}
read_vcf_no_INFO() {
read_vcf $1 | ruby -F"\s+" -lane 'puts ($F.first(7) + $F[8..-1]).join("\t")' | column -t
}
grep_variant_from_vcf() {
read_vcf $2 | grep -E "($1|CHROM)"
}
grep_variant_from_vcf_no_INFO() {
read_vcf $2 | grep -E "($1|CHROM)"
}
less_vcf() {
read_vcf $1 | less -S
}
less_vcf_no_INFO() {
read_vcf_no_INFO $1 | column -t | less -S
}
bed_to_regions_format() {
awk '{ print $4 "\tchr" $1 ":" $2 "-" $3}' $1
}
pswatch () {
watch -n1 "ps aux | head -n1 && ps aux | grep '$1' | grep -v 'grep'"
}
# Doesn't work for some reason:
# https://unix.stackexchange.com/questions/27236/zsh-autocomplete-ls-command-with-directories-only
# compdef _dirs cs
cs () {
cd $1;
if [ $? -eq 0 ]; then # If dir exists!
if [ `ls | wc -l` -ge 15 ]; then
ls --color=auto --group-directories-first;
else
ls -lh --color=auto --group-directories-first;
fi
fi
}
findhome () {
find ~ -iname "*${1}*"
}
findhere () {
find . -iname "*${1}"
}
backup () {
newname=$1.`date +%Y%m%d.%H%M.bak`;
mv $1 $newname;
echo "-> Backed up to '$newname'";
cp -p $newname $1;
}
#################
#
# Etc.
#
#################
if [[ -r ~/.local/lib/python2.7/site-packages/powerline/bindings/zsh/powerline.zsh ]]; then
source ~/.local/lib/python2.7/site-packages/powerline/bindings/zsh/powerline.zsh
fi
source $ZSH/oh-my-zsh.sh
# Base16 Shell
BASE16_SHELL="$HOME/.config/base16-shell/"
[ -n "$PS1" ] && \
[ -s "$BASE16_SHELL/profile_helper.sh" ] && \
eval "$("$BASE16_SHELL/profile_helper.sh")"
#################
#
# PATH and variables
#
#################
export MYSQL_USER=juan
export MYSQL_PASS=glucolisis
export MYSQL_USER_REMOTE=juan
export MYSQL_PASS_REMOTE=Glucolisis!1
export PATH_TO_BCFTOOLS=/software/bcftools-1.9/bcftools
export PATH_TO_BGZIP=/software/htslib-1.9/bgzip
export PATH_TO_TABIX=/software/htslib-1.9/tabix
export PATH_TO_GATK3=/software/GenomeAnalysisTK-3.7/GenomeAnalysisTK-3.7.jar
export PATH_TO_REFERENCE_FASTA=~/Dropbox/bio/doctorado/pipeline/human_g1k_v37.fasta
export PATH_TO_JAVA=/usr/bin/java
export PATH_TO_PLINK=/software/plink_linux_x86_64/plink
export PATH_TO_RSCRIPT=/usr/bin/Rscript
export EDITOR=vim
export BROWSER=google-chrome
# export PATH=~/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export PATH=/home/juan/anaconda3/bin:$PATH # Anaconda
export PATH="$HOME/.rbenv/bin:$PATH" # Rb Env
cyan=$(tput setaf 6)
export STDERRED_ESC_CODE=`echo -e "$cyan"`
export LD_PRELOAD="/home/juan/software/stderred/build/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}"
eval "$(rbenv init -)"
export PATH=$PATH:/home/juan/.rbenv/versions/2.5.1/bin
# Variant Effect Predictor breaks without this:
export PERL5LIB=/home/juan/storage/paip_resources/vep_data_87:$PERL5LIB
export PERL5LIB=/home/juan/storage/paip_resources/vep_data_90:$PERL5LIB
# export PATH=$PATH:/home/juan/storage/paip_resources/vep_data_87/htslib
# export PATH=$PATH:/home/juan/storage/paip_resources/vep_data_90/htslib
export PATH=/usr/local/texlive/2019/bin/x86_64-linux:$PATH
export CLUSTER="juan@cluster1"
eval "$(dircolors ~/.dircolors)";