summaryrefslogtreecommitdiff
path: root/bin/extra
diff options
context:
space:
mode:
Diffstat (limited to 'bin/extra')
-rwxr-xr-xbin/extra/clock19
-rwxr-xr-xbin/extra/myalscore.sh3
-rwxr-xr-xbin/extra/ntfy15
-rwxr-xr-xbin/extra/wd24
4 files changed, 44 insertions, 17 deletions
diff --git a/bin/extra/clock b/bin/extra/clock
index bd6efd2..6c5bfe0 100755
--- a/bin/extra/clock
+++ b/bin/extra/clock
@@ -1,12 +1,25 @@
#!/bin/sh
-clocks="${XDG_DATA_HOME:-$HOME}"/clocks.csv
+clocks="$HOME"/sync/share/clocks.csv
-if [ ! -f "$clocks" ]
-then
+# Create csv file with headers if not exist
+[ -f "$clocks" ] ||
printf 'start,end,message\n' > "$clocks"
+
+
+if [ "$1" = "-h" ]
+then
+ >&2 cat <<EOF
+usage: clock [OPTION]
+-h shows this help
+-p print clockings prettily
+
+With no option it will start clocking and prompt for a task.
+EOF
+ exit 1
fi
+
# print clocks file prettily
if [ "$1" = "-p" ]
then
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/ntfy b/bin/extra/ntfy
new file mode 100755
index 0000000..0522499
--- /dev/null
+++ b/bin/extra/ntfy
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+which jq > /dev/null || exit 1
+
+[ "$1" ] || exit 1
+
+curl -s -N "http://debuc.com:32336/$1/json?since=60m" |
+while read -r notification
+do
+ s="$(printf '%s' "$notification" | jq -r -c '"\(.title)@@@@@\(.message)"')"
+ message="${s#*@@@@@}"
+ title="${s%%@@@@@*}"
+ [ "$message" = "null" ] && [ "$title" = "null" ] && continue
+ herbe "$title" "$message" &
+done
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