-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.laspavelrc
383 lines (322 loc) · 11.8 KB
/
.laspavelrc
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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# ########################### MY CONFIGURATION ###########################
# Apply example (.bashrc): source $HOME/.laspavelrc
if [ -z "${HOME:-}" ]; then
export HOME=~
fi
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:$HOME/.krew/bin:$PATH" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$HOME/.krew/bin:$PATH"
fi
export PATH
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# ################## FUNCTION ##################
md5() { echo -n "$1" | md5sum; }
ipinfo() { curl -sL https://ip.guide/$1; echo "";}
ipinfo2() { curl ipinfo.io/$1; echo "";}
pfx2crt() {
fbname=$(basename "$1" .pfx)
openssl pkcs12 -in $fbname.pfx -clcerts -nokeys -out $fbname.crt
openssl pkcs12 -in $fbname.pfx -nocerts -out $fbname-encrypt.key
openssl rsa -in $fbname-encrypt.key -out $fbname.key
rm -f $fbname-encrypt.key
}
calcc() { awk "BEGIN{ print $* }" ;}
ssh_genkey() {
if [ -z "$1" ]; then
SSHF="$HOME/.ssh/temp"
else
SSHF="$HOME/.ssh/$1"
fi
ssh-keygen -t rsa -q -b 4096 -C "$2" -f "$SSHF"
}
ansi2text() {
cat $1 |sed s/'^'.*\\]//g > $1.tmp
mv $1.tmp $1
}
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
ssh_search() { grep "$1" ~/.ssh/config ~/.ssh/config.d/* -A 7 -B 7;}
ssh() {
tmux rename-window "$*"
command ssh "$@"
tmux rename-window "bash"
}
man() {
env \
LESS_TERMCAP_mb="$(printf '\e[1;31m')" \
LESS_TERMCAP_md="$(printf '\e[1;31m')" \
LESS_TERMCAP_me="$(printf '\e[0m')" \
LESS_TERMCAP_se="$(printf '\e[0m')" \
LESS_TERMCAP_so="$(printf '\e[1;44;33m')" \
LESS_TERMCAP_ue="$(printf '\e[0m')" \
LESS_TERMCAP_us="$(printf '\e[1;32m')" \
man "$@"
}
function passgen() {
PWD_LEN=$1
COUNT=$2
if [[ -z "${PWD_LEN}" ]]; then
PWD_LEN=15
fi
if [[ -z "${COUNT}" ]]; then
COUNT=5
fi
for i in $(eval echo "{1..$COUNT}")
do
head -c 500 /dev/urandom | tr -dc a-z0-9A-Z | head -c ${PWD_LEN}; echo
done
}
# ################## COLOR ##################
TERM=xterm-256color
# Forground
Default="\[\e[0m\]"
Black="\[\e[30m\]"
Blue="\[\e[34m\]"
Cyan="\[\e[36m\]"
DarkGray="\[\e[90m\]"
Gray="\[\e[37m\]"
Green="\[\e[32m\]"
LightBlue="\[\e[94m\]"
LightCyan="\[\e[96m\]"
LightGreen="\[\e[92m\]"
LightMajenta="\[\e[95m\]"
LightRed="\[\e[91m\]"
LightYellow="\[\e[93m\]"
Majenta="\[\e[35m\]"
Red="\[\e[31m\]"
White="\[\e[97m\]"
Yellow="\[\e[33m\]"
# Background
OnBlack="\[\e[40m\]"
OnBlue="\[\e[44m\]"
OnCyan="\[\e[46m\]"
OnDarkGray="\[\e[100m\]"
OnGreen="\[\e[42m\]"
OnLightBlue="\[\e[104m\]"
OnLightCyan="\[\e[106m\]"
OnLightGray="\[\e[47m\]"
OnLightGreen="\[\e[102m\]"
OnLightMajenta="\[\e[105m\]"
OnLightRed="\[\e[101m\]"
OnLightYellow="\[\e[103m\]"
OnMajenta="\[\e[45m\]"
OnRed="\[\e[41m\]"
OnWhite="\[\e[107m\]"
OnYellow="\[\e[43m\]"
# Reset
ColorOff="$Default"
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# Regular Colors
Black="\[\033[0;30m\]" # Black
Red="\[\033[0;31m\]" # Red
Green="\[\033[0;32m\]" # Green
Yellow="\[\033[0;33m\]" # Yellow
Blue="\[\033[0;34m\]" # Blue
Purple="\[\033[0;35m\]" # Purple
Cyan="\[\033[0;36m\]" # Cyan
White="\[\033[0;37m\]" # White
# Bold
BBlack="\[\033[1;30m\]" # Black
BRed="\[\033[1;31m\]" # Red
BGreen="\[\033[1;32m\]" # Green
BYellow="\[\033[1;33m\]" # Yellow
BBlue="\[\033[1;34m\]" # Blue
BPurple="\[\033[1;35m\]" # Purple
BCyan="\[\033[1;36m\]" # Cyan
BWhite="\[\033[1;37m\]" # White
# Underline
UBlack="\[\033[4;30m\]" # Black
URed="\[\033[4;31m\]" # Red
UGreen="\[\033[4;32m\]" # Green
UYellow="\[\033[4;33m\]" # Yellow
UBlue="\[\033[4;34m\]" # Blue
UPurple="\[\033[4;35m\]" # Purple
UCyan="\[\033[4;36m\]" # Cyan
UWhite="\[\033[4;37m\]" # White
# Background
On_Black="\[\033[40m\]" # Black
On_Red="\[\033[41m\]" # Red
On_Green="\[\033[42m\]" # Green
On_Yellow="\[\033[43m\]" # Yellow
On_Blue="\[\033[44m\]" # Blue
On_Purple="\[\033[45m\]" # Purple
On_Cyan="\[\033[46m\]" # Cyan
On_White="\[\033[47m\]" # White
# High Intensty
IBlack="\[\033[0;90m\]" # Black
IRed="\[\033[0;91m\]" # Red
IGreen="\[\033[0;92m\]" # Green
IYellow="\[\033[0;93m\]" # Yellow
IBlue="\[\033[0;94m\]" # Blue
IPurple="\[\033[0;95m\]" # Purple
ICyan="\[\033[0;96m\]" # Cyan
IWhite="\[\033[0;97m\]" # White
# Bold High Intensty
BIBlack="\[\033[1;90m\]" # Black
BIRed="\[\033[1;91m\]" # Red
BIGreen="\[\033[1;92m\]" # Green
BIYellow="\[\033[1;93m\]" # Yellow
BIBlue="\[\033[1;94m\]" # Blue
BIPurple="\[\033[1;95m\]" # Purple
BICyan="\[\033[1;96m\]" # Cyan
BIWhite="\[\033[1;97m\]" # White
# High Intensty backgrounds
On_IBlack="\[\033[0;100m\]" # Black
On_IRed="\[\033[0;101m\]" # Red
On_IGreen="\[\033[0;102m\]" # Green
On_IYellow="\[\033[0;103m\]" # Yellow
On_IBlue="\[\033[0;104m\]" # Blue
On_IPurple="\[\033[10;95m\]" # Purple
On_ICyan="\[\033[0;106m\]" # Cyan
On_IWhite="\[\033[0;107m\]" # White
# Terminal colors
PS1="$BBlue\u@\h:$BRed\$(parse_git_branch)$Color_Off$BGreen\w$ $Color_Off"
if [[ $SSH_CLIENT ]]; then
PS1="$BBlue\u@\h:$BRed\$(parse_git_branch)$Color_Off$BGreen\w$ $Color_Off"
fi
# ################## ALIAS ##################
if [ -f /usr/bin/grc ]; then
alias cvs="grc --colour=auto cvs"
alias diff="grc --colour=auto diff"
alias esperanto="grc --colour=auto esperanto"
alias gcc="grc --colour=auto gcc"
alias irclog="grc --colour=auto irclog"
alias ldap="grc --colour=auto ldap"
alias log="grc --colour=auto log"
alias netstat="grc --colour=auto netstat"
alias ping="grc --colour=auto ping"
alias proftpd="grc --colour=auto proftpd"
alias traceroute="grc --colour=auto traceroute"
alias wdiff="grc --colour=auto wdiff"
fi
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias ..='cd ../'
alias ...='cd ../..'
alias m='mount '
alias u='fusermount -u -z'
alias f='file'
alias s='stat'
alias rm='rm -i'
alias n='nano '
alias vi='vim'
alias v='vim'
alias cls='clear'
alias r='reset'
alias df='df -h'
alias du='du -h'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias mc='mc -x'
alias www="watch -tn 1 '$1'"
alias h='history '
alias free='free -h'
alias mkdir='mkdir -pv'
alias urldecode='python -c "import sys, os, urllib as ul; name = ul.unquote_plus(sys.argv[1]); print name; os.rename(sys.argv[1], name)"'
alias port='netstat -tulanp'
alias listen="lsof -P -i -n"
alias now='date +%d.%m.%Y%n%T'
alias week='date +%V'
alias flushdns='sudo resolvectl flush-caches'
# Reload the shell (i.e. invoke as a login shell)
alias reload="exec ${SHELL} -l"
alias ?="calcc $1"
alias tt="tmux attach -t 0"
# Get top process eating memory
alias psmem="ps auxf | sort -nr -k 4"
alias psmem10="ps auxf | sort -nr -k 4 | head -10"
# Get top process eating cpu
alias pscpu="ps auxf | sort -nr -k 3"
alias pscpu10="ps auxf | sort -nr -k 3 | head -10"
# Gives you what is using the most space. Both directories and files. Varies on current directory
alias most10='du -hsx * | sort -rh | head -10'
# Estimate file space usage to maximum depth
alias dud="du -d 1"
# Wine Utils
if which wine64 >/dev/null 2>&1; then
alias winbox='wine64 "$HOME/.wine/drive_c/winbox.exe"'
alias winrar='wine64 "$HOME/.wine/drive_c/Program Files/WinRAR/WinRAR.exe"'
fi
# Utils from Internet
alias weather="curl wttr.in/Dnepr"
alias speedtest="curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -"
alias dnsinfo="dig $1 @resolver1.opendns.com"
alias ydl="yt-dlp --verbose -S res,ext:mp4:m4a --merge-output-format mp4 --no-mtime $1"
alias teams-reload="killall -9 teams-for-linux && flatpak run com.github.IsmaelMartinez.teams_for_linux > /dev/null 2>&1 &"
#Docker
alias py3='docker run -it --rm --hostname py3 -v $(pwd):/data -w /data python:3.9 /bin/bash'
# Kubernetes
if which kubectx >/dev/null 2>&1; then
alias kx="kubectx"
fi
if which kubens >/dev/null 2>&1; then
alias kn="kubens"
fi
if which kubectl >/dev/null 2>&1; then
alias k="kubectl"
# Kubectl autocomplete
source <(kubectl completion bash)
complete -F __start_kubectl k
fi
if which terraform >/dev/null 2>&1; then
complete -C terraform terraform
fi
if which vault >/dev/null 2>&1; then
complete -C vault vault
fi
# Automatically prepend `cd` to directory names.
shopt -s autocd
# append rather than overwrite history
shopt -s histappend
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Autocorrect typos in path names when using the `cd` command.
shopt -s cdspell
# Save all lines of a multiple-line command in the same history entry
shopt -s cmdhist
# ################## EXPORT PARAMETERS ##################
export EDITOR="vim"
# temporary files directory
export TMPDIR="${HOME}/tmp"
# if exists Visual Studio Code use it.
if [ -f /usr/bin/code ]; then
export VISUAL="code"
alias vv="code $1"
fi
export KUBECONFIG=$(find -L ~/.kube -type f \( -name '*.yml' -o -name '*.y?ml' \) -print0 | xargs -0 echo | tr ' ' ':')
export LANG=ru_UA.UTF-8
export LC_ALL="ru_UA.UTF-8";
export LC_CTYPE="ru_UA.UTF-8";
# export LANG=en_US.UTF-8
# export LC_ALL="en_US.UTF-8";
# export LC_CTYPE="en_US.UTF-8";
export HISTCONTROL=ignorespace # leading space hides commands from history
export HISTFILESIZE=10000 # increase history file size (default is 500)
export HISTSIZE=30000
export HISTTIMEFORMAT="[%d.%m.%y %T] "
export HISTIGNORE="&:[bf]g:c:clear:ls:ll:la:l:cd:pwd:exit:df:history:exit:q:pwd:* --help"
export MANPAGER="less -X" # Don't clear the screen after quitting a `man` page
export PAGER="less"
export PYTHONIOENCODING="UTF-8" # Make Python use UTF-8 encoding for output to stdin/stdout/stderr.
export LESS="-M -n -q -i -r"
export LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;37;41:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.m4a=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.oga=01;36:*.opus=01;36:*.spx=01;36:*.xspf=01;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:"
# Save and reload history after each command finishes
if ! echo "$PROMPT_COMMAND" | grep -q history; then
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
fi
# Autocomplete
if [ -d "$HOME/.local/.bash.autocomplete.d" ]; then
shopt -s nullglob
for src in "$HOME/.local/.bash.autocomplete.d/"*; do
. "$src"
done
shopt -u nullglob
fi
# eval "$(starship init bash)"
# ########################################################################