dotfiles

custom dotfiles
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

aliases.zsh (10830B)


      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     gpr="git request-pull"                                                    \
     72     ggg="git graphgpg"
     73 
     74     gcl() {
     75         git clone "$1"
     76         cd ${1##*/}
     77     }
     78 
     79 
     80 # ▓▓▒░ pacman
     81                                                                         alias \
     82     pac="sudo pacman"                                                         \
     83     pacman="sudo pacman"                                                      \
     84     update="sudo paccache -r ; pacman -Syu"
     85 
     86 
     87 # ▓▓▒░ net
     88                                                                         alias \
     89     ss="sudo ss"                                                              \
     90     netctl="sudo netctl"                                                      \
     91     iip="ip a s $(ip r | grep default | grep -oP '(?<=dev )[^ ]*')"           \
     92     failover="sudo ip link set enp5s0 down"                                   \
     93     failback="sudo ip link set enp5s0 up"
     94 
     95 
     96 # ▓▓▒░ devops
     97                                                                         alias \
     98     ap="ansible-playbook"                                                     \
     99                                                                               \
    100     lxc-ls="lxc-ls -f"                                                        \
    101     lxls="lxc-ls -f"                                                          \
    102     lxst="lxc-start"                                                          \
    103     lxsp="lxc-stop"                                                           \
    104     lxat="lxc-attach"                                                         \
    105                                                                               \
    106     docker="sudo docker"                                                      \
    107     docker-compose="sudo docker-compose"                                      \
    108                                                                               \
    109     tf="terraform"                                                            \
    110     tfi="terraform init"                                                      \
    111     tfa="terraform apply --auto-approve"                                      \
    112     tfp="terraform plan"                                                      \
    113     tfd="terraform destroy"                                                   \
    114                                                                               \
    115     kc="KUBECONFIG=./kubeconfig.yml kubectl"
    116 
    117 
    118 # ▓▓▒░ recording
    119 
    120                                                                         alias \
    121     record="ffmpeg -f x11grab -s 1366x768 -an -r 16 -loglevel quiet -i :0.0 -b:v 5M -y"
    122 
    123     # record the primary screen
    124     screencast() {
    125         RESOLUTION=$(xrandr | grep "*" | awk '{print $1}' | head -n1)
    126         echo "recording..."
    127         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
    128     }
    129 
    130     # take picture with webcam
    131     webcapture() {
    132         NUM=$(ls -l $HOME/tmp/*webcapture*|wc -l)
    133         NUM=$(( NUM + 1 ))
    134         ffmpeg -f video4linux2 -s 640x480 -i /dev/video0 -ss 0:0:2 -frames 1 $HOME/tmp/$(date +%Y%m%d)-webcapture-${NUM}.png
    135     }
    136 
    137 
    138 # ▓▓▒░ suffix
    139                                                                      alias -s \
    140     md=vim                                                                    \
    141     {png,jpg,jpeg}=sxiv                                                       \
    142     pdf=zathura                                                               \
    143     mp4=mpv
    144 
    145 
    146 # ▓▓▒░ misc
    147                                                                         alias \
    148     mixer="alsamixer"                                                         \
    149     news="newsboat"                                                           \
    150     gifview="gifview -a"                                                      \
    151                                                                               \
    152     headsetbatt="bluetooth_battery 34:DF:2A:5F:04:2C"                         \
    153     headset="echo 'connect 34:DF:2A:5F:04:2C' | bluetoothctl"                 \
    154     bton="echo 'power on' | bluetoothctl"                                     \
    155     btoff="echo 'power off' | bluetoothctl"                                   \
    156                                                                               \
    157     nodisturb="dunstctl set-paused true"                                      \
    158     disturb="dunstctl set-paused false"                                       \
    159                                                                               \
    160     sacc="PAGER=less sacc"                                                    \
    161     gopher="PAGER=less sacc g.nixers.net/1/~pyratebeard/startpage.gph"        \
    162     buku="buku --np"                                                          \
    163     tin="NNTPSERVER=eu.newsdemon.com ~/src/warez/tin/tin-latest/src/tin -r -A"\
    164     drawterm="drawterm -h 9p.sdf.org -a 9p.sdf.org -u pyratebeard"            \
    165                                                                               \
    166     kb="keybase"                                                              \
    167     irc="TERM=screen-256color dtach -A /tmp/irc irssi"                        \
    168     tor="cd ~/src/warez/tor/ ; ./start-tor-browser.desktop"                   \
    169     feh="feh -g 640x480"                                                      \
    170     rum.sh="nc rum.sh 9999"                                                   \
    171     moebius="cd $HOME/src/warez/moebius ; /usr/bin/npm start"                 \
    172     cointop="$HOME/src/go/bin/cointop --hide-statusbar"
    173 
    174 
    175 # ▓▓▒░ fun(ctions)
    176 
    177     email() {
    178       echo $3 | mutt -s $2 $1
    179     }
    180 
    181     # connect to tmux on ssh
    182     # host autocomplete - $HOME/.zsh/completion/_ssux
    183     ssux() {
    184         TERM=screen ssh -t "$@" 'tmux attach || tmux new' || ssh "$@"
    185     }
    186 
    187     # sets terminal title
    188     # useful for unhide (~/.interrobangrc:39)
    189     title() {
    190         printf "\033]2;${1}\007"
    191     }
    192 
    193     # read markdown files like manpages
    194     md() {
    195         pandoc -s -f markdown -t man "$*" | man -l -
    196     }
    197 
    198     # read webpage as manpage
    199     webman() {
    200         curl -L "$@" | pandoc -s -f html -t man | man -l -
    201     }
    202 
    203     # read anything as manpage
    204     nam() {
    205         pandoc -s -t man "$*" | man -l -
    206     }
    207 
    208     :q() {
    209         [[ -v SSH_TTY ]] && echo dumpshock || sudo systemctl poweroff
    210     }