From f39d735e2ba625a31a7dbf6fb8bdd62501379ad1 Mon Sep 17 00:00:00 2001 From: zachir Date: Wed, 5 Oct 2022 22:00:32 -0500 Subject: Initial Commit --- sh/functions | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sh/functions (limited to 'sh/functions') diff --git a/sh/functions b/sh/functions new file mode 100644 index 0000000..69b26c3 --- /dev/null +++ b/sh/functions @@ -0,0 +1,130 @@ +#!/bin/sh +catclip () { + cat $@ | xclip -selection clipboard +} + +catpass () { + PASSWD=$(cat ~/pass.txt); echo "$PASSWD\n$PASSWD" | pass insert "$1"; unset PASSWD +} + +mpt () { + for i in $@; do + echo "" > $i + done +} + +mkcd () { + mkdir $@ && cd $1 +} + +ntharg () { + shift $1 + printf '%s\n' "$1" +} + +mvcd () { + mv $@ && cd `ntharg $# "$@"` +} + +scd () { + if [ "$1" = "" ]; then + cd $HOME + else + case "$1" in + "-l") echo " +aw - ~/.config/awesome +al - ~/.config/alacritty +b - ~/.local/bin +c - ~/.config +db - ~/.local/src/dwmblocks +dc - ~/Documents +do - ~/Downloads +dw - ~/.local/src/dwm +e - ~/Desktop +E - /etc +f - ~/.var/app +h - ~/.config/herbstluftwm +lb - ~/.local/bin +lc - ~/Games/cache +lf - ~/.config/lf +ls - ~/.local/share +nv - ~/.config/nvim +ns - ~/.natvst +p - ~/Pictures +qc - ~/.config/qutebrowser +qp - ~/.local/share/qutebrowser-profiles +qt - ~/.config/qtile +re - ~/.local/src +ri - ~/.config/river +rs - /etc/runit/sv +sc - ~/.local/bin/scripts +sh - ~/.config/sh +sl - ~/.local/src/slock +ss - /etc/s6/sv +st - ~/.local/src/st +sx - ~/.config/sxhkd +Va - /var +v3 - ~/.vst3 +va - ~/.var +vs - ~/.vst +vv - ~/.local/volsv +wa - ~/.local/src/wallpapers +wd - ~/.local/share/wineprefixes/default +wh - ~/.local/share/wineprefixes/[CURRENT] +wr - ~/.local/share/wineprefixes +ww - ~/.local/share/wineprefixes/work +x - ~/.config/X11 +yb - ~/.cache/yay +yc - ~/.config/yay +zs - ~/.config/zsh +zx - ~/Documents/zachir.xyz +";; + "aw") cd $XDG_CONFIG_HOME/awesome/ ;; + "al") cd $XDG_CONFIG_HOME/alacritty/ ;; + "b") cd "$HOME"/.local/bin/ ;; + "c") cd $XDG_CONFIG_HOME/ ;; + "dc") cd $HOME/Documents/ ;; + "do") cd $HOME/Downloads/ ;; + "dw") cd $HOME/.local/src/dwm/ ;; + "db") cd $HOME/.local/src/dwmbar/ ;; + "e") cd $HOME/Desktop ;; + "E") cd /etc ;; + "f") cd $HOME/.var/app ;; + "h") cd "$XDG_CONFIG_HOME"/herbstluftwm ;; + "lb") cd $HOME/.local/bin ;; + "lc") cd $HOME/Games/cache ;; + "ls") cd $XDG_DATA_HOME ;; + "lf") cd $XDG_CONFIG_HOME/lf ;; + "nv") cd $XDG_CONFIG_HOME/nvim ;; + "ns") cd $HOME/.natvst ;; + "p") cd $HOME/Pictures ;; + "qc") cd $XDG_CONFIG_HOME/qutebrowser/ ;; + "qp") cd $XDG_DATA_HOME/qutebrowser-profiles/ ;; + "qt") cd $XDG_CONFIG_HOME/qtile/ ;; + "re") cd $HOME/.local/src/ ;; + "ri") cd $XDG_CONFIG_HOME/river ;; + "rs") cd /etc/runit/sv ;; + "sc") cd $HOME/.local/bin/scripts/ ;; + "sh") cd $XDG_CONFIG_HOME/sh/ ;; + "sl") cd $HOME/.local/src/slock/ ;; + "ss") cd /etc/s6/sv ;; + "st") cd $HOME/.local/src/st/ ;; + "sx") cd $XDG_CONFIG_HOME/sxhkd/ ;; + "v3") cd $HOME/.vst3 ;; + "vi") cd $HOME/Videos ;; + "vs") cd $HOME/.vst/ ;; + "vv") cd $HOME/.local/volsv/ ;; + "wa") cd $HOME/.local/src/wallpapers ;; + "wd") cd $WINEROOT/default ;; + "wh") cd $WINEPREFIX ;; + "wr") cd $WINEROOT ;; + "ww") cd $WINEROOT/work ;; + "x") cd $XDG_CONFIG_HOME/X11 ;; + "yb") cd $XDG_CACHE_HOME/yay ;; + "yc") cd $XDG_CONFIG_HOME/yay ;; + "zs") cd $ZDOTDIR/ ;; + "zx") cd $HOME/Documents/zachir.xyz/ ;; + *) echo "\"$1\" is not a known location" ;; + esac + fi +} -- cgit v1.2.3