Merge scripts into one repo

This commit is contained in:
Alex D. 2020-11-03 21:26:44 +01:00
commit 7656235b00
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
5 changed files with 67 additions and 0 deletions

9
ansiblequickdocs.zsh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/zsh
CACHE=~/.cache/ansbile-mods
ENDPOINT="https://docs.ansible.com/ansible/latest/modules"
IFS=$'\n'
([ ! -r $CACHE ] || [ ! -s $CACHE ]) && curl -sL "${ENDPOINT}/list_of_all_modules.html" | grep -oP '(?<=\<span class="std std-ref"\>).*(?=\<\/span\>)' > $CACHE
NAMES=($(< $CACHE))
SEL=$((for i in ${NAMES}; do print "$i"; done) | dmenu -i -l 20 -p "Module")
[ ! -z $SEL ] && xdg-open "${ENDPOINT}/${SEL%% *}_module.html"

13
bookmarks-dmenu.zsh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/zsh
IFS=$'\n'
declare -A bookmarks
NAMES=()
for i in ${1}/**/*.*; do
for x in $(< $i); do
local NAME="${x#* } | ${i##$1/}"
NAMES+=$NAME
bookmarks[$NAME]=${x%% *}
done
done
exec xdg-open "${bookmarks[$((for i in ${NAMES}; do print ${i}; done) | dmenu -i -l 20 -p "Bookmarks")]}"

5
passman-dmenu.zsh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/zsh
FILES=(~/.password-store/**/*.gpg)
PASS="$(for i in $FILES; do print ${${i#*/.password-store/}%.gpg}; done | dmenu -i -l 30 -p 'Password/OTP')"
[ ! -z $PASS ] && pass $([ -z ${PASS#*-otp} ] && <<< otp) $PASS -c

25
sfeed-dmenu.zsh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/zsh
() {
zmodload zsh/stat
local feedpath=~/.sfeed/feeds
setopt local_options shwordsplit
local vids=()
local IFS=$'\n'
for f in $feedpath/YouTube\ -\ *; do
local IFS=$'\n'
local content=($(< $f))
local IDS=()
for i in {1..5}; do
local IFS=$'\t'
local options=(${content[$i]})
if [[ ${options[6]:0:9} == "yt:video:" ]] && [[ ${IDS[(r)${options[6]:9:11}]} != ${options[6]:9:11} ]]; then
IDS+=(${options[6]:9:11})
vids+=("$(printf '%s | ID: %s - %.40s - %s' $options[1] ${options[6]:9:11} $options[7] $options[2])")
fi
done
done
local IFS=$'\n'
[ -z "${vids}" ] && return
local title=$(print -l ${${(nO)vids}#* | } | dmenu -i -l 35)
[ ! -z $title ] && exec mpv --profile=v ytdl://${title:4:11}
}

15
twitch-fetch.zsh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/zsh
source ~/.config/twitch-subs
LIST=()
for cur in $SUBSCRIPTIONS; do
<<< "Fetching twitch.tv/$cur" >&2
desc="$(youtube-dl --get-description "https://twitch.tv/$cur" 2>/dev/null)"
if [ -z "$desc" ]; then
<<< "$cur is offline." >&2
else
LIST+=("$cur | $desc")
fi
done
print -l $LIST > ~/.cache/twitch