diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-04-29 20:59:11 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-04-29 20:59:11 +0200 |
commit | 236f6bff4d262e96cd6e07b0ba46908a457860d6 (patch) | |
tree | 82f26add03abb644fa975b1a39a93d673fe1fc9e /config/essentials/shell/functions.sh | |
parent | 179582b4187f5cc9ab784d8ec20b42db4bf12281 (diff) | |
parent | cb06bb626545a35f56f55f2abe3942262f5ca824 (diff) |
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'config/essentials/shell/functions.sh')
-rw-r--r-- | config/essentials/shell/functions.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 17bf8c4..99d854e 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -68,7 +68,10 @@ sms() { ssh -t phone sendmsg "$1" "'$2'"; } trcp() { scp "$1" db:/media/basilisk/downloads/transmission/torrents/; } rln() { ln -s "$(readlink -f "$1")" "$2"; } getgit() { git clone git@db:"$1"; } + esc() { eval "$EDITOR '$(which $1)'"; } +compdef esc="which" + delfile() { curl -s "${2:-https://upfast.cronyakatsuki.xyz/delete/$1}"; } upfile() { curl -s -F "file=@\"$1\"" "${2:-https://0x0.st}"; } to_webm() { ffmpeg -y -i "$1" -vcodec libvpx -cpu-used -12 -deadline realtime "${1%.*}".webm; } @@ -300,3 +303,30 @@ gdown () { uuid=$(curl -sL "$1" -A "$agent" | sed -nE 's|.*(uuid=[^"]*)".*|\1|p') aria2c -x16 -s16 "$1&confirm=t&$uuid" -U "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36" --summary-interval=0 -d "${2:-.}" } + +# toggle wireguard vpn on $1 -> interface +wgtoggle() { + d="${1:-wg0}" + ip -br a | awk '{print $1}' | grep "$d" > /dev/null && + doas wg-quick down "$d" || + doas wg-quick up "$d" +} + +# serve a file through dufs +serve() { + if [ "$1" ] + then + logn "Serving $1" + docker container run \ + --rm \ + --volume "$(readlink -f "$1")":/data \ + --publish 80:5000 sigoden/dufs /data + else + + logn "Receiving files.." + docker container run \ + --rm \ + --volume /tmp/data:/data \ + --publish 80:5000 sigoden/dufs /data --allow-upload + fi +} |