-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy path.alias_zsh
executable file
·394 lines (350 loc) · 10.6 KB
/
.alias_zsh
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
384
385
386
387
388
389
390
391
392
393
394
#!/usr/bin/zsh
# cat molot-tora.mp4 eraz.zip > data.mp4
# unzip date.mp4
# git.io custom url
# curl -i https://git.io -F "url=https://github.com/creio" -F "code=YOUR_CUSTOM_NAME"
# laravel
alias sail='[ -f sail ] && sh sail || sh vendor/bin/sail'
alias sz="source $HOME/.zshrc"
alias ez="$EDITOR $HOME/.zshrc"
alias ea="$EDITOR $HOME/.alias_zsh"
alias merge="xrdb -merge $HOME/.Xresources"
alias xcolor="xrdb -query | grep"
alias vga="lspci -k | grep -A 2 -E '(VGA|3D)'"
alias upgrub="sudo grub-mkconfig -o /boot/grub/grub.cfg"
alias updir="LC_ALL=C xdg-user-dirs-update --force"
alias dmrun="dmenu_run -l 10 -p 'run >' -fn 'ClearSansMedium 9' -nb '#282c37' -nf '#f2f3f4' -sb '#5a74ca' -sf '#fff'"
alias iip="curl --max-time 10 -w '\n' http://ident.me"
alias tb="nc termbin.com 9999 | xsel -b -i"
alias speed="curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -"
# blur img: blur 4 .wall/wl3.jpg blur.jpg
blur() {
convert -filter Gaussian -blur 0x$1 $2 $3
}
tbg() {
urxvt -bg '[0]red' -b 0 -depth 32 +sb -name urxvt_bg &
}
# fzf
zzh() {
du -a ~/ | awk '{print $2}' | fzf | xargs -r $EDITOR
}
zz() {
du -a . | awk '{print $2}' | fzf | xargs -r $EDITOR
}
zzd() {
du -a $1 | awk '{print $2}' | fzf | xargs -r $EDITOR
}
zzb() {
find -H "/usr/bin" "$HOME/.bin" -executable -print | sed -e 's=.*/==g' | fzf | sh
}
alias batc="bat -p --color=always"
# deps source-highlight
hcat() {
/usr/bin/src-hilite-lesspipe.sh "$1" | less -m -N
}
ccat() {
cat "$1" | xsel -b -i
}
# share vbox,local: mkdir vboxshare
# vbox uid={имя пользователя} git={группа}
vboxshare() {
[[ ! -d ~/vboxshare ]] && mkdir -p ~/vboxshare
sudo mount -t vboxsf -o rw,uid=1000,gid=985 vboxshare vboxshare
# sudo mount -t vboxsf -o rw,uid=st,gid=users vboxshare vboxshare
}
# share qemu
vmshare() {
[[ ! -d ~/vmshare ]] && mkdir -p ~/vmshare
sudo mount -t 9p -o trans=virtio,version=9p2000.L host0 vmshare
}
# aur pkg
amake() {
git clone https://aur.archlinux.org/"$1".git
# curl -fO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz
cd $1
makepkg -s
# makepkg -s --sign
cd ..
}
# aur clean chroot manager
accm() {
git clone https://aur.archlinux.org/"$2".git
# curl -fO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz
# tar -xvf $1.tar.gz
cd $2
sudo ccm "$1"
gpg --detach-sign "$2"-*.pkg*
cd ..
}
# pkg clean chroot manager
lccm() {
sudo ccm "$1"
gpg --detach-sign *.pkg*
}
aget() {
git clone https://aur.archlinux.org/"$1".git
# curl -fO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz
# tar -xvf $1.tar.gz
cd $1
}
# build and install pkg from aur
abuild() {
cd ~/.build
git clone https://aur.archlinux.org/"$1".git
# curl -fO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz
# tar -xvf $1.tar.gz
cd $1
makepkg -si --skipinteg
cd ~/
# rm -rf ~/.build/$1 ~/.build/$1.tar.gz
rm -rf ~/.build/$1
}
# alias neofetch="neofetch --ascii ~/.config/neofetch/ctlos"
alias neoa="neofetch --ascii ~/.config/neofetch/mario"
alias neo="neofetch --w3m ~/.config/neofetch/mmm.jpg"
# alias neo="neofetch --kitty ~/.config/neofetch/cn.jpg"
# alias neo="neofetch --w3m"
# Погода, не только по городу, но и по месту. Нет привязки к регистру и языку.
# alias wtr="curl 'wttr.in/Москва?M&lang=ru'"
# alias wtr="curl 'wttr.in/Москва?M&lang=ru' | sed -n '1,17p'"
# alias wtr="curl 'wttr.in/?M1npQ&lang=ru'"
wtr() {
# curl "wttr.in/?M$1npQ&lang=ru"
curl "wttr.in/Gomel?M$1npQ&lang=ru"
}
wts() {
curl "wttr.in/$1?M&lang=ru"
}
alias moon="curl 'wttr.in/Moon'"
alias srm="sudo rm -rfv"
alias rm="rm -rfv"
crm() {
# /bin/bash -c "yes | rm -rfv $1"{.\*\,\*}
/bin/bash -c "rm -rfv $1{.*,*}"
}
scrm() {
sudo /bin/bash -c "rm -rfv $1{.*,*}"
}
alias la="ls -alFh --color=auto"
alias llp="stat -c '%A %a %n' {*,.*}"
alias ll="ls -CFa --color=auto"
alias l="ls -CF --color=auto"
alias las="exa -lahg --group-directories-first --octal-permissions"
alias lss="ls -sh | sort -h"
alias duh="du -d 1 -h | sort -h"
alias jctl="journalctl -p 3 -xb"
mkj() {
mkdir -p "$@" && cd "$_" || exit
}
fcd() {
local dir
dir=$(fd --type d --follow --hidden | fzf --preview 'tree -l -L 1 {}' +m) &&
cd "$dir"
}
fkill() {
local pid
if [ "$UID" != "0" ]; then
pid=$(ps -f -u $UID | sed 1d | fzf -m | awk '{print $2}')
else
pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}')
fi
if [ "x$pid" != "x" ]; then
echo "$pid" | xargs kill "-${1:-9}"
fi
}
alias /="cd /"
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......='cd ../../../../..'
alias w="cd /media/files/work"
alias wwg="cd /media/files/work/work-gulp"
alias ghc="cd /media/files/github/creio"
alias ghd="cd /media/files/github/creio/dots"
alias srht="cd /media/files/srht"
function gc() {
git clone "$1" ${2}
}
function gcj() {
if [[ -n "$2" ]]; then
git clone "$1" "$2"
cd "$2"
else
git clone "$1"
local to=$(echo ${1##*/} | sed 's/\..*//')
cd $to
# $EDITOR .
fi
}
alias gl="git log --stat --pretty=oneline --graph --date=short"
# alias gg="gitg &"
alias ga="git add --all"
gac() {
git add --all
git commit -am "$1"
}
alias gr="git remote"
alias gf="git fetch"
alias gpl="git pull"
alias gp="git push"
alias gpb="git push origin $1"
# yarn global add github-search-repos-cli
# alias gsc="github-search-repos -i"
# tor chromium
alias torc="$BROWSER --proxy-server='socks://127.0.0.1:9050' &"
alias psi="$BROWSER --proxy-server='socks://127.0.0.1:3081' &"
# full screen flags -fs
alias yt="pipe-viewer"
ytv() {
pipe-viewer "$1"
}
# youtube-dl --ignore-errors -o '~/Видео/youtube/%(playlist)s/%(title)s.%(ext)s' https://www.youtube.com/playlist?list=PL-UzghgfytJQV-JCEtyuttutudMk7
# Загрузка Видео ~/Videos или ~/Видео
# Пример: dlv https://www.youtube.com/watch?v=gBAfejjUQoA
dlv() {
youtube-dl --ignore-errors -o '~/Videos/youtube/%(title)s.%(ext)s' "$1"
}
# dlp https://www.youtube.com/playlist?list=PL-UzghgfytJQV-JCEtyuttutudMk7
dlp() {
youtube-dl --ignore-errors -o '~/Videos/youtube/%(playlist)s/%(title)s.%(ext)s' "$1"
}
# Загрузка аудио ~/Music или ~/Музыка
# Пример: mp3 https://www.youtube.com/watch?v=gBAfejjUQoA
mp3() {
youtube-dl --ignore-errors -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o '~/Music/youtube/%(title)s.%(ext)s' "$1"
}
# mp3p https://www.youtube.com/watch?v=-F7A24f6gNc&list=RD-F7A24f6gNc
mp3p() {
youtube-dl --ignore-errors -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o '~/Music/youtube/%(playlist)s/%(title)s.%(ext)s' "$1"
}
alias porn="mpv 'http://www.pornhub.com/random'"
alias mvis="ncmpcpp -S visualizer"
alias m="ncmpcpp"
alias h="btm"
pf() {
peerflix "$1" --mpv
}
alias rss="newsboat"
alias wget="wget --no-hsts"
# download web site
wgetw() {
wget -rkx "$1"
}
iso() {
sudo dd bs=4M if="$1" of=/dev/"$2" status=progress && sync
}
alias -s {mp3,m4a,flac,mp4,mkv,webm}="mpv"
alias -s {png,jpg,tiff,bmp,gif}="viewnior"
alias -s {pdf}="xreader"
# alias -s {conf,txt}="nvim"
# alias {aurman,pikaur,trizen,yaourt}="yay"
function c() {
[[ $(command -v code >/dev/null 2>&1) ]] && code -a "$1" || vscodium -a "$1"
}
alias code='c'
alias vscodium='c'
function s() {
subl -a "$1" &
}
function sudos() {
sudo subl -a "$1" &
}
alias mi="micro"
alias smi="sudo micro"
alias tm="tmux attach || tmux new -s work"
alias tmd="tmux detach"
alias tmk="tmux kill-server"
# ~/.config/ranger/rc.conf ## set save_tabs_on_exit true
# alias rr='ranger --cmd="tab_shift 4" --cmd=tab_close'
alias rr='ranger'
alias srr="sudo ranger"
# alias {v,vi,vim}="nvim"
# LANG=C pacman -Sl | awk '/\[installed\]$/ {print $2}' > ~/.pkglist.txt
# LANG=C pacman -Sl | awk '/\[installed\]$/ {print $1 "/" $2 "-" $3}' > ~/.pkglist.txt
alias pkglist="pacman -Qneq > ~/.pkglist.txt"
alias aurlist="pacman -Qmeq > ~/.aurlist.txt"
alias pqo="pacman -Qqo"
alias pl="pacman -Slq | fzf --preview 'pacman -Si {}' --layout=reverse"
alias pkey="sudo pacman-key --init && sudo pacman-key --populate && sudo pacman-key --refresh-keys --keyserver hkp://keys.gnupg.net && sudo pacman -Syy"
alias y="yay -S"
alias yn="yay -S --noconfirm"
alias yl="yay -S --noconfirm - < ~/.pkglist.txt"
alias ys="yay"
alias ysn="yay --noconfirm"
alias yo="yay -S --overwrite='*'"
alias yno="yay -S --noconfirm --overwrite='*'"
alias yU="yay -U"
alias yUo="yay -U --overwrite='*'"
alias yc="yay -Sc"
alias ycc="yay -Scc"
alias yy="yay -Syy"
alias yu="yay -Syyu"
alias yun="yay -Syyu --noconfirm"
alias yr="yay -R"
alias yrs="yay -Rs"
alias yrsn="yay -Rsn"
alias yrdd="yay -Rdd"
alias yrn="yay -R --noconfirm"
alias ynskip='yay --noconfirm --mflags "--nocheck --skipchecksums --skippgpcheck"'
alias yngpg='yay --noconfirm --gpgflags "--keyserver keys.gnupg.net"'
# alias pres="sudo pacman -S $(pacman -Qqn)"
# alias yrsnp="yay -Rsn $(pacman -Qdtq)"
# alias yal="yay -S --noconfirm --needed $(cat ~/.aurlist.txt)"
# pacman -Qqo /usr/lib/python3.9/
# top history
tophist() {
cat ~/.zhistory |
cut -d ';' -f 2- 2>/dev/null |
awk '{a[$1]++ } END{for(i in a){print a[i] " " i}}' |
sort -rn |
head
}
# распаковать архив не указывая тип распаковщика
function ex {
if [ -z "$1" ]; then
echo "Использование: ex <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
else
if [ -f "$1" ]; then
NAME=${1%.*}
#mkdir $NAME && cd $NAME
case "$1" in
*.tar.bz2) tar xvjf ./"$1" ;;
*.tar.gz) tar xvzf ./"$1" ;;
*.tar.xz) tar xvJf ./"$1" ;;
*.lzma) unlzma ./"$1" ;;
*.bz2) bunzip2 ./"$1" ;;
*.rar) unrar x -ad ./"$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" ;;
*.xz) unxz ./"$1" ;;
*.exe) cabextract ./"$1" ;;
*) echo "ex: '$1' - Не может быть распакован" ;;
esac
else
echo "'$1' - не является допустимым файлом"
fi
fi
}
# Упаковка в архив командой pk 7z /что/мы/пакуем
function pk() {
if [ $1 ]; then
case $1 in
tbz) tar cjvf $2.tar.bz2 $2 ;;
tgz) tar czvf $2.tar.gz $2 ;;
txz) tar -caf $2.tar.xz $2 ;;
tar) tar cpvf $2.tar $2 ;;
bz2) bzip $2 ;;
gz) gzip -c -9 -n $2 >$2.gz ;;
zip) zip -r $2.zip $2 ;;
7z) 7z a $2.7z $2 ;;
*) echo "'$1' не может быть упакован с помощью pk()" ;;
esac
else
echo "'$1' не является допустимым файлом"
fi
}