dotfiles

*nix config files
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

commit 2ac76f5d1fc45feef0ad6e6538cb42d07bf8c338
parent 20966dc4ec034153a9c820319902d681aa802a50
Author: pyratebeard <root@pyratebeard.net>
Date:   Tue, 18 Jan 2022 17:10:41 +0000

add new aliases and stylise :sunglasses: ▓▓▒░

Diffstat:
Mzsh/.zsh/aliases.zsh | 346+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
1 file changed, 206 insertions(+), 140 deletions(-)

diff --git a/zsh/.zsh/aliases.zsh b/zsh/.zsh/aliases.zsh @@ -1,140 +1,206 @@ -# ALIASES -alias ll="ls -lahF --color=auto" -alias ls="ls -hF --color=auto" -alias lsl="ls -lhF --color=auto" -alias "cd.."="cd ../" -alias up="cd ../" -alias rmrf="rm -rf" -alias psef="ps -ef" -alias mkdir="mkdir -p" -alias cp="cp -r" -alias scp="scp -r" -alias mkdir="mkdir -p" -alias xsel="xsel -b" -alias fuck='sudo $(fc -ln -1)' -alias v="vim" -alias vi="vim" -alias emacs="vim" -alias g="git" -alias ga="git add" -alias gb="git branch | grep \*" -alias gc="git commit -S -m" -alias gs="git status" -alias gd="git diff" -alias gf="git fetch" -alias gm="git merge" -alias gr="git rebase" -alias gp="git push" -alias gu="git unstage" -alias gg="git log --graph" -alias gco="git checkout" -alias gpr="git request-pull" -alias ag="ag --color --color-line-number '0;35' --color-match '46;30' --color-path '4;36'" -alias tree='tree -CAFa -I "CVS|*.*.package|.svn|.git|.hg|node_modules|bower_components" --dirsfirst' -alias rock="mpd .mpd/mpd.conf ; ncmpcpp" -alias mixer="alsamixer" -alias term="urxvtc -hold -e " #used for run menu -alias pacman="sudo pacman" -alias update="pacman -Syu" -alias systemctl="sudo systemctl" -alias :q="sudo systemctl poweroff" -#alias disks='echo "╓───── m o u n t . p o i n t s"; echo "╙────────────────────────────────────── ─ ─ "; lsblk -a; echo ""; echo "╓───── d i s k . u s a g e"; echo "╙────────────────────────────────────── ─ ─ "; sudo df -h -x tmpfs -x devtmpfs;' -alias 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;' -alias record="ffmpeg -f x11grab -s 1366x768 -an -r 16 -loglevel quiet -i :0.0 -b:v 5M -y" #pass a filename -alias gifview="gifview -a" -alias reboot="sudo reboot" -alias vh="nc vhbin.net 9999" -alias kb="keybase" -alias dd="dd status=progress" -alias docker="sudo docker" -alias docker-compose="sudo docker-compose" -alias ncmpcpp="ncmpcpp -q" -alias song="ncmpcpp --current-song='$7%a - $8{%n} {%t} $R [{%l}] ' | cut -d '%' -f 1" -alias jobs="jobs -l" -alias dnf="sudo dnf" -alias irc="TERM=screen-256color dtach -A /tmp/irc irssi" -alias ap="ansible-playbook" -alias tf="terraform" -alias tfi="terraform init" -alias tfa="terraform apply --auto-approve" -alias tfp="terraform plan" -alias tfd="terraform destroy" -alias tor="cd ~/src/warez/tor/ ; ./start-tor-browser.desktop" -alias failover="sudo ip link set enp5s0 down" -alias failback="sudo ip link set enp5s0 up" -alias netctl="sudo netctl" -alias feh="feh -g 640x480" -alias rum.sh="nc rum.sh 9999" -alias headsetbatt="bluetooth_battery 34:DF:2A:5F:04:2C" -alias headset="echo 'connect 34:DF:2A:5F:04:2C' | bluetoothctl" -alias bton="echo 'power on' | bluetoothctl" -alias btoff="echo 'power off' | bluetoothctl" -alias moebius="cd $HOME/src/warez/moebius ; /usr/bin/npm start" -alias cointop="$HOME/src/go/bin/cointop --hide-statusbar" -alias nodisturb="dunstctl set-paused true" -alias disturb="dunstctl set-paused false" -alias sacc="PAGER=less sacc" -alias buku="buku --np" -alias tin="NNTPSERVER=eu.newsdemon.com ~/src/warez/tin/tin-latest/src/tin -r -A" - -alias -s md=vim -alias -s {png,jpg,jpeg}=sxiv -alias -s pdf=zathura -alias -s mp4=mpv - -email() { - echo $3 | mutt -s $2 $1 -} - -# colorised cat -c() { - for file in "$@" - do - pygmentize -O style=sourcerer -f console256 -g "$file" - done -} - -# colorised less -#l() { -# pygmentize -O style=sourcerer -f console256 -g $1 | less -r -#} - -# read markdown files like manpages -md() { - pandoc -s -f markdown -t man "$*" | man -l - -} - -# read webpage as manpage -webman() { - curl -L "$@" | pandoc -s -f html -t man | man -l - -} - -# read anything as manpage -nam() { - pandoc -s -t man "$*" | man -l - -} - -# connect to tmux on ssh -ssux() { - TERM=screen ssh -t "$@" 'tmux attach || tmux new' || ssh "$@" -} - -# record the primary screen -screencast() { - RESOLUTION=$(xrandr | grep "*" | awk '{print $1}' | head -n1) - echo "recording..." - 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)-${1}.webm -} - -# take picture with webcam -webcapture() { - NUM=$(ls -l $HOME/tmp/*webcapture*|wc -l) - NUM=$(( NUM + 1 )) - ffmpeg -f video4linux2 -s 640x480 -i /dev/video0 -ss 0:0:2 -frames 1 $HOME/tmp/$(date +%Y%m%d)-webcapture-${NUM}.png -} - -# sets terminal title -# useful for unhide -title() { - printf "\033]2;${1}\007" -} +# ██ +# ░██ +# ██████ ██████░██ +# ░░░░██ ██░░░░ ░██████ +# ██ ░░█████ ░██░░░██ +# ██ ░░░░░██░██ ░██ +# ██████ ██████ ░██ ░██ +# ░░░░░░ ░░░░░░ ░░ ░░ +# s h e l l a l i a s e s +# +# author ▓▒ pyratebeard +# code ▓▒ https://git.pyratebeard.net/dotfiles/file/zsh/.zsh/aliases.zsh.html + + alias sudo='sudo ' # hack to allow aliases with sudo + +# ▓▓▒░ sys + alias \ + ll="ls -lahF --color=auto" \ + ls="ls -hF --color=auto" \ + lsl="ls -lhF --color=auto" \ + \ + cp="cp -r" \ + rmrf="rm -rf" \ + scp="scp -r" \ + \ + up="cd ../" \ + mkdir="mkdir -p" \ + \ + xsel="xsel -b" \ + fuck='sudo $(fc -ln -1)' \ + dd="dd status=progress" \ + \ + term="urxvtc -hold -e " \ + \ + reboot="sudo reboot" \ + systemctl="sudo systemctl" \ + :q="sudo systemctl poweroff" + + +# ▓▓▒░ info + alias \ + psef="ps -ef" \ + jobs="jobs -l" \ + \?is="whereis" \ + 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;' \ + ag="ag --color --color-line-number '0;35' --color-match '46;30' --color-path '4;36'" \ + tree='tree -CAFa -I "CVS|*.*.package|.svn|.git|.hg|node_modules|bower_components" --dirsfirst' + + +# ▓▓▒░ almighty text editor + alias \ + v="vim" \ + vi="vim" \ + emacs="vim" + + +# ▓▓▒░ git + alias \ + g="git" \ + ga="git add" \ + gb="git branch" \ + gc="git commit -S -m" \ + gs="git status -sb" \ + gd="git diff" \ + gf="git fetch" \ + gm="git merge" \ + gr="git rebase" \ + gp="git push" \ + gu="git unstage" \ + gg="git log --graph" \ + gco="git checkout" \ + gpr="git request-pull" \ + ggg="git graphgpg" + + gcl() { + git clone "$1" + cd ${1##*/} + } + + +# ▓▓▒░ pacman + alias \ + pac="sudo pacman" \ + pacman="sudo pacman" \ + update="sudo paccache -r ; pacman -Syu" + + +# ▓▓▒░ net + alias \ + ss="sudo ss" \ + netctl="sudo netctl" \ + iip="ip a s $(ip r | grep default | grep -oP '(?<=dev )[^ ]*')" \ + failover="sudo ip link set enp5s0 down" \ + failback="sudo ip link set enp5s0 up" + + +# ▓▓▒░ devops + alias \ + ap="ansible-playbook" \ + \ + lxc-ls="lxc-ls -f" \ + lxls="lxc-ls -f" \ + lxst="lxc-start" \ + lxsp="lxc-stop" \ + lxat="lxc-attach" \ + \ + docker="sudo docker" \ + docker-compose="sudo docker-compose" \ + \ + tf="terraform" \ + tfi="terraform init" \ + tfa="terraform apply --auto-approve" \ + tfp="terraform plan" \ + tfd="terraform destroy" \ + \ + kc="KUBECONFIG=./kubeconfig.yml kubectl" + + +# ▓▓▒░ recording + + alias \ + record="ffmpeg -f x11grab -s 1366x768 -an -r 16 -loglevel quiet -i :0.0 -b:v 5M -y" + + # record the primary screen + screencast() { + RESOLUTION=$(xrandr | grep "*" | awk '{print $1}' | head -n1) + echo "recording..." + 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)-${1}.webm + } + + # take picture with webcam + webcapture() { + NUM=$(ls -l $HOME/tmp/*webcapture*|wc -l) + NUM=$(( NUM + 1 )) + ffmpeg -f video4linux2 -s 640x480 -i /dev/video0 -ss 0:0:2 -frames 1 $HOME/tmp/$(date +%Y%m%d)-webcapture-${NUM}.png + } + + +# ▓▓▒░ suffix + alias -s \ + md=vim \ + {png,jpg,jpeg}=sxiv \ + pdf=zathura \ + mp4=mpv + + +# ▓▓▒░ misc + alias \ + mixer="alsamixer" \ + news="newsboat" \ + gifview="gifview -a" \ + \ + headsetbatt="bluetooth_battery 34:DF:2A:5F:04:2C" \ + headset="echo 'connect 34:DF:2A:5F:04:2C' | bluetoothctl" \ + bton="echo 'power on' | bluetoothctl" \ + btoff="echo 'power off' | bluetoothctl" \ + \ + nodisturb="dunstctl set-paused true" \ + disturb="dunstctl set-paused false" \ + \ + sacc="PAGER=less sacc" \ + gopher="PAGER=less sacc g.nixers.net/1/~pyratebeard/startpage.gph" \ + buku="buku --np" \ + tin="NNTPSERVER=eu.newsdemon.com ~/src/warez/tin/tin-latest/src/tin -r -A"\ + \ + kb="keybase" \ + irc="TERM=screen-256color dtach -A /tmp/irc irssi" \ + tor="cd ~/src/warez/tor/ ; ./start-tor-browser.desktop" \ + feh="feh -g 640x480" \ + rum.sh="nc rum.sh 9999" \ + moebius="cd $HOME/src/warez/moebius ; /usr/bin/npm start" \ + cointop="$HOME/src/go/bin/cointop --hide-statusbar" + + +# ▓▓▒░ fun(ctions) + + email() { + echo $3 | mutt -s $2 $1 + } + + # connect to tmux on ssh + # host autocomplete - $HOME/.zsh/completion/_ssux + ssux() { + TERM=screen ssh -t "$@" 'tmux attach || tmux new' || ssh "$@" + } + + # sets terminal title + # useful for unhide (~/.interrobangrc:39) + title() { + printf "\033]2;${1}\007" + } + + # read markdown files like manpages + md() { + pandoc -s -f markdown -t man "$*" | man -l - + } + + # read webpage as manpage + webman() { + curl -L "$@" | pandoc -s -f html -t man | man -l - + } + + # read anything as manpage + nam() { + pandoc -s -t man "$*" | man -l - + }