diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-22 23:08:50 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-22 23:08:50 +0200 |
commit | 067b271a243dafcf652fe7cfe85e723d25ff1a64 (patch) | |
tree | c546402b2c40ca1e0739d1cc404f1d04d1d45067 /bin/common | |
parent | 67a2df82d25f52ea0937f4eed355546deae7b4b5 (diff) | |
parent | 9172676556847ff625cbf4b4eff19f441e0b9386 (diff) |
Merge branch 'main' of /var/git/dotfiles
Diffstat (limited to 'bin/common')
-rwxr-xr-x | bin/common/goo | 2 | ||||
-rwxr-xr-x | bin/common/saf | 13 | ||||
-rwxr-xr-x | bin/common/y2feed | 21 |
3 files changed, 29 insertions, 7 deletions
diff --git a/bin/common/goo b/bin/common/goo index a56cbaf..cb7a8b6 100755 --- a/bin/common/goo +++ b/bin/common/goo @@ -18,6 +18,6 @@ arduino15" for dir in $exclude; do dirs="$dirs -name \"$dir\" -o " done -cmd="find ${dest:-$HOME} \(${dirs} -false \) -prune -o -type ${1:-f} -mindepth 1 -print" +cmd="find ${2:-.} \(${dirs} -false \) -prune -o -type ${1:-f} -mindepth 1 -print" eval "$cmd" 2>/dev/null diff --git a/bin/common/saf b/bin/common/saf index 0c6fbc4..2936346 100755 --- a/bin/common/saf +++ b/bin/common/saf @@ -3,10 +3,19 @@ # Simple Ass Fetch by futxlii red="$(printf '\033[31m')" -green="$(printf '\033[32m')" blue="$(printf '\033[34m')" reset="$(printf '\033[0m')" +load () +{ + # take everything after 'load average: ' then remove '0.' or '.' or ',' + # from output, this multiplies by hundred, so we can divide an integer + # instead of a fraction (which dash can't do) + for time in $(uptime | sed -e 's/^.*load average://' -e 's/0\?\.\|,//g') + do printf "%s%%\n" "$((time/$(nproc)))" + done | xargs +} + for file in /etc/os-release /usr/lib/os-release do [ -f "$file" ] && . "$file" && break @@ -19,6 +28,6 @@ SHELL="$(basename "$SHELL")" cat <<EOF ${red}- ${blue}${ID:-"unknown"} ${red}- ${blue}$KERNEL - ${red}- ${blue}$UPTIME + ${red}- ${blue}$UPTIME ($(load)) ${red}- ${blue}$SHELL${reset} EOF diff --git a/bin/common/y2feed b/bin/common/y2feed index e30bccf..b55d66b 100755 --- a/bin/common/y2feed +++ b/bin/common/y2feed @@ -1,5 +1,18 @@ #!/bin/sh -echo "url: $1" >&2 -curl -L -s "$1" | - pup 'link[title=RSS] attr{href}' | - tee /dev/stderr + +get_feed() +{ + link="$(curl -L -s "$1" | pup 'link[title=RSS] attr{href}' 2>/dev/null)" + [ "$link" ] && printf "%s\n" "$link" | tee /dev/stderr && exit +} + +[ "$1" ] || exit 1 + +# url is channel +get_feed "$1" + +part="$(echo "$1" | awk -F '/' '{print $NF}')" +# last part is channel id +get_feed "https://www.youtube.com/channel/$part" +# last part is channel tag +get_feed "https://www.youtube.com/$part" |