diff options
Diffstat (limited to '.bash/aliases.bash')
| -rw-r--r-- | .bash/aliases.bash | 89 |
1 files changed, 84 insertions, 5 deletions
diff --git a/.bash/aliases.bash b/.bash/aliases.bash index b66218c..dd36794 100644 --- a/.bash/aliases.bash +++ b/.bash/aliases.bash @@ -6,20 +6,49 @@ if [ "$TERM" != "dumb" ];then eval "$(dircolors -b)" alias ls="ls --color=auto" - alias grep="grep --color=auto" - alias egrep="egrep --color=auto" + case "$OSNAME" in + 'sunos') ;; + *) + alias grep="grep --color=auto" + alias egrep="egrep --color=auto" + ;; + esac fi +# shellcheck disable=SC2139 +if [ -n "$EDITOR" ]; then + alias editor="$EDITOR" +elif [ -n "$VISUAL" ]; then + alias editor="$VISUAL" +elif [ -x "/usr/bin/vim" ]; then + alias editor="/usr/bin/vim" +elif [ -x "/usr/bin/vi" ]; then + alias editor="/usr/bin/vi" +else + alias editor="/usr/bin/edit" +fi +alias lst="ls -l --time-style=full-iso" alias cls=' echo -ne "\033c"' alias pip-update="sudo pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 sudo pip install -U" alias matrix='cmatrix -sbu6 -C cyan' +alias tbc='tbclock -e -H2 -M7 -S3' command -v colordiff >/dev/null 2>&1&&alias diff="colordiff" -command -v colormake >/dev/null 2>&1&&alias make="colormake" +#command -v colormake >/dev/null 2>&1&&alias make="colormake" alias perllint="perl -Mstrict -Mdiagnostics -cw" alias scredit='gimp "${SCRSHDIR}/$(ls -rt1 $SCRSHDIR/|tail -n1)"' alias scrview='pqiv -i "${SCRSHDIR}/$(ls -rt1 $SCRSHDIR/|tail -n1)"' +alias scrls='ls -l "${SCRSHDIR}/$(ls -rt1 $SCRSHDIR/|tail -n1)"' alias fuck='sudo $(history -p \!\!)' alias x509-out='openssl x509 -text -certopt no_version,no_pubkey,no_sigdump,no_aux,no_header -noout -in' -alias psgrep='ps -fp "$(pgrep -d, -x ssh-agent)"' +alias isocreate='rm -vf /tmp/image.iso && mkisofs -v -r -J -translation-table -hide-joliet-trans-tbl -iso-level 4 -o /tmp/image.iso' +#alias isoburn='sudo cdrecord -v -speed=10 dev=/dev/sr0 -data' +alias isoburn='sudo cdrecord -v dev=/dev/sr0 -data' +# voice messages e.g. for whatsapp (on libpurple). use "voicemsg OUTPUT.ogg" +alias voicemsg='ffmpeg -f pulse -i default -ac 1 -ar 16000 -c:a libopus -y' +if command -v colordiff > /dev/null;then alias diff="colordiff";fi +# aliases like this are relevant if you use multiple passwordstore stores, e.g. +# your common store is a department-wide one but you still need to store personal credentials +alias ppass='PASSWORD_STORE_DIR=~/.password-store pass' +alias ifs='printf "%q\\n" "$IFS "' # ----- CHOO CHOO ----- # if command -v sl >/dev/null;then alias sl='sl -e' @@ -60,20 +89,40 @@ alias startxmonad="sxs xmonad" alias saa="source ~/.ssh/sshenv;ssh-add >/dev/null 2>&1;ssh-add -l" alias sshr='ssh -o StrictHostKeyChecking=no' alias sshk='ssh -o PasswordAuthentication=yes -o PreferredAuthentications=keyboard-interactive,password -o PubkeyAuthentication=no' +alias sshg="ssh-with-gpg" function add-sshagent-init { for KEY in "${SSHKEYS[@]}";do - ssh-add "$KEY" + FFPRINT="$(ssh-keygen -Esha256 -lf "$KEY")" || return 1 + if ! ssh-add -l 2>/dev/null | grep "$FFPRINT" >/dev/null; then + ssh-add -q "$KEY" + fi done } +alias sshmaster='ssh -O' # ----- FS ----- # xstat() { for target in "${@}";do + # shellcheck disable=SC2012 inode=$(ls -di "${target}"|cut -d ' ' -f 1) fs=$(df "${target}"|tail -n 1|awk '{print $1}') crtime=$(sudo debugfs -R 'stat <'"${inode}"'>' "${fs}" 2>/dev/null | grep -oP 'crtime.*--\s*\K.*') printf "%s\t%s\n" "${crtime}" "${target}" done } +# ----- PACKAGE MANAGERS ----- # +if [ -x "/usr/bin/paru" ];then + alias pkgclean="paru --noconfirm -Sc" +elif [ -x "/usr/bin/pikaur" ];then + alias pkgclean="pikaur --noconfirm -Sc" +elif [ -x "/usr/bin/pacman" ];then + alias pkgclean="/usr/bin/sudo /usr/bin/pacman --noconfirm -Sc" +elif [ -x "/usr/bin/apt" ];then + alias pkgclean="/usr/bin/sudo /usr/bin/apt clean" +elif [ -x "/usr/bin/dnf" ];then + alias pkgclean="/usr/bin/sudo /usr/bin/dnf clean packages" +elif [ -x "/usr/bin/zypper" ];then + alias pkgclean="/usr/bin/sudo /usr/bin/zypper clean" +fi # ----- GRAFANA ----- # if command -v grafana-cli >/dev/null;then alias gfpi='sudo grafana-cli plugins install' @@ -132,6 +181,7 @@ alias certshow="certmgr -L -n" # ----- APPLICATION CONTROL ----- # alias browser-set='xdg-settings set default-web-browser' alias browser-get='xdg-settings get default-web-browser' +alias default-desktop-apps="editor ~/.config/mimeapps.list" # ----- CONTAINERS ----- # if command -v podman >/dev/null;then alias pcl="podman container list" @@ -157,3 +207,32 @@ if command -v podman >/dev/null;then alias pnd="podman network disconnect" alias ppd="podman pod stop" fi +# ----- PUPPET + RUBY ----- # +# ...yeah, I'm mostly doing ruby stuff for Puppet, erm I mean +# OpenVox (now that Perforce have turned the Puppet world to a burning heap of garbage) +alias bake="bundle exec rake" +# ----- OTHER STUFF ----- # +for cmmd in batcat bat; do + if command -v "$cmmd" > /dev/null; then + # shellcheck disable=SC2139 + alias cat="${cmmd} --tabs 4 --wrap never --paging never --style 'plain,rule'" + # shellcheck disable=SC2139 + alias less="${cmmd} --tabs 4 --wrap never --paging always --style 'plain,rule'" + alias plain-cat='/usr/bin/cat' + alias plc='/usr/bin/cat' + alias plain-less='/usr/bin/less' + alias pll='/usr/bin/less' + export MANPAGER="sh -c 'col -bx | ${cmmd} -l man -p'" + export MANROFFOPT="-c" + break + fi +done +if command -v 'thefuck' > /dev/null; then + alias wtf='thefuck $(fc -nl -1)' +fi +# Flake8. Nice linter, but... +# They kneeled to USER STUPIDITY when it comes to configuration. Wut? +# https://flake8.pycqa.org/en/latest/release-notes/4.0.0.html#backwards-incompatible-changes +# --> https://github.com/pycqa/flake8/pull/1404 +# Users were confused, so ~/.config/flake8 is not supported anymore. lelkek. +alias flake8='flake8 --config ${HOME}/.config/flake8' |
