From d6cda512a3d6450b88fcd99b5d95addc768bc05c Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 3 Nov 2023 18:07:08 +0100 Subject: made ask use tgpt --- bin/common/ask | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) (limited to 'bin/common') diff --git a/bin/common/ask b/bin/common/ask index 9fb04ce..95530f5 100755 --- a/bin/common/ask +++ b/bin/common/ask @@ -1,36 +1,4 @@ #!/bin/sh - -# requirements -which pass jq > /dev/null || - exit 1 - -# input -test -z "${inp:=$@}" && - inp="$(cat /dev/stdin)" - -# \n\t -> ' ' && "->' -prompt="$(echo "$inp" | tr "\n\t\"" " '")" -test -z "$prompt" && exit 1 - -API_KEY="$(pass tokens/openai-api)" -model="text-davinci-003" -tokens="1024" -temperature=0 - -data=$(echo \ -'{ - "prompt": "'"$prompt"'", - "model": "'"$model"'", - "max_tokens": '$tokens', - "temperature": '$temperature' -}') - -output=$(curl -s -X POST \ - -H 'Content-Type: application/json' \ - -H "Authorization: Bearer $API_KEY" \ - -d "$data" \ - https://api.openai.com/v1/completions \ - | jq -r '.choices[0].text') - -# remove newline -echo "${output:1}" +which tgpt >/dev/null || exit 1 +[ "${inp:=$@}" ] || inp="$(cat /dev/stdin)" +tgpt "$inp" -- cgit v1.2.3 From 09e3e0945dd31005f10d7cc18ccd5b38fdb58f97 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 10 Nov 2023 11:44:35 +0100 Subject: refactor --- bin/common/targit | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'bin/common') diff --git a/bin/common/targit b/bin/common/targit index ae046ac..ca560b3 100755 --- a/bin/common/targit +++ b/bin/common/targit @@ -1,6 +1,5 @@ #!/bin/sh -pwd=$(pwd) root="$(git rev-parse --show-toplevel)" cd "$root" || exit 1 -file="$(basename "$root" | sed 's/^\.//').tar.gz" -tar czf "$pwd/$file" $(git ls-files) +file="${root##*/}".tar.gz +tar czf "$file" $(git ls-files) -- cgit v1.2.3 From 2f3909181e31fb443c4ad2048a1e886e877e4a5c Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 12 Nov 2023 12:30:38 +0100 Subject: put channels in a subfolder --- bin/common/ytclipo | 2 +- config/essentials/zsh/aliases.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'bin/common') diff --git a/bin/common/ytclipo b/bin/common/ytclipo index 5d86c3f..8997539 100755 --- a/bin/common/ytclipo +++ b/bin/common/ytclipo @@ -23,5 +23,5 @@ yt-dlp "$inp" \ -f "b" \ -S "res:1080" \ -P "$HOME/vids/youtube/" \ - -o "%(channel)s - %(title)s.%(ext)s" + -o "%(channel)s/%(title)s.%(ext)s" notify-send "ytclipo" "finished downloading." || : diff --git a/config/essentials/zsh/aliases.sh b/config/essentials/zsh/aliases.sh index 5de4803..a166513 100644 --- a/config/essentials/zsh/aliases.sh +++ b/config/essentials/zsh/aliases.sh @@ -282,7 +282,7 @@ alias fzh="tac $HISTFILE | fzf | tee /dev/stderr | clipp" alias ffwin='hyprctl clients -j | jq '\''.[].pid'\'' | fzf --preview "hyprctl clients -j | jq '\''.[] | select(.pid == {}) | {class, title, workspace, xwayland}'\''"' alias pff='find ${PASSWORD_STORE_DIR:=~/src/password-store/} -name "*.gpg" | sed -e "s@$PASSWORD_STORE_DIR/@@" -e '\''s/\.gpg$//'\'' | fzf | xargs pass show -c' alias fzps='fzf --print0 | xargs -0I{}' -alias ytdl='yt-dlp --restrict-filenames --embed-chapters -f "b" -S "res:1080" -P "$HOME/vids/youtube/" -o "%(channel)s - %(title)s.%(ext)s"' +alias ytdl='yt-dlp --restrict-filenames --embed-chapters -f "b" -S "res:1080" -P "$HOME/vids/youtube/" -o "%(channel)s/%(title)s.%(ext)s"' # docker aliases alias dcb='docker build' -- cgit v1.2.3 From 1dcdf0cdb769296c33737d285ba9008cff0d60ba Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 16 Nov 2023 21:56:12 +0100 Subject: improved compatibility for different frontends Introduces the use of parameter expansion for converting the link, also convert to youtube.com, because this fixes the bug where you couldn't download playlists/channels. --- bin/common/ytclipo | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'bin/common') diff --git a/bin/common/ytclipo b/bin/common/ytclipo index 8997539..959ee21 100755 --- a/bin/common/ytclipo +++ b/bin/common/ytclipo @@ -11,9 +11,13 @@ fi inp="$1" [ "${inp:=$(paste)}" ] || inp="$(cat /dev/stdin)" -# take last link from clipboard -# works when link is from yt-local -inp="https://youtu.be/$(echo "$inp" | sed 's/.*\(.\{11\}\)$/\1/')" +# remove util scheme +inp="${inp#*//}" +# convert to youtube.com/path url +# works for: +# - 'youtu.be/watch?v=xxxxxx' +# - 'https://piped.video/watch?v=xxxxx' +inp="https://youtube.com/${inp#*/}" >&2 printf "inp: %s\n" "$inp" notify-send "ytclipo" "downloading $inp" || : -- cgit v1.2.3