summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-06-22 16:23:07 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-06-22 16:23:07 +0200
commitd466dcc80e77463fa035fc85ced0c253e38cbac2 (patch)
treedf8e20418fc6529e9639b0f38a205adfded16072 /bin
parent10e12bbe481af7974739060f51210f7948fc1df9 (diff)
parentfcc378109f2c9d3f80a6213646d7c170dd93100d (diff)
Merge branch 'main' of debuc.com:dotfiles
Diffstat (limited to 'bin')
-rwxr-xr-xbin/common/askpass17
-rwxr-xr-xbin/common/gt4
-rwxr-xr-xbin/extra/myalscore.sh3
-rwxr-xr-xbin/extra/wd24
-rwxr-xr-xbin/menuscripts/mpass2
5 files changed, 33 insertions, 17 deletions
diff --git a/bin/common/askpass b/bin/common/askpass
new file mode 100755
index 0000000..c7d2249
--- /dev/null
+++ b/bin/common/askpass
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# We can figure out the password for the key based on $1
+# which is in the following form:
+# Enter passphrase for key 'path/to/key':
+# The point is to retrieve the path where the filename is the name of
+# the key.
+# Then we can construct the path for pass and get the password.
+key="$(printf '%s\n' "$1" |
+ cut -f 2 -d \' |
+ awk -F '/' '{print $NF}')"
+pass="keys/$(hostname)/ssh/$key"
+
+# optional: add key to running ssh-agent
+keyadd "$key" &
+
+pass show "$pass" | head -n 1
diff --git a/bin/common/gt b/bin/common/gt
index c679b23..ceb58a8 100755
--- a/bin/common/gt
+++ b/bin/common/gt
@@ -15,10 +15,10 @@ help() {
usage: gt [OPTION]
-a PATH add repo
-s update and show status of each repo
--c COMMAND run 'git COMMAND' in each repo
+-c COMMAND run 'git COMMAND' in each repo
-h show this help
-l list repos
--e edit repos in $EDITOR
+-e edit repos in \$EDITOR
EOF
}
diff --git a/bin/extra/myalscore.sh b/bin/extra/myalscore.sh
index ef68bcc..e2b4e25 100755
--- a/bin/extra/myalscore.sh
+++ b/bin/extra/myalscore.sh
@@ -4,4 +4,5 @@
query="$(printf '%s' "$*" | sed 's/\s/%20/g')"
curl -s "https://myanimelist.net/search/prefix.json?type=all&keyword=$query&v=1" \
-H 'Accept: application/json, text/javascript, */*; q=0.01' |
- jq -r '.categories[].items[] | [.payload.score, .name] | join(" ")'
+ jq -r '.categories[].items[] | "\(.payload.score)@\(.name)@\(.url)"' |
+ column -t -l 3 -s '@'
diff --git a/bin/extra/wd b/bin/extra/wd
index 73bbaf7..1b56aa6 100755
--- a/bin/extra/wd
+++ b/bin/extra/wd
@@ -1,16 +1,14 @@
#!/bin/sh
+[ "$1" ] || exit 1
+dict "$1" |
+ sed -e '/^ /!d;s/^ //' |
+ sed -e '/^$/d;s/^[^ ].*$/\o033[1;4;34m&\o033[0m/' |
-### Word Definition
-# Based on https://askubuntu.com/questions/191125/is-there-an-offline-command-line-dictionary
-#
-### Installation
-# > sudo mkdir -p /usr/share/stardict/dic/
-## Get the dictionaries
-# > wget https://web.archive.org/web/20140428003644/http://abloz.com/huzheng/stardict-dic/dict.org/stardict-dictd_www.dict.org_gcide-2.4.2.tar.bz2
-# > wget https://web.archive.org/web/20140428004049/http://abloz.com/huzheng/stardict-dic/misc/stardict-xfardic-gnu-linux-2.4.2.tar.bz2
-## Other dictionaries I'd like to get
-# https://foldoc.org/scalar
+ # foldoc
+ sed -e '/^ /s/</\o033[2m/g' -e '/^ /s/>/\o033[0m/g' |
-sdcv -nj "$1" |
- jq -r '.[].definition' |
- sed -e '/^$/d;s/^[^ ].*$/\o033[1;4;38m&\o033[0m/'
+ # webster
+ sed -r -e 's/ \\\<\w+\>\\//g' -e '/^ *\[[^]]*Webster[^]]*\]/d' |
+ # replace {} by blue underline
+ sed -e '/^ /s/{/\o033[4m/g' -e '/^ /s/}/\o033[0m/g' |
+ tr -d '{}' # remove {} in word definition
diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass
index 7348321..f513b16 100755
--- a/bin/menuscripts/mpass
+++ b/bin/menuscripts/mpass
@@ -14,7 +14,7 @@ list_pswds()
while [ -d "$store/$file" ]
do
- choice="$(list_pswds "$store/$file" | dmenu -c -g 4 -l 4)"
+ choice="$(list_pswds "$store/$file" | commander -c)"
[ "$choice" ] || exit 1
[ -z "$file" ] && file="$choice" || file="$file/$choice"
done