aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/README.md0
-rw-r--r--scripts/archive/README.md1
-rwxr-xr-xscripts/archive/blog/ab442
-rw-r--r--scripts/archive/blog/doc/data.txt5
-rw-r--r--scripts/archive/blog/doc/templates/index-tag-template.html8
-rw-r--r--scripts/archive/blog/doc/templates/index-template.html8
-rw-r--r--scripts/archive/blog/doc/templates/rss-template.xml16
-rw-r--r--scripts/archive/blog/doc/templates/template.html59
-rwxr-xr-xscripts/archive/blog/rss-parse.sh46
-rwxr-xr-xscripts/stat/internet7
-rwxr-xr-xscripts/stat/news3
-rwxr-xr-xscripts/stat/ram.sh2
-rwxr-xr-xscripts/stat/vol-stat12
-rwxr-xr-xscripts/util/afk.sh17
-rwxr-xr-xscripts/util/arcc11
-rwxr-xr-xscripts/util/arco11
-rw-r--r--scripts/util/assets/accents.txt40
-rwxr-xr-xscripts/util/blue9
-rwxr-xr-xscripts/util/bmark.sh3
-rwxr-xr-xscripts/util/croc.sh7
-rwxr-xr-xscripts/util/dic5
-rwxr-xr-xscripts/util/dupt.sh5
-rwxr-xr-xscripts/util/fcd.sh13
-rwxr-xr-xscripts/util/fr-acc.sh5
-rwxr-xr-xscripts/util/gtab_init.sh24
-rwxr-xr-xscripts/util/hist.sh3
-rwxr-xr-xscripts/util/killpid.sh3
-rwxr-xr-xscripts/util/manfzf.sh13
-rwxr-xr-xscripts/util/netsel.sh6
-rwxr-xr-xscripts/util/open_15
-rwxr-xr-xscripts/util/passmen.sh6
-rwxr-xr-xscripts/util/pgen.sh34
-rwxr-xr-xscripts/util/power16
-rwxr-xr-xscripts/util/prompt8
-rwxr-xr-xscripts/util/sc.sh3
-rwxr-xr-xscripts/util/sp.sh11
-rwxr-xr-xscripts/util/update-web.sh6
-rwxr-xr-xscripts/util/vol19
-rwxr-xr-xscripts/util/vol+17
-rwxr-xr-xscripts/util/vol-22
-rwxr-xr-xscripts/util/vpn.sh63
41 files changed, 994 insertions, 0 deletions
diff --git a/scripts/README.md b/scripts/README.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/scripts/README.md
diff --git a/scripts/archive/README.md b/scripts/archive/README.md
new file mode 100644
index 0000000..9385294
--- /dev/null
+++ b/scripts/archive/README.md
@@ -0,0 +1 @@
+Retired Scripts
diff --git a/scripts/archive/blog/ab b/scripts/archive/blog/ab
new file mode 100755
index 0000000..b16c933
--- /dev/null
+++ b/scripts/archive/blog/ab
@@ -0,0 +1,442 @@
+#!/bin/bash
+
+blogdir="arachnida_blog"
+imgdir="assets/img"
+datafile="../doc/data.txt"
+drafts="drafts"
+template="../doc/templates/template.html"
+index_template="../doc/templates/index-template.html"
+index_tag_template="../doc/templates/index-tag-template.html"
+rss_template="../doc/templates/rss-template.xml"
+rss_file="~/Doc/programming/website/arachnida_blog/rss/rss.xml"
+
+# Colored Output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+RESET='\033[0m'
+
+# Update
+function update () {
+ #printf 'Updating: arachnida.blog\n' | dzen2 -bg white -fg black -p 2 -x -375 -y 50 -w 275 -h 50
+ rsync -uvrp --delete-after "$blogdir" root@"$DOMAIN":"$REMOTE_LOCATION"
+ printf "\n\n${GREEN}Website has been updated.${RESET}\n\n"
+}
+
+# Pick an entry
+function listitem () {
+ printf "\nContents of %s:\n" "$1"
+ case "$(ls --hide "img" "$1" | wc -l)" in
+ 0) printf "${RED}No drafts made yet.\n\n${GREEN}Redirecting...${RESET}\n\n" && blog ;;
+ 1) number=1 && printf "Only one draft available.\n" ;;
+ *) ls -rc --hide "img" "$1" | awk -F '/' '{print $NF}' | sed 's/\.html$//' | nl # edited
+ printf "\nPick and entry by number to %s" "$2: " | sed 's/blog_//g' && read number
+ esac
+ entry="$(ls --hide "img" -rc "$1" | nl | grep -w " $number" | awk '{print $2}')"
+ basefile="$(basename "$entry")" && base="${basefile%.*}"
+}
+
+# Confirm a choice
+function confirm () { read -p "Really $1 \"$base\"? (y/N) " choice && echo "$choice" | grep -qi "^y$" || exit 1; }
+
+# Create a new blog draft
+function blog_draft () {
+ read -e -p "Give your post a title: " title
+
+ max=0
+ while [ $max == 0 ]; do
+ read -e -p "Enter a description (50 words limit): " description
+ [ $(echo "$description" | wc -w) -ge "50" ] && echo "Description must be less than 50 words." || max=1
+ done
+
+ read -e -r -p "Input an image to reflect your post: " img
+ while [ ! -e $img ]; do
+ read -e -r -p "$img does not exist. Please try another path: " img
+ done
+
+ url="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
+ ( [ -f "$drafts"/$url.html ] || [ -f "$blogdir/blog/$url.html" ] ) &&
+ printf "\nThere is already an existing draft or post with the same title.\n\n Redirecting...\n\n" && blog
+ $EDITOR "$drafts"/$url.html
+ # Select tags
+ tags=("informative" "care" "rant" "breeding-report" "off-topic" "seller-review")
+ tagged=()
+ menu() {
+ clear
+ echo "Choose a tag(s):"
+ for i in ${!tags[@]}; do
+ printf "%3d%s) %s\n" $((i+1)) "${choices[i]:- }" "${tags[i]}"
+ done
+ if [[ "$msg" ]]; then echo "$msg"; fi
+ }
+
+ prompt="Check an option (again to uncheck, ENTER when done): "
+ while menu && read -rp "$prompt" num && [[ "$num" ]]; do
+ [[ "$num" != *[![:digit:]]* ]] &&
+ (( num > 0 && num <= ${#tags[@]} )) ||
+ { msg="Invalid option: $num"; continue; }
+ ((num--))#; msg="${tags[num]} was ${choices[num]:+un}checked"
+ [[ "${choices[num]}" ]] && choices[num]="" || choices[num]="+"
+ done
+ for i in ${!tags[@]}; do
+ [[ "${choices[i]}" ]] && { tagged+=(${tags[i]^}); }
+ done
+ TAGS=$(printf "%s, " "${tagged[@]}")
+
+ # image handling
+ img=$(echo "$img" | cut -f 1 -d '.' >&1)
+
+ if [[ -e "$drafts"/img/$img.jpg || -e "$blogdir"/assets/img/blog/$img.jpg ]] ; then
+ i="2"
+ while [[ -e "$drafts"/img/$img-$i.jpg || -e "$blogdir"/assets/img/blog/$img-$i.jpg ]]; do ((i++)); done
+ mv "$img.jpg" "$img-$i.jpg" && cp "$img-$i.jpg" "$drafts"/img/ && mv "$img-$i.jpg" "$img.jpg"
+ img="$img-$i.jpg"
+ else
+ cp "$img.jpg" "$drafts"/img/
+ img="$img.jpg"
+ fi
+
+ printf "Post: %s\nTitle: %s\nDescription: %s\nImage: %s\nTags:\n" "$url" "$title" "$description" "$img" | cat - "$datafile" | sponge "$datafile"
+ sed -i "5s/$/ ${TAGS}\n/" "$datafile"
+ printf "\n${GREEN}Post was saved as a draft: Publish when you are ready to do so.${RESET}\n\n"
+}
+
+# Edit a blog draft. Either title, description, content, or index image
+function edit_draft () {
+ title() {
+ read -e -r -p "Enter a new title: " title
+ url="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
+ old_url="$(echo $(basename "$basefile" ".html" | sed 's/ /-/g'))"
+ old_title="$(awk "/Post: $old_url/{getline; print}" "$datafile" | sed 's/^[^:]*: //')"
+ ( [ -f "$drafts"/$url.html ] || [ -f "$blogdir/blog/$url.html" ] ) &&
+ printf "\nThere is already an existing draft or post with the same title.\n\n Redirecting...\n\n" && title
+ mv $drafts/$entry $drafts/$url.html
+ sed -i "s/Post: $old_url/Post: $url/g" "$datafile"
+ sed -i "s/Title: $old_title/Title: $title/g" "$datafile"
+ printf "\n${GREEN}Title has been updated.${RESET}\n\n"
+ }
+
+ descr() {
+ max=0
+ while [ $max == 0 ]; do
+ read -e -p "Enter a new description (50 words limit): " descript
+ [ $(echo "$descript" | wc -w) -ge "50" ] && echo "Description must be less than 50 words." || max=1
+ done
+ sed -i "/Post: $(basename "$basefile" ".html")/{n;s/.*/Description: $descript/}" "$datafile"
+ sed -i "/Description: $descript/{n;d;}" "$datafile"
+ printf "\n${GREEN}Description has been updated.${RESET}\n\n"
+ }
+
+ con() { listitem "$drafts" edit && "$EDITOR" "$drafts"/$entry && printf "\nPost's content has been updated.\n\n"; }
+
+ image() {
+ entry="$(basename "$entry" ".html")"
+ read -e -r -p "Enter the path to a new image: " img
+ while [ ! -e "$img" ]; do
+ read -e -r -p "$img does not exist. Please try another path: " img
+ done
+
+ img=$(echo "$img" | cut -f 1 -d '.' >&1)
+ old_img="$(cat "$datafile" | sed -n "/Post: "$entry"/{n;n;n; p}" | sed 's/^[^:]*: //')"
+ if [[ -e "$drafts"/img/$img.jpg || -e "$blogdir"/assets/img/blog/$img.jpg ]] ; then
+ i="2"
+ while [[ -e "$drafts"/img/$img-$i.jpg || -e "$blogdir"/assets/img/blog/$img-$i.jpg ]]; do ((i++)); done
+ mv "$img.jpg" "$img-$i.jpg" && cp "$img-$i.jpg" "$drafts"/img/
+ else cp "$img.jpg" "$imgdir"/blog/
+ fi
+ rm "$drafts"/img/$old_img
+ sed -i "s/Image: $old_img/Image: $img.jpg/g" "$datafile"
+ printf "\n${GREEN}Index image has been updated.${RESET}\n\n"
+ }
+
+ printf "\nEditing %s:\nUsage:\n\tt = Title\n\td = Description\n\tc = Content\n\ti = Image\n\n" "$entry"
+ read -p "How would you like proceed? " cmd
+ case "$cmd" in
+ t) title ;;
+ d) descr ;;
+ c) con ;;
+ i) image ;;
+ *) printf "Exiting..\n\n" && exit 1 ;;
+ esac
+}
+
+# Delete a draft
+function del_draft () {
+ printf "${RED}Deleting $entry.${RESET}\n" && rm -f "$drafts"/$entry
+ sed -i "/Post: $(basename "$entry" ".html")/,+5d" "$datafile"
+}
+
+# Delete a public post
+function blog_pub_del () {
+ title="$(basename $basefile .html | sed 's/-/ /g')"
+ post='\<a href="..\/'"$basefile"'">'
+ blog_post='\<a href="blog\/'"$basefile"'">'
+
+ sed -i -n '/'"$blog_post"'/{x;d;};1h;1!{x;p;};${x;p;}' "$blogdir"/blog.html
+ sed -i -e '/'"$blog_post"'/,+4d' "$blogdir"/blog.html
+ sed -i "/Post: $(basename "$entry" ".html")/,+5d" "$datafile"
+ sed -i '/<!-- START: '"$title"'/,/<!-- END: '"$title"'/d' "$rss_file"
+
+ if grep -q "$title" "$blogdir"/index.html; then
+ sed -i '/'"$title"'/d' "$blogdir"/index.html
+ fi
+
+ if grep -o -q "$title" "$blogdir"/blog/tags/off-topic.html; then
+ sed -i -n '/'"$post"'/{x;d;};1h;1!{x;p;};${x;p;}' "$blogdir"/blog/tags/off-topic.html
+ sed -i -e '/'"$post"'/,+4d' "$blogdir"/blog/tags/off-topic.html
+ fi
+
+ if grep -o -q "$title" "$blogdir"/blog/tags/breeding-reports.html; then
+ sed -i -n '/'"$post"'/{x;d;};1h;1!{x;p;};${x;p;}' "$blogdir"/blog/tags/breeding-reports.html
+ sed -i -e '/'"$post"'/,+4d' "$blogdir"/blog/tags/breeding-reports.html
+ fi
+
+ if grep -o -q "$title" "$blogdir"/blog/tags/care.html; then
+ sed -i -n '/'"$post"'/{x;d;};1h;1!{x;p;};${x;p;}' "$blogdir"/blog/tags/care.html
+ sed -i -e '/'"$post"'/,+4d' "$blogdir"/blog/tags/care.html
+ fi
+
+ if grep -o -q "$title" "$blogdir"/blog/tags/informative.html; then
+ sed -i -n '/'"$post"'/{x;d;};1h;1!{x;p;};${x;p;}' "$blogdir"/blog/tags/informative.html
+ sed -i -e '/'"$post"'/,+4d' "$blogdir"/blog/tags/informative.html
+ fi
+
+ if grep -o -q "$title" "$blogdir"/blog/tags/seller-reviews.html; then
+ sed -i -n '/'"$post"'/{x;d;};1h;1!{x;p;};${x;p;}' "$blogdir"/blog/tags/seller-reviews.html
+ sed -i -e '/'"$post"'/,+4d' "$blogdir"/blog/tags/seller-reviews.html
+ fi
+
+ if grep -o -q "$title" "$blogdir"/blog/tags/rant.html; then
+ sed -i -n '/'"$post"'/{x;d;};1h;1!{x;p;};${x;p;}' "$blogdir"/blog/tags/rant.html
+ sed -i -e '/'"$post"'/,+4d' "$blogdir"/blog/tags/rant.html
+ fi
+
+ printf "${RED}Deleting $entry.${RESET}\n" && rm -f "$blogdir"/blog/$entry && update
+}
+
+# Publish a draft
+function blog_pub () {
+ tmpdir=$(mktemp -d)
+ rssdate="$(LC_TIME=en_US date '+%a, %d %b %Y %H:%M:%S %z')"
+ webdate="$(date '+%Y %b %d')"
+ url="$(basename "$basefile" ".html")"
+ title="$(awk "/Post: $url/{getline; print}" "$datafile" | sed 's/^[^:]*: //')"
+ description="$(awk "/$title/{getline; print}" "$datafile" | sed 's/^[^:]*: //')"
+ img="$(awk "/$description/{getline; print}" "$datafile" | sed 's/^[^:]*: //')"
+ tags="$(grep -A1 "$img" "$datafile" | grep -v "$img" | sed -e 's/^[^:]*: //' -e 's/\,//g')"
+ tagsArr=(${tags})
+ post="$(cat "$drafts"/$basefile)"
+ recent="$(printf "$(basename $basefile ".html")" | sed "s/^.*$/\<li\>\<a href=\"blog\/&.html\"\>$title\<\/a\>\<\/li\>/g" | awk 'BEGIN{FS=OFS=".html\">"} {gsub(/-/," ",$2)}1')"
+ numofrecent="$(sed -n '/<!-- RECENT POSTS -->/,/<!-- END-RECENT POSTS -->/p' "$blogdir"/index.html | wc -l)"
+
+ printf "$(cat "$index_tag_template")\n" "$basefile" "$img" "$img" "$basefile" "$title" "$webdate" "$description" "$basefile" > "$tmpdir/tagindex"
+ for i in "${tagsArr[@]}"; do
+ case ${i} in
+ "Informative")
+ printf "$i\n" | sed "s/^.*$/<h3><a href=\"tags\/informative.html\">&<\/a><\/h3>/g" >> "$tmpdir/tag"
+ sed -i "/<!-- INDEX CONTENT -->/r $tmpdir/tagindex" "$blogdir"/blog/tags/informative.html
+ ;;
+ "Care")
+ printf "$i\n" | sed "s/^.*$/<h3><a href=\"tags\/care.html\">&<\/a><\/h3>/g" >> "$tmpdir/tag"
+ sed -i "/<!-- INDEX CONTENT -->/r $tmpdir/tagindex" "$blogdir"/blog/tags/care.html
+ ;;
+ "Rant")
+ printf "$i\n" | sed "s/^.*$/<h3><a href=\"tags\/rant.html\">&<\/a><\/h3>/g" >> "$tmpdir/tag"
+ sed -i "/<!-- INDEX CONTENT -->/r $tmpdir/tagindex" "$blogdir"/blog/tags/rant.html
+ ;;
+ "Breeding-report")
+ printf "$i\n" | sed "s/^.*$/<h3><a href=\"tags\/breeding-reports.html\">&<\/a><\/h3>/g" >> "$tmpdir/tag"
+ sed -i "/<!-- INDEX CONTENT -->/r $tmpdir/tagindex" "$blogdir"/blog/tags/breeding-reports.html
+ ;;
+ "Off-topic")
+ printf "$i\n" | sed "s/^.*$/<h3><a href=\"tags\/off-topic.html\">&<\/a><\/h3>/g" >> "$tmpdir/tag"
+ sed -i "/<!-- INDEX CONTENT -->/r $tmpdir/tagindex" "$blogdir"/blog/tags/off-topic.html
+ ;;
+ "Seller-review")
+ printf "$i\n" | sed "s/^.*$/<h3><a href=\"tags\/seller-reviews.html\">&<\/a><\/h3>/g" >> "$tmpdir/tag"
+ sed -i "/<!-- INDEX CONTENT -->/r $tmpdir/tagindex" "$blogdir"/blog/tags/seller-reviews.html
+ ;;
+ *) ;;
+ esac
+ done
+
+ printf "$(cat "$template")" "$title" "$description" "$title" "$webdate" > "$blogdir"/blog/"$basefile" # Append draft file to blog directory
+ sed -i "/<!-- BLOG CONTENT -->/r $drafts/$basefile" "$blogdir"/blog/"$basefile" # Append post in the draft
+ sed -i "/<!-- TAGS -->/r $tmpdir/tag" "$blogdir"/blog/"$basefile" # Append respective tags in draft
+ printf "$(cat "$index_template")\n" "$basefile" "$img" "$img" "$basefile" "$title" "$webdate" "$description" "$basefile" > "$tmpdir/blogindex"
+ sed -i "/<!-- INDEX CONTENT -->/r $tmpdir/blogindex" "$blogdir"/blog.html
+ printf "$(cat "$rss_template")\n" "$title" "$title" "$(basename "$basefile" ".html")" "$(basename "$basefile" ".html")" "$rssdate" "$(echo "$post" | recode "..html")" "$title" > "$tmpdir/rss" # RSS
+ sed -i "/<!-- RSS -->/r $tmpdir/rss" "$blogdir/rss/rss.xml" # ↓
+
+ sed -i -e '/<!-- RECENT POSTS -->/a '"$recent"'' "$blogdir"/index.html
+ [ "$numofrecent" -ge 7 ] && sed -i -n '/<!-- END-RECENT POSTS -->/{x;d;};1h;1!{x;p;};${x;p;}' "$blogdir"/index.html
+
+ cp $drafts/img/$img "$imgdir"/blog && rm $drafts/img/$img && rm "$drafts"/$basefile
+ printf "\n${GREEN}Draft has been published.${RESET}\n\n" && update
+}
+
+# Edit or Revise a published blog post
+function blog_edit_pub () {
+ title() {
+ read -e -r -p "Enter a new title: " title
+
+ url="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
+ old_url="$(echo $(basename "$basefile" ".html" | sed 's/ /-/g'))"
+ old_title="$(awk "/Post: $old_url/{getline; print}" "$datafile" | sed 's/^[^:]*: //')"
+ tags="$(sed -n "/$old_url/{n;n;n;n; p}" "$datafile" | sed -e 's/^[^:]*: //' -e 's/\,//g')"
+ tagsArr=(${tags})
+ for i in "${tagsArr[@]}"; do
+ case ${i} in
+ "Informative")
+ sed -i -e "s/$old_title/$title/g" -e "s/$old_url/$url/g" "$blogdir"/blog/tags/informative.html
+ ;;
+ "Care")
+ sed -i -e "s/$old_title/$title/g" -e "s/$old_url/$url/g" "$blogdir"/blog/tags/care.html
+ ;;
+ "Rant")
+ sed -i -e "s/$old_title/$title/g" -e "s/$old_url/$url/g" "$blogdir"/blog/tags/rant.html
+ ;;
+ "Breeding-report")
+ sed -i -e "s/$old_title/$title/g" -e "s/$old_url/$url/g" "$blogdir"/blog/tags/breeding-reports.html
+ ;;
+ "Off-topic")
+ sed -i -e "s/$old_title/$title/g" -e "s/$old_url/$url/g" "$blogdir"/blog/tags/off-topic.html
+ ;;
+ "Seller-review")
+ sed -i -e "s/$old_title/$title/g" -e "s/$old_url/$url/g" "$blogdir"/blog/tags/seller-reivews.html
+ ;;
+ *) ;;
+ esac
+ done
+ sed -i -e "s/Post: $old_url/Post: $url/g" -e "s/Title: $old_title/Title: $title/g" "$datafile" # Update URL & Title in data file
+ sed -i -e "s/$old_title/$title/g" "$blogdir"/blog/$entry # Rename title & headings in $entry
+ sed -i -e "s/$old_title/$title/g" -e "s/$basename/$url/g" "$rss_file" # Update RSS title and URL
+ sed -i -e "s/"$entry"/"$url.html"/g" -e "s/$old_title/$title/g" "$blogdir"/blog.html # Update URLS & title in blog.html
+ sed -i -e "s/"$entry"/"$url.html"/g" -e "s/$old_title/$title/g" "$blogdir"/index.html # Update URLS & title in index.html
+ mv "$blogdir"/blog/$entry "$blogdir/blog/$url.html" # Rename file in /blog
+ printf "\n${GREEN}Title has been updated.${RESET}\n\n" && update
+ }
+
+ descr() {
+ title="$(awk "/Post: $(basename "$basefile" ".html")/{getline; print}" "$datafile" | sed 's/^[^:]*: //')"
+ old_description="$(sed -n "/Title: $title/{ n; p }" $datafile | sed 's/^[^:]*: //')"
+ max=0
+ while [ $max == 0 ]; do
+ read -e -p "Enter a new description (50 words limit): " new_description
+ [ $(echo "$new_description" | wc -w) -ge "50" ] && echo "Description must be less than 50 words." || max=1
+ done
+
+ tags="$(sed -n "/$(basename "$basefile" ".html")/{n;n;n;n; p}" "$datafile" | sed -e 's/^[^:]*: //' -e 's/\,//g')"
+ tagsArr=(${tags})
+ for i in "${tagsArr[@]}"; do
+ case ${i} in
+ "Informative")
+ sed -i "s/$old_description/$new_description/g" "$blogdir"/blog/tags/informative.html
+ ;;
+ "Care")
+ sed -i "s/$old_description/$new_description/g" "$blogdir"/blog/tags/care.html
+ ;;
+ "Rant")
+ sed -i "s/$old_description/$new_description/g" "$blogdir"/blog/tags/rant.html
+ ;;
+ "Breeding-report")
+ sed -i "s/$old_description/$new_description/g" "$blogdir"/blog/tags/breeding-reports.html
+ ;;
+ "Off-topic")
+ sed -i "s/$old_description/$new_description/g" "$blogdir"/blog/tags/off-topic.html
+ ;;
+ "Seller-review")
+ sed -i "s/$old_description/$new_description/g" "$blogdir"/blog/tags/seller-reviews.html
+ ;;
+ *) ;;
+ esac
+ done
+ sed -i "s/Description: $old_description/Description: $new_description/g" "$datafile"
+ sed -i "s/$old_description/$new_description/g" "$blogdir"/blog/$entry
+ sed -i "s/$old_description/$new_description/g" "$blogdir"/blog.html
+ printf "\n${GREEN}Description has been updated.${RESET}\n\n" && update
+ }
+
+ content() {
+
+ title="$(basename $basefile .html | sed 's/-/ /g')"
+ url="$(echo $title | sed 's/ /-/g')"
+ old_rss="$(sed -n '/<!-- BLOG CONTENT -->/,/<!-- END BLOG CONTENT -->/{/<!-- BLOG CONTENT -->/!{/<!-- END BLOG CONTENT -->/!p}}' "$blogdir/blog/$entry" | recode ..html | sed 's/&/\\&/g')"
+ "$EDITOR" "$blogdir"/blog/$entry
+ new_rss="$(sed -n '/<!-- BLOG CONTENT -->/,/<!-- END BLOG CONTENT -->/{/<!-- BLOG CONTENT -->/!{/<!-- END BLOG CONTENT -->/!p}}' "$blogdir/blog/$entry" | recode ..html | sed 's/&/\\&/g')"
+ sed -i -e "s~$old_rss~~g" -e '/LETS test RSS FEED/n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n;n; r'<(printf "$new_rss") "$rss_file"
+ printf "\n${GREEN}Description has been updated.${RESET}\n\n" && update
+ }
+
+ image() {
+ read -e -r -p "Enter the path to a new image: " img
+ while [ ! -e "$img" ]; do
+ read -e -r -p "$img does not exist. Please try another path: " img
+ done
+
+ old_img="$(cat "$datafile" | sed -n "/Post: $(basename "$entry" ".html")/{n;n;n; p}" | sed 's/^[^:]*: //' | cut -f 1 -d '.' >&1)"
+ img=$(echo "$img" | cut -f 1 -d '.' >&1)
+ if [[ -e "$drafts"/img/$img.jpg || -e "$blogdir"/assets/img/blog/$img.jpg ]] ; then
+ i="2"
+ while [[ -e "$drafts"/img/$img-$i.jpg || -e "$blogdir"/assets/img/blog/$img-$i.jpg ]]; do ((i++)); done
+ mv "$img.jpg" "$img-$i.jpg"
+ cp "$img-$i.jpg" "$blogdir"/assets/img/blog/
+ rm "$blogdir"/assets/img/blog/$old_img.jpg
+ mv "$img-$i.jpg" "$img.jpg"
+ else cp "$img.jpg" "$imgdir"/blog/
+ fi
+
+ sed -i "s/Image: $old_img/Image: $img/g" "$datafile"
+ sed -i "s/$old_img/$img/g" "$blogdir"/blog.html
+ printf "\n${GREEN}Index image has been updated.${RESET}\n\n" && update
+ }
+
+ printf "\n\nRevising a public entry: %s:\nUsage:\n\tt = Title\n\td = Description\n\tc = Content\n\ti = Image\n\n" "$entry"
+ read -p "How would you like proceed? " cmd
+ case "$cmd" in
+ t) title ;;
+ d) descr ;;
+ c) content ;;
+ i) image ;;
+ *) printf "Exiting..\n\n" && exit 1 ;;
+ esac
+}
+
+
+# Create, Revise, Publish,
+function blog () {
+ printf "\nEditing arachnida.blog\nUsage:\n\tn = New Draft\n\tp = Publish Draft\n\te = Edit Draft\n\tr = Revise published post\n\tt = Delete draft\n\td = Delete publish post\n\n"
+ read -p "How would you like proceed? " cmd
+ case "$cmd" in
+ n*) blog_draft ;;
+ p*) listitem "$drafts" publish && blog_pub ;;
+ e*) listitem "$drafts" edit && edit_draft ;;
+ r*) listitem "$blogdir/blog" revise public entry && blog_edit_pub ;;
+ t*) listitem "$drafts" delete && confirm delete && del_draft ;;
+ d*) listitem "$blogdir/blog" delete && confirm delete && blog_pub_del ;;
+ *) printf "Exiting..\n\n" && exit 1 ;;
+ esac
+}
+
+
+function shop () {
+ $empty
+}
+
+function gallery () {
+ $empty
+}
+
+
+# Webpick
+case "$1" in
+ -b*) blog ;;
+ -s*) shop ;;
+ -g*) gallery ;;
+ *) printf "\n\nab blog system by Ben Nagy <ben@arachnida.blog>\n\nUsage:\n ab -b: blog\n ab -s: shop\n ab -g: gallery\n\n" ;;
+esac
+
+
+# TODO
+
+# Allow revision of tags
+# calculate article read time
diff --git a/scripts/archive/blog/doc/data.txt b/scripts/archive/blog/doc/data.txt
new file mode 100644
index 0000000..c034039
--- /dev/null
+++ b/scripts/archive/blog/doc/data.txt
@@ -0,0 +1,5 @@
+Post: foo post
+Title: foo title
+Description: foo description
+Image: /home/user/foo.jpg
+Tags: Informative, Off-topic,
diff --git a/scripts/archive/blog/doc/templates/index-tag-template.html b/scripts/archive/blog/doc/templates/index-tag-template.html
new file mode 100644
index 0000000..bc63ce9
--- /dev/null
+++ b/scripts/archive/blog/doc/templates/index-tag-template.html
@@ -0,0 +1,8 @@
+<article>
+ <a href="../%s">
+ <img src="../../assets/img/blog/%s" alt="%s"></a>
+ <h1><a href="../%s">%s</a></h1>
+ <h2>%s</h2>
+ <p>%s</p>
+ <h3><a href="../%s">Read more...</a></h3>
+</article>
diff --git a/scripts/archive/blog/doc/templates/index-template.html b/scripts/archive/blog/doc/templates/index-template.html
new file mode 100644
index 0000000..64d0992
--- /dev/null
+++ b/scripts/archive/blog/doc/templates/index-template.html
@@ -0,0 +1,8 @@
+<article>
+ <a href="blog/%s">
+ <img src="assets/img/blog/%s" alt="%s"></a>
+ <h1><a href="blog/%s">%s</a></h1>
+ <h2>%s</h2>
+ <p>%s</p>
+ <h3><a href="blog/%s">Read more...</a></h3>
+</article>
diff --git a/scripts/archive/blog/doc/templates/rss-template.xml b/scripts/archive/blog/doc/templates/rss-template.xml
new file mode 100644
index 0000000..2022ec1
--- /dev/null
+++ b/scripts/archive/blog/doc/templates/rss-template.xml
@@ -0,0 +1,16 @@
+
+<!-- START: %s -->
+<item>
+ <title>%s</title>
+ <link>https://arachnida.blog/blog/%s</link>
+ <guid>https://arachnida.blog/blog/%s</guid>
+
+ <pubDate>%s</pubDate>
+
+ <description>
+ <![CDATA[
+ %s
+ ]]>
+ </description>
+</item>
+<!-- END: %s -->
diff --git a/scripts/archive/blog/doc/templates/template.html b/scripts/archive/blog/doc/templates/template.html
new file mode 100644
index 0000000..c0c8afb
--- /dev/null
+++ b/scripts/archive/blog/doc/templates/template.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <title>%s</title>
+
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="robots" content="index, follow">
+ <meta name="description" content="%s">
+
+ <link rel="shortcut icon" type="image/x-icon" href="../assets/img/main/logo.ico">
+ <link rel="stylesheet" type="text/css" href="../css/main.css">
+ <link rel='alternate' type='application/rss+xml' title="Arachnida RSS Feed" href='../rss/rss.xml'>
+ </head>
+
+ <body>
+ <div class="container">
+ <header>
+ <h1>Arachnida blog</h1>
+ </header>
+
+ <nav>
+ <a href="../index.html"><h3>Home</h3></a>
+ <a href="../blog.html"><h3 id="active">Blog</h3></a>
+ <a href="../gallery.html"><h3>Gallery</h3></a>
+ <a href="https://shop.arachnida.blog"><h3>Shop</h3></a>
+ </nav>
+
+ <main>
+ <div class="blog-container">
+ <h1 id="blog-title">%s</h1>
+ <h3>%s</h3>
+ <div class="blog-content">
+ <!-- BLOG CONTENT -->
+
+ <!-- END BLOG CONTENT -->
+ </div>
+ </div>
+
+ <section id="tagged">
+ <h2>Tagged</h2>
+ <div class="tagged-content">
+ <!-- TAGS -->
+ </div>
+ </section>
+ </main>
+
+ <footer>
+ <hr>
+ <h3>arachnida.blog</h3>
+
+ <br>
+ <a href="../assets/img/main/monero.png" title="Donate"><img src="../assets/img/main/monero.svg" alt="XMR"></a>
+ <a href="../rss/rss.xml" title="RSS Feed"><img src="../assets/img/main/rss.svg" alt="RSS"></a>
+ <a href="mailto:ben@arachnida.blog" title="Contact"><img src="../assets/img/main/mail.svg" alt="Email"></a>
+ </footer>
+ </div>
+ </body>
+</html>
diff --git a/scripts/archive/blog/rss-parse.sh b/scripts/archive/blog/rss-parse.sh
new file mode 100755
index 0000000..9f635d4
--- /dev/null
+++ b/scripts/archive/blog/rss-parse.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+[ ! -f "$1" ] &&
+ echo "Give \`sup\` a page which has been added/updated." &&
+ exit 1
+
+website="https://domain.com"
+rssfile="../rss/blog.xml"
+replchar='^'
+
+link="$website/$1"
+title="$(sed -n 's/<title>\(.*\)<\/title>/\1/Ip' "$1")"
+
+if grep -q "<guid.*>$link</guid>" "$rssfile"; then
+ guid="$link#$(date '+%y%m%d%H%M%S')"
+ title="$title (Updated)"
+ echo "Explain the nature of the update:"
+ read -r content
+ [ -z "$content" ] && content="New updates to $link"
+else
+
+ guid=$link
+ content="$(tr '\n' $replchar < "$1" | sed "
+ s/.*<body>//
+ s/<footer>.*<\/footer>//
+ s/<nav>.*<\/nav>//
+ s/<\/body>.*//
+ " | tr -s $replchar '\n')"
+fi
+
+rssdate="$(LC_TIME=en_US date '+%a, %d %b %Y %H:%M:%S %z')"
+
+temp="$(mktemp)";
+trap 'rm -f "$temp"' 0 1 2 3 15
+echo "
+<item>
+<title>$title</title>
+<guid>$guid</guid>
+<link>$link</link>
+<pubDate>$rssdate</pubDate>
+<description><![CDATA[$content
+]]></description>
+</item>
+" > "$temp"
+
+sed -i "/<!-- rss -->/r $temp" "$rssfile"
diff --git a/scripts/stat/internet b/scripts/stat/internet
new file mode 100755
index 0000000..a23d2cd
--- /dev/null
+++ b/scripts/stat/internet
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+if grep -qx 'up' /sys/class/net/wlan0/operstate 2>/dev/null; then
+ awk '/^\s*w/ { print int($3 * 100 / 70) "%" }' /proc/net/wireless
+else
+ echo "X"
+fi
diff --git a/scripts/stat/news b/scripts/stat/news
new file mode 100755
index 0000000..f96bbea
--- /dev/null
+++ b/scripts/stat/news
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+ps -e | grep "newsboat" >/dev/null && echo "X" || newsboat -x print-unread | grep -Eo '[0-9]{1,10}'
diff --git a/scripts/stat/ram.sh b/scripts/stat/ram.sh
new file mode 100755
index 0000000..2ef1be1
--- /dev/null
+++ b/scripts/stat/ram.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+free -m | awk 'NR==2{printf "%.2f%%", $3*100/$2 }'
diff --git a/scripts/stat/vol-stat b/scripts/stat/vol-stat
new file mode 100755
index 0000000..2b15ef6
--- /dev/null
+++ b/scripts/stat/vol-stat
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+perc=$(awk -F"[][]" '/Front Left/ { print $2 }' <(amixer sget Master) | tail -n +2)
+
+case $(awk -F"[][]" '/Front Left/ { print $4 }' <(amixer sget Master) | tail -n +2) in
+ "on")
+ echo "$perc/1"
+ ;;
+ "off")
+ echo "$perc/0"
+ ;;
+esac
diff --git a/scripts/util/afk.sh b/scripts/util/afk.sh
new file mode 100755
index 0000000..34d1226
--- /dev/null
+++ b/scripts/util/afk.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Prevent screen from sleeping or trick websites to think you're present while afk
+
+dzen_opts="-bg white -fg black -p 1 -x -475 -y 50 -w 475 -h 50"
+message="Away from keyboard for ~$1 minutes"
+
+while true; do
+ for direction in "10 0" "0 10" "-10 0" "0 -10"; do # move around
+ xdotool mousemove_relative -- $direction
+ printf '%s\n' "$message" | dzen2 $dzen_opts
+ done
+
+ xdotool mousemove 2880 540 # someplace near the middle
+done
+
+rm "$PID_FILE"
diff --git a/scripts/util/arcc b/scripts/util/arcc
new file mode 100755
index 0000000..7bb25e7
--- /dev/null
+++ b/scripts/util/arcc
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+if df | grep -q aa && df | grep -q arc ; then
+ sudo umount ~/Digital/Drives/D2
+ sudo cryptsetup close /dev/mapper/arc &&
+
+ sudo umount ~/Digital/Drives/ED
+ sudo cryptsetup close /dev/mapper/aa
+ else
+ echo "Error: Drive not mounted.";
+fi
diff --git a/scripts/util/arco b/scripts/util/arco
new file mode 100755
index 0000000..2d93661
--- /dev/null
+++ b/scripts/util/arco
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+if lsblk | grep -q sdc && lsblk | grep -q sdb ; then
+ sudo cryptsetup open /dev/sdb arc
+ sudo mount /dev/mapper/arc ~/Digital/Drives/D2 -o compress-force &&
+
+ sudo cryptsetup open /dev/sdc aa
+ sudo mount /dev/mapper/aa ~/Digital/Drives/ED
+else
+ echo "Error: Drive not mounted.";
+fi
diff --git a/scripts/util/assets/accents.txt b/scripts/util/assets/accents.txt
new file mode 100644
index 0000000..7ab76a8
--- /dev/null
+++ b/scripts/util/assets/accents.txt
@@ -0,0 +1,40 @@
+# Vowels:
+À (capital A with grave accent)
+à (lowercase a with grave accent)
+Â (capital A with circumflex accent)
+â (lowercase a with circumflex accent)
+Ä (capital A with diaeresis/umlaut)
+ä (lowercase a with diaeresis/umlaut)
+É (capital E with acute accent)
+é (lowercase e with acute accent)
+È (capital E with grave accent)
+è (lowercase e with grave accent)
+Ê (capital E with circumflex accent)
+ê (lowercase e with circumflex accent)
+Ë (capital E with diaeresis/umlaut)
+ë (lowercase e with diaeresis/umlaut)
+Î (capital I with circumflex accent)
+î (lowercase i with circumflex accent)
+Ï (capital I with diaeresis/umlaut)
+ï (lowercase i with diaeresis/umlaut)
+Ô (capital O with circumflex accent)
+ô (lowercase o with circumflex accent)
+Ù (capital U with grave accent)
+ù (lowercase u with grave accent)
+Û (capital U with circumflex accent)
+û (lowercase u with circumflex accent)
+Ü (capital U with diaeresis/umlaut)
+ü (lowercase u with diaeresis/umlaut)
+Ÿ (capital Y with diaeresis/umlaut)
+ÿ (lowercase y with diaeresis/umlaut)
+
+# Ligatures:
+Æ (capital AE ligature)
+æ (lowercase ae ligature)
+Œ (capital OE ligature)
+œ (lowercase oe ligature)
+
+Other:
+Ç (capital C with cedilla)
+ç (lowercase c with cedilla)
+ß (eszett or sharp S, used in German but occasionally found in French)
diff --git a/scripts/util/blue b/scripts/util/blue
new file mode 100755
index 0000000..14675b3
--- /dev/null
+++ b/scripts/util/blue
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+case "$(printf " connect\n disconnect" | dmenu -i -p 'Connect or Disconnect')" in
+ ' connect') case "$(printf " crusher\n " | dmenu -i -p 'Connect a Device')" in
+ ' crusher' ) bluetoothctl agent on ; bluetoothctl default-agent ; bluetoothctl power on ; bluetoothctl trust 38:F3:2E:BC:D1:F2 ; bluetoothctl connect 38:F3:2E:BC:D1:F2 ;;
+ esac ;;
+ ' disconnect') bluetoothctl disconnect ;;
+ *) exit 1 ;;
+esac
diff --git a/scripts/util/bmark.sh b/scripts/util/bmark.sh
new file mode 100755
index 0000000..466414c
--- /dev/null
+++ b/scripts/util/bmark.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+xdotool type $(grep -v '^#' ~/.local/share/bmark/bmarks.txt | dmenu -i -l 30 | cut -d' ' -f1)
diff --git a/scripts/util/croc.sh b/scripts/util/croc.sh
new file mode 100755
index 0000000..ae7efbd
--- /dev/null
+++ b/scripts/util/croc.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+nmcli c show --active | grep -q "wg-mullvad" 2>>/dev/null && read -p "VPN is active. Contine? [Y/n] " ON || echo "VPN is off, aborting."; break ;
+
+case $ON in
+ [Yy]* ) croc $1;
+esac
diff --git a/scripts/util/dic b/scripts/util/dic
new file mode 100755
index 0000000..58755a8
--- /dev/null
+++ b/scripts/util/dic
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Online CLI dictionary
+
+curl -s https://www.wordnik.com/words/"$1" | awk '/id="define/{p=1}p' | awk '/div/{p++}p==2' | sed -e 's/<[^>]*>//g' | sed 's/^ *$//g' | expand --tabs=1 | less
diff --git a/scripts/util/dupt.sh b/scripts/util/dupt.sh
new file mode 100755
index 0000000..61d2260
--- /dev/null
+++ b/scripts/util/dupt.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# open a new terminal in the current working directory
+
+st -e sh -c 'cd "$PWD" && exec $SHELL' >/dev/null 2>&1 &
diff --git a/scripts/util/fcd.sh b/scripts/util/fcd.sh
new file mode 100755
index 0000000..09c1e50
--- /dev/null
+++ b/scripts/util/fcd.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# CD into chosen directory, otherwise terminate
+
+fcd() {
+ cd "$(fd -t d -E Digital/D1 -E /home/black/Games | fzf --reverse || exit)"
+}
+
+fcd
+
+if [ $? -eq 0 ]; then
+ exec "$SHELL" #-i
+fi
diff --git a/scripts/util/fr-acc.sh b/scripts/util/fr-acc.sh
new file mode 100755
index 0000000..ef5f301
--- /dev/null
+++ b/scripts/util/fr-acc.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+selected=$(grep -v '^#' ~/.local/share/scripts/accents.txt | dmenu -i -l 30 | cut -d' ' -f1)
+echo -n "$selected" | xclip -selection clipboard
+printf '%s\n' "$selected has been copied to the clipboard." | dzen2 -bg white -fg black -p 2 -x -475 -y 50 -w 475 -h 50
diff --git a/scripts/util/gtab_init.sh b/scripts/util/gtab_init.sh
new file mode 100755
index 0000000..76284d9
--- /dev/null
+++ b/scripts/util/gtab_init.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+pad_id=$(xinput | grep "HID 256c:006d Pad pad" | cut -f 2 | cut -d '=' -f 2)
+stylus_id=$(xinput | grep "HID 256c:006d Pen stylus" | cut -f 2 | cut -d '=' -f 2)
+
+# Clear
+xsetwacom set $pad_id Button 1 "key + "
+xsetwacom set $pad_id Button 2 "key + "
+xsetwacom set $pad_id Button 3 "key + "
+xsetwacom set $pad_id Button 8 "key + "
+xsetwacom set $pad_id Button 9 "key + "
+xsetwacom set $pad_id Button 10 "key + "
+xsetwacom set $pad_id Button 11 "key + "
+xsetwacom set $pad_id Button 12 "key + "
+
+# Set
+xsetwacom --set $pad_id Button 1 "key +ctrl z -ctrl"
+xsetwacom --set $pad_id Button 2 "key +ctrl s -ctrl"
+xsetwacom --set $pad_id Button 9 "key +ctrl shift p -ctrl"
+xsetwacom --set $pad_id Button 10 "key +ctrl shift e -ctrl"
+xsetwacom --set $pad_id Button 11 "key +ctrl shift a -ctrl"
+xsetwacom --set $pad_id Button 12 "key +ctrl shift r -ctrl"
+
+xsetwacom set $stylus_id MapToOutput $1
diff --git a/scripts/util/hist.sh b/scripts/util/hist.sh
new file mode 100755
index 0000000..e95a0f9
--- /dev/null
+++ b/scripts/util/hist.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+$(cat ~/.bash_history | fzf)
diff --git a/scripts/util/killpid.sh b/scripts/util/killpid.sh
new file mode 100755
index 0000000..34a738a
--- /dev/null
+++ b/scripts/util/killpid.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+ps -aux | fzf | awk '{print $2}' | xargs -r kill
diff --git a/scripts/util/manfzf.sh b/scripts/util/manfzf.sh
new file mode 100755
index 0000000..aa25d11
--- /dev/null
+++ b/scripts/util/manfzf.sh
@@ -0,0 +1,13 @@
+# Man without options will use fzf to select a page
+function fzf-man(){
+ MAN="/usr/bin/man"
+ if [ -n "$1" ]; then
+ $MAN "$@"
+ return $?
+ else
+ $MAN -k . | fzf --reverse --preview="echo {1,2} | sed 's/ (/./' | sed -E 's/\)\s*$//' | xargs $MAN" | awk '{print $1 "." $2}' | tr -d '()' | xargs -r $MAN
+ return $?
+ fi
+}
+
+fzf-man
diff --git a/scripts/util/netsel.sh b/scripts/util/netsel.sh
new file mode 100755
index 0000000..b1b2a88
--- /dev/null
+++ b/scripts/util/netsel.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+BSSID=$(printf "%s" "$(nmcli d wifi | fzf --height 40%)" | sed 's/\*//' | awk '{print $1}')
+#read -sp "Enter password for $BSSID: " PASSWORD
+
+nmcli d wifi connect $BSSID #password "$PASSWORD"
diff --git a/scripts/util/open_1 b/scripts/util/open_1
new file mode 100755
index 0000000..58c8efc
--- /dev/null
+++ b/scripts/util/open_1
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+sudo cryptsetup open /dev/sda1 one
+
+sudo mount /dev/mapper/one ~/Digital/Drives/D1 -o compress-force
diff --git a/scripts/util/passmen.sh b/scripts/util/passmen.sh
new file mode 100755
index 0000000..d2d9cf8
--- /dev/null
+++ b/scripts/util/passmen.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+accnts=$(pass | sed '1d; s/^[^ ]* //' | sed 's/\x1B\[[0-9;]*[a-zA-Z]//g')
+selected=$(printf '%s\n' "${accnts}" | dmenu -l 10 -p "Select an account:")
+
+pass show "$selected" | xclip -selection clipboard | printf '%s\n' "Password for $selected has been copied!" | dzen2 -p 1 -bg white -fg black -x -375 -y 50 -w 475 -h 50
diff --git a/scripts/util/pgen.sh b/scripts/util/pgen.sh
new file mode 100755
index 0000000..f3a7976
--- /dev/null
+++ b/scripts/util/pgen.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# A pseudorandom password generator
+
+LEN=16 # default length
+SYMBOLS=true
+
+gen_psw() {
+ local len=$1
+ local symbols=$2
+ local charset="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+
+ [[ $symbols == true ]] && charset="${charset}!@#$%^&*()_+{}|:<>?"
+
+ psw=$(< /dev/urandom tr -dc "$charset" | head -c "$len")
+ echo "$psw"
+}
+
+while [[ "$#" -gt 0 ]]; do
+ case $1 in
+ -l|--length) LEN="$2"; shift ;;
+ -ns|--no-symbols) SYMBOLS=false ;;
+ *) echo "Unknown flag: $1"; exit 1 ;;
+ esac
+ shift
+done
+
+PASSWORD=$(gen_psw "$LEN" "$SYMBOLS")
+echo "$PASSWORD"
+
+if command -v xclip &> /dev/null; then
+ echo -n "$PASSWORD" | xclip -selection clipboard
+ printf '%s\n' "Password has been copied." | dzen2 -p 1 -bg white -fg black -x -305 -y 50 -w 455 -h 50
+fi
diff --git a/scripts/util/power b/scripts/util/power
new file mode 100755
index 0000000..ce9a8f5
--- /dev/null
+++ b/scripts/util/power
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+
+case "$(readlink -f /sbin/init)" in
+ *systemd*) ctl='systemctl' ;;
+ *) ctl='loginctl' ;;
+esac
+
+case "$(printf " reboot\n shutdown\n sleep\n lock\n kill dwm\n" | dmenu -i -p 'Action: ')" in
+ ' lock') slock ;;
+ ' leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;;
+ ' sleep') slock $ctl suspend ;;
+ ' reboot') /bin/reboot ;;
+ ' shutdown') /bin/shutdown -h now ;;
+ *) exit 1 ;;
+esac
diff --git a/scripts/util/prompt b/scripts/util/prompt
new file mode 100755
index 0000000..75eccc5
--- /dev/null
+++ b/scripts/util/prompt
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+case "$(printf " power\n bluetooth\n network\n " | dmenu -i -p 'Run a Dmenu script:')" in
+ ' power') /bin/power ;;
+ ' bluetooth') /bin/blue ;;
+ ' network') /bin/network ;;
+ *) exit 1 ;;
+esac
diff --git a/scripts/util/sc.sh b/scripts/util/sc.sh
new file mode 100755
index 0000000..9557e34
--- /dev/null
+++ b/scripts/util/sc.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+maim -s -m 10 | tee ~/Digital/Pictures/Screen\ Shots/$(date +%Y-%m-%d__%S%S).jpg | xclip -selection clipboard -t image/png
diff --git a/scripts/util/sp.sh b/scripts/util/sp.sh
new file mode 100755
index 0000000..b4ce819
--- /dev/null
+++ b/scripts/util/sp.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# pacman wrapper
+
+case $* in
+ -Syu ) sudo pacman -Syu
+ echo 0 > ~/.local/share/updates.txt ;;
+ -Syyu ) sudo pacman -Syyu
+ echo 0 > ~/.local/share/updates.txt ;;
+ * ) sudo pacman ;;
+esac
diff --git a/scripts/util/update-web.sh b/scripts/util/update-web.sh
new file mode 100755
index 0000000..cda3e92
--- /dev/null
+++ b/scripts/util/update-web.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+
+SITE=$(printf "$(ls ~/Dev/website)" | dmenu -i -p "Pick a site to update");
+rsync -uvrp --delete-after ~/Dev/website/"$SITE"/ root@nagy.contact:/var/www/"$SITE"/
+printf "Updating: $SITE\n" | dzen2 -bg white -fg black -p 2 -x -375 -y 50 -w 275 -h 50
diff --git a/scripts/util/vol b/scripts/util/vol
new file mode 100755
index 0000000..1aa82c0
--- /dev/null
+++ b/scripts/util/vol
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+ mute_state=$(amixer -c 3 get 'Master',0 | grep -o '\[on\]')
+
+ if [[ $mute_state == "[on]" ]]; then
+ amixer -c 3 set 'Master',0 mute
+ printf '%s\n' "Volume: Off" | dzen2 -p 1 -bg white -fg black -x -375 -y 50 -w 275 -h 50
+ amixer -c 3 set 'Headphone',0 mute
+ else
+ amixer -c 3 set 'Master',0 unmute
+ amixer -c 3 set 'Headphone',0 unmute
+ printf '%s\n' "Volume: On" | dzen2 -p 1 -bg white -fg black -x -375 -y 50 -w 275 -h 50
+ fi
+
+
+#amixer -D pulse sset Master toggle
+#state=$(amixer -D pulse sget Master | grep 'Front Left:' | sed -E 's/.*\[([a-z]+)\].*/\1/')
+#printf 'Volume %s\n' "$state" | dzen2 -p 1 -bg white -fg black -x -375 -y 50 -w 275 -h 50
+# amixer set Master toggle ; a="$(awk -F"[][]" '/Front Left/ { print $4 }' <(amixer sget Master) | tail -n +2)"; printf '%s\n' "Volume: $a" | dzen2 -p 1 -bg white -fg black -x -375 -y 50 -w 275 -h 50
diff --git a/scripts/util/vol+ b/scripts/util/vol+
new file mode 100755
index 0000000..89c8fcb
--- /dev/null
+++ b/scripts/util/vol+
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+MASTER_SINK=$(pactl list short sinks | grep "RUNNING" | awk '{print $1}')
+if [ $# -eq 0 ]
+then
+ pactl set-sink-volume $MASTER_SINK +5%
+else
+ pactl set-sink-volume $MASTER_SINK +$@%
+fi
+level=$(pactl list sinks | grep -E "RUNNING|Volume" | grep -A1 "RUNNING" | grep -E -o "[[:digit:]]{1,5}%" | head -n1)
+printf '%s\n' "Vol $(echo $level)" | dzen2 -p 1 -bg white -fg black -x -375 -y 50 -w 275 -h 50
+
+#amixer -D pulse sset Master -c 3 5%+
+#level=$(amixer -D pulse sget Master -c 3 | sed -n 's/^[^[]*\[\([0-9]*%\)\].*$/\1/p')
+#3printf '%s\n' "Vol $(echo $level)" | dzen2 -p 1 -bg white -fg black -x -375 -y 50 -w 275 -h 50
+
+#amixer set Master -c 3 5%+ > /dev/null 2>&1 ; a="$()" ; printf '%s\n' "Vol $(amixer -c 3 sget Master | awk -F'[][]' '/Mono: Playback/ {print $2}')" | dzen2 -p 1 -bg white -fg black -x -375 -y 50 -w 275 -h 50
diff --git a/scripts/util/vol- b/scripts/util/vol-
new file mode 100755
index 0000000..c2c2f9c
--- /dev/null
+++ b/scripts/util/vol-
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+
+MASTER_SINK=$(pactl list short sinks | grep "RUNNING" | awk '{print $1}')
+if [ $# -eq 0 ]
+then
+ pactl set-sink-volume $MASTER_SINK -5%
+else
+ pactl set-sink-volume $MASTER_SINK -$@%
+fi
+
+level=$(pactl list sinks | grep -E "RUNNING|Volume" | grep -A1 "RUNNING" | grep -E -o "[[:digit:]]{1,5}%" | head -n1)
+printf '%s\n' "Vol $(echo $level)" | dzen2 -p 1 -bg white -fg black -x -375 -y 50 -w 275 -h 50
+
+
+#amixer -D pulse sset Master -c 3 5%-
+
+#level=$(amixer -D pulse sget Master -c 3 | grep 'Front Left:' | sed -E 's/.*\[([0-9]+%)\].*/\1/')
+#level=$(amixer -D pulse sget Master -c 3 | sed -n 's/^[^[]*\[\([0-9]*%\)\].*$/\1/p')
+#printf '%s\n' "Vol $(echo $level)" | dzen2 -p 1 -bg white -fg black -x -375 -y 50 -w 275 -h 50
+
+#amixer set Master -c 2 5%- > /dev/null 2>&1 ; a="$()" ; printf '%s\n' "Vol $(amixer -c 2 sget Master | awk -F'[][]' '/Mono: Playback/ {print $2}')" | dzen2 -p 1 -bg white -fg black -x -375 -y 50 -w 275 -h 50
diff --git a/scripts/util/vpn.sh b/scripts/util/vpn.sh
new file mode 100755
index 0000000..b994e5a
--- /dev/null
+++ b/scripts/util/vpn.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+vpn_stat()
+{
+ stat=$(mullvad status)
+
+ if echo "$stat" | grep -q "Disconnected"; then
+ echo 0
+ elif echo "$stat" | grep -q "Connected"; then
+ echo 1
+ elif echo "$stat" | grep -q "Connecting"; then
+ echo "Connecting"
+ else
+ echo "Unkown Status"
+ fi
+}
+
+vpn_stat_verbose()
+{
+ mullvad status
+}
+
+rand_conn()
+{
+relays=$(mullvad relay list | awk 'NR>1 {gsub(/[()]/, "", $2); print $1 "-" $2}' | grep -v '^-$')
+
+ if [ -z "$relays" ]; then
+ echo "No valid relays found."
+ return 1
+ fi
+
+ random_relay=$(echo "$relays" | shuf -n 1)
+
+ country=$(echo "$random_relay" | cut -d'-' -f1)
+ city=$(echo "$random_relay" | cut -d'-' -f2)
+
+ mullvad relay set location $country $city
+ mullvad connect
+ echo "Connected to $country $city"
+}
+
+
+
+if [ "$#" -eq 0 ] || [ "$1" = "-s" ]; then
+ if [ "$#" -eq 2 ] && [ "$2" = "-v" ]; then
+ vpn_stat_verbose
+ else
+ vpn_stat
+ fi
+elif [ "$1" = "-c" ]; then
+ if [ "$2" = "--rand" ]; then
+ rand_conn
+ elif [ "$#" -eq 3 ]; then
+ country=$2
+ city=$3
+ mullvad relay set location $country $city
+ mullvad connect
+ echo "Connected to $country $city"
+ else
+ echo "Invalid usage. Use ./vpn.sh -c [country] [city] or ./vpn.sh -c --rand"
+ exit 1
+ fi
+fi