aliases.zsh (11143B)
1 # ██ 2 # ░██ 3 # ██████ ██████░██ 4 # ░░░░██ ██░░░░ ░██████ 5 # ██ ░░█████ ░██░░░██ 6 # ██ ░░░░░██░██ ░██ 7 # ██████ ██████ ░██ ░██ 8 # ░░░░░░ ░░░░░░ ░░ ░░ 9 # s h e l l a l i a s e s 10 # 11 # author ▓▒ pyratebeard 12 # code ▓▒ https://git.pyratebeard.net/dotfiles/file/zsh/.zsh/aliases.zsh.html 13 14 alias sudo='sudo ' # hack to allow aliases with sudo 15 16 # ▓▓▒░ sys 17 alias \ 18 ll="ls -lahF --color=auto" \ 19 ls="ls -hF --color=auto" \ 20 lsl="ls -lhF --color=auto" \ 21 \ 22 cp="cp -r" \ 23 rmrf="rm -rf" \ 24 scp="scp -r" \ 25 \ 26 up="cd ../" \ 27 mkdir="mkdir -p" \ 28 \ 29 xsel="xsel -b" \ 30 fuck='sudo $(fc -ln -1)' \ 31 dd="dd status=progress" \ 32 \ 33 term="urxvtc -hold -e " \ 34 \ 35 reboot="sudo reboot" \ 36 systemctl="sudo systemctl" 37 38 39 # ▓▓▒░ info 40 alias \ 41 psef="ps -ef" \ 42 jobs="jobs -l" \ 43 \?is="whereis" \ 44 disks='echo "┌──┄";echo "├┄ m o u n t . p o i n t s"; echo "└──┄┄────┄┄"; lsblk -a; echo ""; echo "┌──┄";echo "├┄ d i s k . u s a g e"; echo "└──┄┄────┄┄"; sudo df -h -x tmpfs -x devtmpfs;' \ 45 ag="ag --color --color-line-number '0;35' --color-match '46;30' --color-path '4;36'" \ 46 tree='tree -CAFa -I "CVS|*.*.package|.svn|.git|.hg|node_modules|bower_components" --dirsfirst' 47 48 49 # ▓▓▒░ almighty text editor 50 alias \ 51 v="vim" \ 52 vi="vim" \ 53 emacs="vim" 54 55 56 # ▓▓▒░ git 57 alias \ 58 g="git" \ 59 ga="git add" \ 60 gb="git branch" \ 61 gc="git commit -S -m" \ 62 gs="git status -sb" \ 63 gd="git diff" \ 64 gf="git fetch" \ 65 gm="git merge" \ 66 gr="git rebase" \ 67 gp="git push" \ 68 gu="git unstage" \ 69 gg="git log --graph" \ 70 gco="git checkout" \ 71 gsm="git status -sbuno" \ 72 gpr="git request-pull" \ 73 ggg="git graphgpg" 74 75 gcl() { 76 git clone "$1" 77 cd ${1##*/} 78 } 79 80 81 # ▓▓▒░ pacman 82 alias \ 83 pac="sudo pacman" \ 84 pacman="sudo pacman" \ 85 update="sudo paccache -r ; pacman -S --noconfirm archlinux-keyring ; pacman -Syu" 86 87 88 # ▓▓▒░ net 89 alias \ 90 ss="sudo ss" \ 91 netctl="sudo netctl" \ 92 iip="ip a s $(ip r | grep default | grep -oP '(?<=dev )[^ ]*')" \ 93 failover="sudo ip link set enp5s0 down" \ 94 failback="sudo ip link set enp5s0 up" 95 96 97 # ▓▓▒░ devops 98 alias \ 99 ap="ansible-playbook" \ 100 \ 101 lxc-ls="lxc-ls -f" \ 102 lxls="lxc-ls -f" \ 103 lxst="lxc-start" \ 104 lxsp="lxc-stop" \ 105 lxat="lxc-attach" \ 106 \ 107 docker="sudo docker" \ 108 docker-compose="sudo docker-compose" \ 109 \ 110 tf="terraform" \ 111 tfi="terraform init" \ 112 tfa="terraform apply --auto-approve" \ 113 tfp="terraform plan" \ 114 tfd="terraform destroy" \ 115 \ 116 kc="KUBECONFIG=./kubeconfig.yml kubectl" 117 118 119 # ▓▓▒░ recording 120 121 alias \ 122 record="ffmpeg -f x11grab -s 1366x768 -an -r 16 -loglevel quiet -i :0.0 -b:v 5M -y" 123 124 # record the primary screen 125 screencast() { 126 test $1 && NAME=$1 || NAME="screencast" 127 RESOLUTION=$(xrandr | grep "*" | awk '{print $1}' | head -n1) 128 echo "recording to ${HOME}/lib/videos/recordings/screencasts/$(date +%Y%m%d)-${NAME}.webm" 129 ffmpeg -f x11grab -s ${RESOLUTION} -an -r 16 -loglevel quiet -i :0.0 -b:v 5M -y ${HOME}/lib/videos/recordings/screencasts/$(date +%Y%m%d)-${NAME}.webm 130 } 131 132 # take picture with webcam 133 webcapture() { 134 NUM=$(ls -l $HOME/tmp/*webcapture*|wc -l) 135 NUM=$(( NUM + 1 )) 136 ffmpeg -f video4linux2 -s 640x480 -i /dev/video0 -ss 0:0:2 -frames 1 $HOME/tmp/$(date +%Y%m%d)-webcapture-${NUM}.png 137 } 138 139 140 # ▓▓▒░ suffix 141 alias -s \ 142 md=vim \ 143 {png,jpg,jpeg}=sxiv \ 144 pdf=zathura \ 145 mp4=mpv 146 147 148 # ▓▓▒░ misc 149 alias \ 150 mixer="alsamixer" \ 151 news="newsboat" \ 152 gifview="gifview -a" \ 153 mail="mutt -F ~/.mutt/muttrc-imap" \ 154 \ 155 headsetbatt="bluetooth_battery 34:DF:2A:5F:04:2C" \ 156 headset="echo 'connect 34:DF:2A:5F:04:2C' | bluetoothctl" \ 157 bton="echo 'power on' | bluetoothctl" \ 158 btoff="echo 'power off' | bluetoothctl" \ 159 \ 160 nodisturb="dunstctl set-paused true" \ 161 disturb="dunstctl set-paused false" \ 162 \ 163 sacc="PAGER=less sacc" \ 164 gopher="PAGER=less sacc g.nixers.net/1/~pyratebeard/startpage.gph" \ 165 buku="buku --np" \ 166 tin="NNTPSERVER=eu.newsdemon.com ~/src/warez/tin/tin-latest/src/tin -r -A"\ 167 drawterm="drawterm -h 9p.sdf.org -a 9p.sdf.org -u pyratebeard" \ 168 \ 169 kb="keybase" \ 170 irc="mosh irclient -- ksh -c 'dtach -A /tmp/irc irssi'" \ 171 tor="cd ~/src/warez/tor/ ; ./start-tor-browser.desktop" \ 172 feh="feh -g 640x480" \ 173 rum.sh="nc rum.sh 9999" \ 174 moebius="cd $HOME/src/warez/moebius ; /usr/bin/npm start" \ 175 cointop="$HOME/src/go/bin/cointop --hide-statusbar" 176 177 178 # ▓▓▒░ fun(ctions) 179 180 email() { 181 echo $3 | mutt -s $2 $1 182 } 183 184 # connect to tmux on ssh 185 # host autocomplete - $HOME/.zsh/completion/_ssux 186 ssux() { 187 TERM=screen ssh -t "$@" 'tmux attach || tmux new' || ssh "$@" 188 } 189 190 # sets terminal title 191 # useful for unhide (~/.interrobangrc:39) 192 title() { 193 printf "\033]2;${1}\007" 194 } 195 196 # read markdown files like manpages 197 md() { 198 pandoc -s -f markdown -t man "$*" | man -l - 199 } 200 201 # read webpage as manpage 202 webman() { 203 curl -L "$@" | pandoc -s -f html -t man | man -l - 204 } 205 206 # read anything as manpage 207 nam() { 208 pandoc -s -t man "$*" | man -l - 209 } 210 211 :q() { 212 [[ -v SSH_TTY ]] && echo dumpshock || sudo systemctl poweroff 213 }