1
0
dotfiles/noire-carnation/functions

86 lines
1.7 KiB
Plaintext
Raw Normal View History

2023-11-19 14:48:04 -07:00
#!/bin/sh
bmv() {
2023-12-18 12:47:55 -07:00
set -x
2023-11-19 14:48:04 -07:00
if test -z "$1"; then
2023-12-18 12:47:55 -07:00
printf "Usage: %s pattern pattern1 [pattern2]\n" "$0" 1>&2
2023-11-19 14:48:04 -07:00
return 64 # sysexits.h(3) EX_USAGE
fi
2023-12-18 12:47:55 -07:00
for file in $1; do
newfile="$(printf '%s\n' "$file" | sed "s;$2;$3;g")"
2023-11-19 14:48:04 -07:00
2023-12-18 12:47:55 -07:00
if [ "$file" != "$newfile" ]
then
mv "$file" "$newfile"
fi
2023-11-19 14:48:04 -07:00
done
2023-12-18 12:47:55 -07:00
set +x
2023-11-19 14:48:04 -07:00
}
ix() {
curl -F 'f:1=<-' ix.io
}
myip() {
curl icanhazip.com
}
2023-12-18 12:47:55 -07:00
honse() {
if test -z "$2"; then
printf "Usage: %s season episode\n" "$0"
return 64 # syexits.h(3) EX_USAGE
else
mpv "https://ypdl.gdn/files/YP-1S-$1x$2.mkv"
fi
}
#TODO: Really needs fixed
2023-11-19 14:48:04 -07:00
paclean() {
for package in `pacman -Qtq`; do
pacman -Qi "$package"
printf "Uninstall? [y/N] "
read resp
# TODO: Add undo
if [ "$resp" != "y" ] && [ "$resp" != "Y" ]; then
printf "Skipped %s.\n\n" "$package" 1>&2
else
printf "Queued %s for uninstall.\n\n" "$package" 1>&2
packages="$packages$package "
fi
done
su -c "pacman -Rns $packages"
}
sc() {
if test -z "$1"; then
2023-12-18 12:47:55 -07:00
printf "Usage: %s URI\n" "$0" 1>&2
2023-11-19 14:48:04 -07:00
return 64 # sysexits.h(3) EX_USAGE
fi
2023-12-18 12:47:55 -07:00
scdl --original-name --debug -l "$1" >> log 2>&1
2023-11-19 14:48:04 -07:00
}
up() { # updates everything on the system
command -v apk >/dev/null && su -c 'apk update'
command -v cargo-install-update >/dev/null && cargo install-update --all --git
command -v kiss >/dev/null && su -c 'kiss u' && su -c 'kiss U'
command -v nvim >/dev/null && nvim +PlugUpdate -c x -c x
if command -v paru >/dev/null; then paru
elif command -v pacman >/dev/null; then su -c 'pacman -Syyu'; fi
CWD="$PWD"
command -v git >/dev/null && \
for dir in $HOME/.local/src/git/*/*/*/
do
printf '%s\n' "$dir"
cd "$dir"
git pull --all
done
cd "$CWD"
}