commit dabca457c9c38d8e163e6135cf286e204bcb35de
parent 0c396c0651e5022ee385fb2bf0e9f685020bf766
Author: Wim Dupont <wim@wimdupont.com>
Date: Sun, 5 May 2024 22:06:44 +0200
added dict gitc wta
Diffstat:
M | README.adoc | | | 26 | ++++++++++++++++++++++++++ |
A | bin/dict | | | 10 | ++++++++++ |
A | bin/gitc | | | 32 | ++++++++++++++++++++++++++++++++ |
A | bin/wta | | | 41 | +++++++++++++++++++++++++++++++++++++++++ |
4 files changed, 109 insertions(+), 0 deletions(-)
diff --git a/README.adoc b/README.adoc
@@ -48,11 +48,29 @@ image::docs/coin-in-dunst.png[coin-in-dunst.png]
Decrypts a GPG encrypted TAR file.
+== link:bin/dict[dict]
+
+Uses https://dictionaryapi.dev/[Free dictionary API] to retrieve word definitions in JSON.
+
+.Requires:
+
+* https://github.com/stedolan/jq[jq]
+
== link:bin/encr[encr]
Archives a given file or directory as a TAR file and encrypts it with GPG using symmetric or asymmetric encryption. By default it uses symmetric encryption and looks for encrypted
file "~/.sym-pwd.gpg" to use its content as password.
+== link:bin/gitc[gitc]
+
+Adds, commits and pushes git changes after confirmation. The -a "pushall" option should first be added to your gitconfig:
+
+[source,conf]
+----
+[alias]
+ pushall = !git remote | xargs -L1 git push
+----
+
== link:bin/mpvd[mpvd]
Uses dmenu to browse through music directory, including option to shuffle when choosing to play a directory.
@@ -142,6 +160,14 @@ Helper script to update X.org gamma value.
* https://gitlab.freedesktop.org/xorg/app/xgamma[xorg-xgamma]
* https://github.com/lcn2/calc[calc]
+== link:bin/wta[wta]
+
+Looks up words to add to .csv file after confirmation. To be used as helper for other programs such as link:https://git.wimdupont.com/wordstudent[wordstudent].
+
+.Requires:
+
+* link:bin/dict[dict]
+
== link:bin/yt[yt]
Uses mpv and youtube-dl (or forks such as yt-dlp) to easily look up videos from command-line with an audio-only option and an option to specify the amount of results.
diff --git a/bin/dict b/bin/dict
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+word=$1
+
+if [ -z ${word} ]; then
+ echo "What word do you want to look up?"
+ read word
+fi
+
+curl https://api.dictionaryapi.dev/api/v2/entries/en/"${word}" | jq
diff --git a/bin/gitc b/bin/gitc
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+nosign=0
+all=0
+while getopts "na" arg; do
+ case $arg in
+ n) nosign=1;;
+ a) all=1;;
+ esac
+done
+
+shift $((OPTIND-1))
+
+if [[ -z "${@// }" ]] ; then
+ echo "Please give commit message as argument" >&2
+ exit 1;
+fi
+
+git status
+
+echo "Are you sure you want to add all changes? [y/N]"
+
+read answer
+
+if [[ ! "$answer" =~ ^(y|Y|yes)$ ]]; then
+ echo "Exiting"
+ exit 0;
+fi
+
+git add .
+test "$nosign" == 1 && git -c commit.gpgsign=false commit -m "$*" || git commit -m "$*"
+test "$all" == 1 && git pushall || git push
diff --git a/bin/wta b/bin/wta
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+word=$1
+word_file="$HOME/.config/scripts/wordtester.csv"
+
+mkdir -p $HOME/.config/scripts
+
+if [ -z ${word} ]; then
+ echo "What word do you want to add?"
+ read word
+fi
+
+found_words=$(grep "^${word}" "${word_file}")
+
+function continue_prompt () {
+ read -p "Do you want to proceed? (y)es/(n)o " yn
+ case $yn in
+ yes|y ) echo proceeding;;
+ no|n ) echo exiting;
+ exit;;
+ * ) echo -e "invalid response\nexiting" >&2;
+ exit 1;;
+ esac
+}
+
+if [ -z "${found_words}" ]; then
+ echo Word not found
+else
+ printf " - Found:\n${found_words}\n\n"
+ continue_prompt
+fi
+
+dict "${word}"
+
+continue_prompt
+
+echo "${word}" >> "${word_file}"
+
+sort -o "${word_file}" "${word_file}"
+
+echo "${word} added."