diff options
| author | Luke Smith <luke@lukesmith.xyz> | 2019-05-18 00:07:32 -0400 |
|---|---|---|
| committer | Luke Smith <luke@lukesmith.xyz> | 2019-05-18 00:07:32 -0400 |
| commit | 54920103c2843f5a3620effbccaceaee7f6885c1 (patch) | |
| tree | 222aa8e75573364cd043382996f4798d94104f65 /.scripts/tools | |
| parent | 18e001db07d7105ab4dc4f4f836ca0d3a516a791 (diff) | |
| download | eibhear-54920103c2843f5a3620effbccaceaee7f6885c1.tar.gz eibhear-54920103c2843f5a3620effbccaceaee7f6885c1.tar.zst eibhear-54920103c2843f5a3620effbccaceaee7f6885c1.zip | |
scripts moved to ~/.local/bin
Diffstat (limited to '.scripts/tools')
| -rwxr-xr-x | .scripts/tools/compiler | 37 | ||||
| -rwxr-xr-x | .scripts/tools/dmenuhandler | 15 | ||||
| -rwxr-xr-x | .scripts/tools/dmenupass | 2 | ||||
| l--------- | .scripts/tools/ext | 1 | ||||
| -rwxr-xr-x | .scripts/tools/extract | 41 | ||||
| -rwxr-xr-x | .scripts/tools/getbib | 14 | ||||
| -rwxr-xr-x | .scripts/tools/getkeys | 4 | ||||
| -rwxr-xr-x | .scripts/tools/ifinstalled | 3 | ||||
| -rwxr-xr-x | .scripts/tools/linkhandler | 22 | ||||
| -rwxr-xr-x | .scripts/tools/lmc | 42 | ||||
| -rwxr-xr-x | .scripts/tools/opout | 11 | ||||
| -rwxr-xr-x | .scripts/tools/pauseallmpv | 4 | ||||
| -rwxr-xr-x | .scripts/tools/podentr | 6 | ||||
| -rwxr-xr-x | .scripts/tools/qndl | 11 | ||||
| -rwxr-xr-x | .scripts/tools/queueandnotify | 13 | ||||
| -rwxr-xr-x | .scripts/tools/remaps | 10 | ||||
| -rwxr-xr-x | .scripts/tools/rotdir | 4 | ||||
| -rwxr-xr-x | .scripts/tools/rssadd | 9 | ||||
| -rwxr-xr-x | .scripts/tools/setbg | 4 | ||||
| -rwxr-xr-x | .scripts/tools/shortcuts | 26 | ||||
| -rwxr-xr-x | .scripts/tools/texclear | 14 | ||||
| -rwxr-xr-x | .scripts/tools/transadd | 9 | ||||
| -rwxr-xr-x | .scripts/tools/vifmimg | 13 | ||||
| -rwxr-xr-x | .scripts/tools/vu | 15 |
24 files changed, 0 insertions, 330 deletions
diff --git a/.scripts/tools/compiler b/.scripts/tools/compiler deleted file mode 100755 index 7d3bf1d..0000000 --- a/.scripts/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/.scripts/tools/dmenuhandler b/.scripts/tools/dmenuhandler deleted file mode 100755 index 391bdc1..0000000 --- a/.scripts/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/.scripts/tools/dmenupass b/.scripts/tools/dmenupass deleted file mode 100755 index 4fc464f..0000000 --- a/.scripts/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/.scripts/tools/ext b/.scripts/tools/ext deleted file mode 120000 index 562d2b3..0000000 --- a/.scripts/tools/ext +++ /dev/null @@ -1 +0,0 @@ -extract
\ No newline at end of file diff --git a/.scripts/tools/extract b/.scripts/tools/extract deleted file mode 100755 index a63ab10..0000000 --- a/.scripts/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/.scripts/tools/getbib b/.scripts/tools/getbib deleted file mode 100755 index ed441c5..0000000 --- a/.scripts/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/.scripts/tools/getkeys b/.scripts/tools/getkeys deleted file mode 100755 index 444f4c0..0000000 --- a/.scripts/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/.scripts/tools/ifinstalled b/.scripts/tools/ifinstalled deleted file mode 100755 index b0d23e5..0000000 --- a/.scripts/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/.scripts/tools/linkhandler b/.scripts/tools/linkhandler deleted file mode 100755 index c616d04..0000000 --- a/.scripts/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/.scripts/tools/lmc b/.scripts/tools/lmc deleted file mode 100755 index 18cf2c2..0000000 --- a/.scripts/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/.scripts/tools/opout b/.scripts/tools/opout deleted file mode 100755 index c742aa9..0000000 --- a/.scripts/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/.scripts/tools/pauseallmpv b/.scripts/tools/pauseallmpv deleted file mode 100755 index c5da220..0000000 --- a/.scripts/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/.scripts/tools/podentr b/.scripts/tools/podentr deleted file mode 100755 index 13ab4a8..0000000 --- a/.scripts/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/.scripts/tools/qndl b/.scripts/tools/qndl deleted file mode 100755 index a99d37e..0000000 --- a/.scripts/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/.scripts/tools/queueandnotify b/.scripts/tools/queueandnotify deleted file mode 100755 index a1417ec..0000000 --- a/.scripts/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/.scripts/tools/remaps b/.scripts/tools/remaps deleted file mode 100755 index df7d6c9..0000000 --- a/.scripts/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/.scripts/tools/rotdir b/.scripts/tools/rotdir deleted file mode 100755 index e7103db..0000000 --- a/.scripts/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/.scripts/tools/rssadd b/.scripts/tools/rssadd deleted file mode 100755 index 8822fc5..0000000 --- a/.scripts/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/.scripts/tools/setbg b/.scripts/tools/setbg deleted file mode 100755 index 950ae7c..0000000 --- a/.scripts/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/.scripts/tools/shortcuts b/.scripts/tools/shortcuts deleted file mode 100755 index 1c4f278..0000000 --- a/.scripts/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/.scripts/tools/texclear b/.scripts/tools/texclear deleted file mode 100755 index f6a5062..0000000 --- a/.scripts/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/.scripts/tools/transadd b/.scripts/tools/transadd deleted file mode 100755 index ad2ee7f..0000000 --- a/.scripts/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." diff --git a/.scripts/tools/vifmimg b/.scripts/tools/vifmimg deleted file mode 100755 index 1569962..0000000 --- a/.scripts/tools/vifmimg +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -[ -z "$FIFO_UEBERZUG" ] && exit - -readonly ID_PREVIEW="preview" - -if [ "$1" = "draw" ]; then - declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="${PWD}/$6") > "$FIFO_UEBERZUG" -elif [ "$1" = "videopreview" ]; then - [ ! -f "/tmp/$6.png" ] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp/$6.png" -s 0 -q 10 && - declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="/tmp/$6.png") > "$FIFO_UEBERZUG" -else - declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") > "$FIFO_UEBERZUG" -fi diff --git a/.scripts/tools/vu b/.scripts/tools/vu deleted file mode 100755 index 778835a..0000000 --- a/.scripts/tools/vu +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env sh -export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}" - -cleanup() { - rm "$FIFO_UEBERZUG" 2>/dev/null - pkill -P $$ 2>/dev/null -} - -rm "$FIFO_UEBERZUG" 2>/dev/null -mkfifo "$FIFO_UEBERZUG" -trap cleanup EXIT -tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash & - -vifm -cleanup |
