From e850f3a1702b4d8b9d0cfec5c07d710b5201ed29 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 4 Aug 2023 22:36:30 +0200 Subject: edited toush to fit needs --- bin/common/toush | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'bin/common') diff --git a/bin/common/toush b/bin/common/toush index dd675b9..eb2d7cf 100755 --- a/bin/common/toush +++ b/bin/common/toush @@ -1,14 +1,10 @@ #!/bin/sh -# fork of -# https://codeberg.org/futxlii/bin/toush :) +# idea from https://codeberg.org/futxlii/bin/toush :) shebang='#!/bin/sh' -usage() { >&2 printf 'Usage: %s' "${0##*/}"; exit 1 ;} +[ -f "$1" ] && exit 1 -[ "$1" ] || usage -while [ "$1" ]; do - [ -f "$1" ] && usage - printf '%s\n\n' "$shebang" > "$1" && chmod +x "$1" - shift -done +printf '%s\n\n' "$shebang" > "$1" && + chmod +x "$1" && $EDITOR "$1" +grep -qv "$shebang\|^$" "$1" || rm "$1" -- cgit v1.2.3 From 5fa4e064dc48450f371a8f4ef42f58e5a437c60f Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 6 Aug 2023 14:58:44 +0200 Subject: [ytclipo] changed resolution and template --- bin/common/ytclipo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin/common') diff --git a/bin/common/ytclipo b/bin/common/ytclipo index 263f1b3..7e7b9cc 100755 --- a/bin/common/ytclipo +++ b/bin/common/ytclipo @@ -19,8 +19,8 @@ notify-send "ytclipo" "downloading $inp" yt-dlp "$inp" \ --restrict-filenames \ -f "b" \ - -S "res:720" \ + -S "res:1080" \ -P "$HOME/vids/youtube/" \ - -o "%(title)s.%(ext)s" + -o "%(channel)s - %(title)s.%(ext)s" notify-send "ytclipo" "ytclipo
finished downloading." echo "$inp" >> /tmp/ytclipo_history -- cgit v1.2.3 From cb110575144beb4125fd1d8204c8204e6bca280f Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 7 Aug 2023 18:59:08 +0200 Subject: [goo] added option to give search query as second paramater I noticed by mistake sometimes I would type the query already. --- bin/common/goo | 9 +++++++-- config/essentials/zsh/functions.zsh | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'bin/common') diff --git a/bin/common/goo b/bin/common/goo index cfd03ec..2a5faad 100755 --- a/bin/common/goo +++ b/bin/common/goo @@ -15,9 +15,14 @@ VisualParadigm intellij arduino15" +if [ -n "$2" ] +then + [ -d "$2" ] && dest="$2" || opt="-q $2" +fi + 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 ${dest:-$HOME} \(${dirs} -false \) -prune -o -type ${1:-f} -mindepth 1 -print" -eval "$cmd" 2>/dev/null +eval "$cmd" 2>/dev/null | fzf $opt diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh index 671e6fb..053ce8e 100644 --- a/config/essentials/zsh/functions.zsh +++ b/config/essentials/zsh/functions.zsh @@ -39,9 +39,9 @@ nnn() { test -z "$NNNLVL" && /usr/bin/nnn "$@" || exit } ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit } # googoo aliases -ff () { goo f "$1" | fzf } -fd () { goo d "$1" | fzf } -fdf () { goo f "$1" | fzf | xargs -I {} dirname "{}" } +ff () { goo f "$1" } +fd () { goo d "$1" } +fdf () { goo f "$1" | xargs -I {} dirname "{}" } o () { f="$(ff $1)" -- cgit v1.2.3 From b3f42fec8739d1d23ec6d64ff35c9db022c5adca Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 13 Aug 2023 20:15:52 +0200 Subject: [googoo] removed functions and updated behaviour removed functions that where unneed as they were only called once, changed behaviour to not implement fzf in goo but in the functions itself, this makes goo easier to implement in other commands. Also ported over the funcitonality of setting the query with the first argument --- bin/common/goo | 7 +------ config/essentials/zsh/functions.zsh | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'bin/common') diff --git a/bin/common/goo b/bin/common/goo index 2a5faad..a56cbaf 100755 --- a/bin/common/goo +++ b/bin/common/goo @@ -15,14 +15,9 @@ VisualParadigm intellij arduino15" -if [ -n "$2" ] -then - [ -d "$2" ] && dest="$2" || opt="-q $2" -fi - 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" -eval "$cmd" 2>/dev/null | fzf $opt +eval "$cmd" 2>/dev/null diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh index 053ce8e..c4999db 100644 --- a/config/essentials/zsh/functions.zsh +++ b/config/essentials/zsh/functions.zsh @@ -39,23 +39,30 @@ nnn() { test -z "$NNNLVL" && /usr/bin/nnn "$@" || exit } ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit } # googoo aliases -ff () { goo f "$1" } -fd () { goo d "$1" } -fdf () { goo f "$1" | xargs -I {} dirname "{}" } +_googoo_fzf_opt () +{ + if [ "$1" ] + then + [ -d "$1" ] && dest="$1" || opt="-q $1" + fi +} o () { - f="$(ff $1)" + _googoo_fzf_opt "$1" + f="$(goo f "dest" | fzf $opt)" test "$1" && shift - test -n "$f" && $EDITOR $@ "$f" + test -f "$f" && $EDITOR $@ "$f" } go () { - d="$(fd $1)" + _googoo_fzf_opt "$1" + d="$(goo d "$dest" | fzf $opt)" test -d "$d" && cd "$d" } ogo () { - d="$(fdf $1)" + _googoo_fzf_opt "$1" + d="$(dirname "$(goo f "$dest")" | fzf $opt)" test -d "$d" && cd "$d" } -- cgit v1.2.3 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