From 22d2c57240e65df482e30fbe684844c6b173aca2 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 14 Aug 2023 12:37:09 +0200 Subject: [saf] added load function --- bin/common/saf | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'bin/common') diff --git a/bin/common/saf b/bin/common/saf index 0c6fbc4..dcc43d5 100755 --- a/bin/common/saf +++ b/bin/common/saf @@ -7,6 +7,15 @@ green="$(printf '\033[32m')" blue="$(printf '\033[34m')" reset="$(printf '\033[0m')" +load () +{ + for time in $(uptime | cut -f3- -d',' | cut -f2 -d':' | tr ',' ' ') + do + percent="$(echo "$time*100/$(nproc)" | bc)" + echo "${percent:-0}%" + 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 < Date: Mon, 14 Aug 2023 12:37:22 +0200 Subject: [saf] removed unused green color --- bin/common/saf | 1 - 1 file changed, 1 deletion(-) (limited to 'bin/common') diff --git a/bin/common/saf b/bin/common/saf index dcc43d5..9e31c68 100755 --- a/bin/common/saf +++ b/bin/common/saf @@ -3,7 +3,6 @@ # Simple Ass Fetch by futxlii red="$(printf '\033[31m')" -green="$(printf '\033[32m')" blue="$(printf '\033[34m')" reset="$(printf '\033[0m')" -- cgit v1.2.3 From 0b8685b836fb3cc034857438bf87076fa39af1a1 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 14 Aug 2023 12:50:14 +0200 Subject: [saf] remove bc dependency --- bin/common/saf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bin/common') diff --git a/bin/common/saf b/bin/common/saf index 9e31c68..2936346 100755 --- a/bin/common/saf +++ b/bin/common/saf @@ -8,10 +8,11 @@ reset="$(printf '\033[0m')" load () { - for time in $(uptime | cut -f3- -d',' | cut -f2 -d':' | tr ',' ' ') - do - percent="$(echo "$time*100/$(nproc)" | bc)" - echo "${percent:-0}%" + # 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 } -- cgit v1.2.3 From e1893b1b31503adaa2c2484b57a5d7a4a5d0516c Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 14 Aug 2023 21:37:08 +0200 Subject: [googoo] fixed destination argument not working --- bin/common/goo | 2 +- config/essentials/zsh/functions.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'bin/common') diff --git a/bin/common/goo b/bin/common/goo index a56cbaf..cfd03ec 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:-$HOME} \(${dirs} -false \) -prune -o -type ${1:-f} -mindepth 1 -print" eval "$cmd" 2>/dev/null diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh index 3c5f11f..e0eeb45 100644 --- a/config/essentials/zsh/functions.zsh +++ b/config/essentials/zsh/functions.zsh @@ -49,7 +49,7 @@ _googoo_fzf_opt () o () { _googoo_fzf_opt "$1" - f="$(goo f "dest" | fzf $opt)" + f="$(goo f "$dest" | fzf $opt)" test "$1" && shift test -f "$f" && $EDITOR $@ "$f" } -- cgit v1.2.3 From ece73a892806912ed45f875149065085690d64d4 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 15 Aug 2023 16:40:43 +0200 Subject: [y2feed] added support for different links You can now supply a channel id, a link to a channel or a tag, this should work with yt-local and piped as well. --- bin/common/y2feed | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'bin/common') 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" -- cgit v1.2.3 From dccf53c0d83973623e0d4c3f2550471232cf22b4 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 22 Aug 2023 22:25:53 +0200 Subject: [goo] search in pwd by default --- bin/common/goo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/common') diff --git a/bin/common/goo b/bin/common/goo index cfd03ec..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 ${2:-$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 -- cgit v1.2.3