-
Notifications
You must be signed in to change notification settings - Fork 0
/
.alias_zsh
289 lines (256 loc) · 7.26 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
#!/usr/bin/bash
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 iip="curl --max-time 10 -w '\n' http://ident.me"
alias docker="sudo docker"
# 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
}
# source-highlight dependencies
hcat () {
/usr/bin/src-hilite-lesspipe.sh "$1" | less -m -N
}
ccat () {
cat "$1" | xsel -b -i
}
# 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 /tmp
git clone https://aur.archlinux.org/"$1".git
cd $1
sudo pacman -Syyy
makepkg -si
cd ~
rm -rf /tmp/$1
}
alias dir="dir --color=auto"
alias vdir="vdir --color=auto"
alias grep="grep --color=always"
#alias grep="grep --color=auto"
alias fgrep="fgrep --color=auto"
alias egrep="egrep --color=auto"
alias ls="ls --color=auto"
alias la="ls -alFh --color=auto"
alias llp="stat -c '%A %a %n' {*,.*}"
alias ll="ls -a --color=auto"
alias l="ls -CF --color=auto"
alias .l="dirs -v"
alias lss="ls -sh | sort -h"
alias duh="du -d 1 -h | sort -h"
alias mk="mkdir"
mkj () {
mkdir -p "$1"
cd "$1"
}
alias /="cd /"
alias ~="cd ~"
alias ..="cd .."
alias ...="cd ../.."
alias q="exit"
alias й="exit"
alias gh="cd $HOME/Do/Github"
# git related aliases
gc () {
git clone "$1"
}
function gcj () {
git clone "$1"
cd "$2"
# $EDITOR .
}
alias gi="git init"
alias gs="git status"
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 gpm="git push origin master"
alias ghab="$BROWSER http://github.com/ctlos &"
# yarn global add github-search-repos-cli
alias gsc="github-search-repos -i"
alias rss="newsboat"
# 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}="mpv"
alias -s {png,jpg,tiff,bmp}="viewnior"
# alias -s {conf,txt}="nvim"
# alias {aurman,pikaur,trizen,yaourt}="yay"
alias tm="tmux attach || tmux new -s work"
alias tmd="tmux detach"
alias tmk="tmux kill-server"
alias fm="ranger"
alias sfm="sudo ranger"
alias th="thunar . &"
alias sth="sudo thunar &"
alias na="nautilus . &"
alias sna="sudo nautilus &"
alias h="htop"
alias pkglist="pacman -Qneq > pkglist.txt"
alias aurlist="pacman -Qmeq > aurlist.txt"
alias packey="sudo pacman-key --init && sudo pacman-key --populate && sudo pacman-key --refresh-keys && sudo pacman -Syy"
alias sp="sudo pacman -S"
alias spo="sudo pacman -S --overwrite='*'"
alias spU="sudo pacman -U"
alias spoU="sudo pacman -U --overwrite='*'"
alias sps="sudo pacman -Ss"
alias spc="sudo pacman -Sc"
alias spcc="sudo pacman -Scc"
alias spy="sudo pacman -Syy"
alias spu="sudo pacman -Syu"
alias spr="sudo pacman -R"
alias pres="sudo pacman -S $(pacman -Qqn)"
alias y="yay -S"
alias yn="yay -S --noconfirm"
alias yl="yay -S --noconfirm --needed - < ~/.pkglist.txt"
# alias yal="yay -S --noconfirm --needed $(cat ~/.aurlist.txt)"
alias ys="yay"
alias ysn="yay --noconfirm"
alias yc="yay -Sc"
alias ycc="yay -Scc"
alias yy="yay -Syy"
alias yu="yay -Syu"
alias yun="yay -Syu --noconfirm"
alias yr="yay -R"
alias yrs="yay -Rs"
alias yrsn="yay -Rsn"
alias yrsnp="yay -Rsn $(pacman -Qdtq)"
alias yrn="yay -R --noconfirm"
alias yskip="yay --mflags '--nocheck --skippgpcheck --noconfirm'"
alias ynskip="yay --mflags --skipinteg --noconfirm"
# pacman -Qqo /usr/lib/python3.8/
# systemd
alias sse="sudo systemctl enable"
alias ssd="sudo systemctl disable"
alias ssen="sudo systemctl enable --now"
alias ssdn="sudo systemctl disable --now"
alias ssr="sudo systemctl restart"
alias ssk="sudo systemctl stop"
alias sss="sudo systemctl status"
# Python
alias ve="virtualenv ve"
alias vea="source ve/bin/activate"
alias ved="deactivate"
alias pipr="pip install -r requirements.txt"
# extract files from acrhive with any extension
function extract {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: 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' - Can't be extracted" ;;
esac
else
echo "'$1' - invalid file"
fi
fi
}
# Put a file in archive.7z with pk command
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' Can't be archived by pk()" ;;
esac
else
echo "'$1' invalid file"
fi
}
# find biggest file
alias biggest='sudo du -a / 2>/dev/null | sort -n -r | head -n 20'
# clean metadata from file
alias meta='mat2 --inplace'
alias vi='vim'
alias py='python3'
alias inst='sudo pacman -S'
alias venv='python3 -m venv env; source env/bin/activate'
alias anki='anki --no-sandbox'
alias wget=wget --hsts-file="$XDG_DATA_HOME/wget-hsts"
alias clip='xclip -sel clip'
alias yt-radio='youtube-dl -f bestaudio $1 -o - | ffplay -nodisp -autoexit -i - &>/dev/null'
# pomodoro timer almost from scratch
# https://github.com/antonmedv/countdown
study() {
$HOME/Do/Github/countdown/bin/countdown "$1"
ffplay -nodisp "$HOME/Music/Ólafur Arnalds - Woven Song.mp3"
}
# up and down wireguard connections
wire() {
echo "Usage: choose mode - up OR down; choose location - frankfurt\n"
/usr/bin/wg-quick "$1" "$2"
}
alias dockershell="sudo docker run --rm -i -t --entrypoint=/bin/bash"
alias config='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'