summaryrefslogtreecommitdiffstats
path: root/.local/bin/tools
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2019-05-19 20:05:14 -0400
committerLuke Smith <luke@lukesmith.xyz>2019-05-19 20:05:14 -0400
commitc6e69e96421ebf192eb6de537324e269e7bfda78 (patch)
tree47d34a5ff72d65be9a3e2c6aeb55a88da3a6fbd2 /.local/bin/tools
parentbf8c6b1e20f42a7725d8d919830fdb274596b20f (diff)
downloadeibhear-c6e69e96421ebf192eb6de537324e269e7bfda78.tar.gz
eibhear-c6e69e96421ebf192eb6de537324e269e7bfda78.tar.zst
eibhear-c6e69e96421ebf192eb6de537324e269e7bfda78.zip
massive cleanup
Diffstat (limited to '.local/bin/tools')
-rwxr-xr-x.local/bin/tools/compiler37
-rwxr-xr-x.local/bin/tools/dmenuhandler15
-rwxr-xr-x.local/bin/tools/dmenupass2
l---------.local/bin/tools/ext1
-rwxr-xr-x.local/bin/tools/extract41
-rwxr-xr-x.local/bin/tools/getbib14
-rwxr-xr-x.local/bin/tools/getkeys4
-rwxr-xr-x.local/bin/tools/ifinstalled3
-rwxr-xr-x.local/bin/tools/linkhandler22
-rwxr-xr-x.local/bin/tools/lmc42
-rwxr-xr-x.local/bin/tools/opout11
-rwxr-xr-x.local/bin/tools/pauseallmpv4
-rwxr-xr-x.local/bin/tools/podentr6
-rwxr-xr-x.local/bin/tools/qndl11
-rwxr-xr-x.local/bin/tools/queueandnotify13
-rwxr-xr-x.local/bin/tools/remaps10
-rwxr-xr-x.local/bin/tools/rotdir4
-rwxr-xr-x.local/bin/tools/rssadd9
-rwxr-xr-x.local/bin/tools/setbg4
-rwxr-xr-x.local/bin/tools/shortcuts26
-rwxr-xr-x.local/bin/tools/texclear14
-rwxr-xr-x.local/bin/tools/transadd9
22 files changed, 0 insertions, 302 deletions
diff --git a/.local/bin/tools/compiler b/.local/bin/tools/compiler
deleted file mode 100755
index 7d3bf1d..0000000
--- a/.local/bin/tools/compiler
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-# This script will compile or run another finishing operation on a document. I
-# have this script run via vim.
-#
-# Compiles .tex. groff (.mom, .ms), .rmd, .md.
-# Opens .sent files as sent presentations.
-# Runs scripts based on extention or shebang
-
-file=$(readlink -f "$1")
-dir=$(dirname "$file")
-base="${file%.*}"
-
-cd "$dir" || exit
-
-textype() { \
- command="pdflatex"
- ( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex"
- $command --output-directory="$dir" "$base" &&
- grep -i addbibresource "$file" >/dev/null &&
- biber --input-directory "$dir" "$base" &&
- $command --output-directory="$dir" "$base" &&
- $command --output-directory="$dir" "$base"
- }
-
-case "$file" in
- *\.ms) refer -PS -e "$file" | groff -me -ms -kejpt -T pdf > "$base".pdf ;;
- *\.mom) refer -PS -e "$file" | groff -mom -kejpt -T pdf > "$base".pdf ;;
- *\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;;
- *\.tex) textype "$file" ;;
- *\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;;
- *config.h) sudo make install ;;
- *\.c) cc "$file" -o "$base" && "$base" ;;
- *\.py) python "$file" ;;
- *\.go) go run "$file" ;;
- *\.sent) setsid sent "$file" 2>/dev/null & ;;
- *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
-esac
diff --git a/.local/bin/tools/dmenuhandler b/.local/bin/tools/dmenuhandler
deleted file mode 100755
index 391bdc1..0000000
--- a/.local/bin/tools/dmenuhandler
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-# Feed this script a link and it will give dmenu
-# some choice programs to use to open it.
-
-case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in
- "copy url") echo "$1" | xclip -selection clipboard ;;
- mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;;
- "mpv (loop)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet --loop "$1" >/dev/null 2>&1 & ;;
- "queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;;
- "queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;;
- browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;;
- feh) setsid feh "$1" >/dev/null 2>&1 & ;;
- w3m) w3m "$1" >/dev/null 2>&1 ;;
- "mpv (float)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;;
-esac
diff --git a/.local/bin/tools/dmenupass b/.local/bin/tools/dmenupass
deleted file mode 100755
index 4fc464f..0000000
--- a/.local/bin/tools/dmenupass
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-dmenu -fn Monospace-18 -sb "#d79921" -sf "#1d2021" -nf "#000000" -nb "#000000" -p "$1" <&- && echo
diff --git a/.local/bin/tools/ext b/.local/bin/tools/ext
deleted file mode 120000
index 562d2b3..0000000
--- a/.local/bin/tools/ext
+++ /dev/null
@@ -1 +0,0 @@
-extract \ No newline at end of file
diff --git a/.local/bin/tools/extract b/.local/bin/tools/extract
deleted file mode 100755
index a63ab10..0000000
--- a/.local/bin/tools/extract
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-# A general, all-purpose extraction script.
-#
-# Default behavior: Extract archive into new directory
-# Behavior with `-c` option: Extract contents into current directory
-
-while getopts "hc" o; do case "${o}" in
- c) extracthere="True" ;;
- *) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit ;;
-esac done
-
-if [ -z "$extracthere" ]; then
- archive="$(readlink -f "$*")" &&
- directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" &&
- mkdir -p "$directory" &&
- cd "$directory" || exit
-else
- archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)")"
-fi
-
-[ "$archive" = "" ] && printf "Give archive to extract as argument.\\n" && exit
-
-if [ -f "$archive" ] ; then
- case "$archive" in
- *.tar.bz2|*.tar.xz|*.tbz2) tar xvjf "$archive" ;;
- *.tar.gz|*.tgz) tar xvzf "$archive" ;;
- *.lzma) unlzma "$archive" ;;
- *.bz2) bunzip2 "$archive" ;;
- *.rar) unrar x -ad "$archive" ;;
- *.gz) gunzip "$archive" ;;
- *.tar) tar xvf "$archive" ;;
- *.zip) unzip "$archive" ;;
- *.Z) uncompress "$archive" ;;
- *.7z) 7z x "$archive" ;;
- *.xz) unxz "$archive" ;;
- *.exe) cabextract "$archive" ;;
- *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;;
- esac
-else
- printf "File \"%s\" not found.\\n" "$archive"
-fi
diff --git a/.local/bin/tools/getbib b/.local/bin/tools/getbib
deleted file mode 100755
index ed441c5..0000000
--- a/.local/bin/tools/getbib
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
-
-if [ -f "$1" ]; then
- # Try to get DOI from pdfinfo or pdftotext output.
- doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
- doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) ||
- exit 1
-else
- doi="$1"
-fi
-
-# Check crossref.org for the bib citation.
-curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n"
diff --git a/.local/bin/tools/getkeys b/.local/bin/tools/getkeys
deleted file mode 100755
index 444f4c0..0000000
--- a/.local/bin/tools/getkeys
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-cat ~/.config/getkeys/"$1" 2>/dev/null && exit
-echo "Run command with one of the following arguments for info about that program:"
-ls ~/.config/getkeys
diff --git a/.local/bin/tools/ifinstalled b/.local/bin/tools/ifinstalled
deleted file mode 100755
index b0d23e5..0000000
--- a/.local/bin/tools/ifinstalled
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-# If $1 command is not available, error code and notify.
-command -v "$1" >/dev/null || { notify-send "📦 $1" "must be installed for this function." && exit 1 ;}
diff --git a/.local/bin/tools/linkhandler b/.local/bin/tools/linkhandler
deleted file mode 100755
index c616d04..0000000
--- a/.local/bin/tools/linkhandler
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-# Feed script a url or file location.
-# If an image, it will view in sxiv,
-# if a video or gif, it will view in mpv
-# if a music file or pdf, it will download,
-# otherwise it opens link in browser.
-
-# If no url given. Opens browser. For using script as $BROWSER.
-[ -z "$1" ] && { "$BROWSER"; exit; }
-
-case "$1" in
- *mkv|*webm|*mp4|*youtube.com*|*youtu.be*|*hooktube.com*|*bitchute.com*)
- setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;;
- *png|*jpg|*jpe|*jpeg|*gif)
- curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
- *mp3|*flac|*opus|*mp3?source*)
- setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;;
- *)
- if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1"
- else setsid "$BROWSER" "$1" >/dev/null 2>&1 & fi ;;
-esac
diff --git a/.local/bin/tools/lmc b/.local/bin/tools/lmc
deleted file mode 100755
index 18cf2c2..0000000
--- a/.local/bin/tools/lmc
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-# A general audio interface for LARBS.
-
-[ -z "$2" ] && num="2" || num="$2"
-
-case "$1" in
- u*) pulsemixer --change-volume +"$num" ;;
- d*) pulsemixer --change-volume -"$num" ;;
- m*) pulsemixer --toggle-mute ;;
- truemute) pulsemixer --mute ;;
- play) mpc play ;;
- n*) mpc next ;;
- prev) mpc prev ;;
- t*) mpc toggle ;;
- p*) mpc pause ; pauseallmpv ;;
- f*) mpc seek +"$num" ;;
- b*) mpc seek -"$num" ;;
- r*) mpc seek 0% ;;
- *) cat << EOF
-lmc: cli music interface for mpd and pulse for those with divine intellect too
-grand to remember the mpc/pamixer commands.
-
-Allowed options:
- up NUM Increase volume (2 secs default)
- down NUM Decrease volume (2 secs default)
- mute Toggle mute
- truemute Mute
- next Next track
- prev Previous track
- toggle Toggle pause
- truepause Pause
- foward NUM Seek foward in song (2 secs default)
- back NUM Seek back in song (2 secs default)
- restart Restart current song
- all else Print this message
-
-All of these commands, except for \`truemute\`, \`prev\` and \`play\` can be truncated,
-i.e. \`lmc r\` for \`lmc restart\`.
-EOF
-esac
-
-pkill -RTMIN+10 i3blocks
diff --git a/.local/bin/tools/opout b/.local/bin/tools/opout
deleted file mode 100755
index c742aa9..0000000
--- a/.local/bin/tools/opout
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-# opout: "open output": A general handler for opening a file's intended output.
-# I find this useful especially running from vim.
-
-basename="$(echo "$1" | sed 's/\.[^\/.]*$//')"
-
-case "$1" in
- *.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$READER" "$basename".pdf >/dev/null 2>&1 & ;;
- *.html) setsid "$BROWSER" --new-window "$basename".html >/dev/null 2>&1 & ;;
- *.sent) setsid sent "$1" >/dev/null 2>&1 & ;;
-esac
diff --git a/.local/bin/tools/pauseallmpv b/.local/bin/tools/pauseallmpv
deleted file mode 100755
index c5da220..0000000
--- a/.local/bin/tools/pauseallmpv
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-for i in $(ls /tmp/mpvsoc*); do
- echo '{ "command": ["set_property", "pause", true] }' | socat - $i;
-done
diff --git a/.local/bin/tools/podentr b/.local/bin/tools/podentr
deleted file mode 100755
index 13ab4a8..0000000
--- a/.local/bin/tools/podentr
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-# entr command to run `queueandnotify` when newsboat queue is changed
-
-[ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit
-
-echo ~/.local/share/newsboat/queue | entr -p queueandnotify 2>/dev/null
diff --git a/.local/bin/tools/qndl b/.local/bin/tools/qndl
deleted file mode 100755
index a99d37e..0000000
--- a/.local/bin/tools/qndl
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-# $1 is a url; $2 is a command
-[ -z "$1" ] && exit
-base="$(basename "$1")"
-notify-send "⏳ Queuing $base..."
-cmd="$2"
-[ -z "$cmd" ] && cmd="youtube-dl --add-metadata"
-idnum="$(tsp $cmd "$1")"
-realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")"
-tsp -D "$idnum" mv "$base" "$realname"
-tsp -D "$idnum" notify-send "👍 $realname done."
diff --git a/.local/bin/tools/queueandnotify b/.local/bin/tools/queueandnotify
deleted file mode 100755
index a1417ec..0000000
--- a/.local/bin/tools/queueandnotify
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-# Podboat sucks. This script replaces it.
-# It reads the newsboat queue, queuing downloads with taskspooler.
-# It also removes the junk from extentions.
-queuefile="$HOME/.local/share/newsboat/queue"
-
-while read -r line; do
- [ -z "$line" ] && continue
- url="$(echo "$line" | awk '{print $1}')"
- qndl "$url" "curl -LO"
-done < "$queuefile"
-
-echo > "$queuefile"
diff --git a/.local/bin/tools/remaps b/.local/bin/tools/remaps
deleted file mode 100755
index df7d6c9..0000000
--- a/.local/bin/tools/remaps
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-# This script is called by i3 on startup to remap keys.
-# Increase key speed via a rate change
-xset r rate 300 50
-# Map the caps lock key to super...
-setxkbmap -option caps:super
-# But when it is pressed only once, treat it as escape.
-killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
-# Map the menu button to right super as well.
-xmodmap -e 'keycode 135 = Super_R'
diff --git a/.local/bin/tools/rotdir b/.local/bin/tools/rotdir
deleted file mode 100755
index e7103db..0000000
--- a/.local/bin/tools/rotdir
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
-base="$(basename $1)"
- ls "$PWD" | awk "BEGIN { lines = \"\"; m = 0; } /^$base$/ { m = 1; } { if (!m) { if (lines) { lines = lines\"\n\"; } lines = lines\"\"\$0; } else { print \$0; } } END { print lines; }"
diff --git a/.local/bin/tools/rssadd b/.local/bin/tools/rssadd
deleted file mode 100755
index 8822fc5..0000000
--- a/.local/bin/tools/rssadd
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-! echo "$1" | grep "https*://\S\+\.[A-Za-z]\+\S*" >/dev/null &&
- notify-send "That doesn't look like a full URL." && exit
-RSSFILE="$HOME/.config/newsboat/urls"
-if awk '{print $1}' "$RSSFILE" | grep "^$1$" >/dev/null; then
- notify-send "You already have this RSS feed."
-else
- echo "$1" >> "$RSSFILE" && notify-send "RSS feed added."
-fi
diff --git a/.local/bin/tools/setbg b/.local/bin/tools/setbg
deleted file mode 100755
index 950ae7c..0000000
--- a/.local/bin/tools/setbg
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-# Sets the background. If given an argument, will set file as background.
-[ ! -z "$1" ] && cp "$1" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Wallpaper changed."
-xwallpaper --zoom ~/.config/wall.png
diff --git a/.local/bin/tools/shortcuts b/.local/bin/tools/shortcuts
deleted file mode 100755
index 1c4f278..0000000
--- a/.local/bin/tools/shortcuts
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-# Output locations. Unactivated progs should go to /dev/null.
-shell_shortcuts="$HOME/.config/shortcutrc"
-ranger_shortcuts="/dev/null"
-qute_shortcuts="/dev/null"
-fish_shortcuts="/dev/null"
-vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts"
-
-# Remove, prepare files
-rm -f "$ranger_shortcuts" "$qute_shortcuts" 2>/dev/null
-printf "# vim: filetype=sh\\n" > "$fish_shortcuts"
-printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
-printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
-
-# Format the `bmdirs` file in the correct syntax and sent it to all three configs.
-sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \
- >(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \
- >(awk '{print "map g" $1, ":cd", $2 "<CR>\nmap t" $1, "<tab>:cd", $2 "<CR><tab>\nmap M" $1, "<tab>:cd", $2 "<CR><tab>:mo<CR>\nmap Y" $1, "<tab>:cd", $2 "<CR><tab>:co<CR>" }' >> "$vifm_shortcuts") \
- >(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \
- | awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts"
-
-# Format the `configs` file in the correct syntax and sent it to both configs.
-sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
- >(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \
- >(awk '{print "map", $1, ":e", $2 "<CR>" }' >> "$vifm_shortcuts") \
- | awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts"
diff --git a/.local/bin/tools/texclear b/.local/bin/tools/texclear
deleted file mode 100755
index f6a5062..0000000
--- a/.local/bin/tools/texclear
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-# Clears the build files of a LaTeX/XeLaTeX build.
-# I have vim run this file whenever I exit a .tex file.
-
-case "$1" in
- *.tex)
- file=$(readlink -f "$1")
- dir=$(dirname "$file")
- base="${file%.*}"
- find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete ;;
- *) printf "Give .tex file as argument.\\n" ;;
-esac
-
diff --git a/.local/bin/tools/transadd b/.local/bin/tools/transadd
deleted file mode 100755
index ad2ee7f..0000000
--- a/.local/bin/tools/transadd
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running.
-
-# transmission-daemon sometimes fails to take remote requests in its first moments.
-
-pgrep -x transmission-da || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks)
-
-transmission-remote -a "$@" && notify-send "🔽 Torrent added."