From 6efc27037aee345cee975805f2aacac66f6da2ce Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 1 Dec 2018 14:34:14 -0500 Subject: let a thousand autistic tweaks bloom --- .scripts/tools/getbib | 20 +++++++++++++------- .scripts/tools/lmc | 4 ++-- .scripts/tools/speedvid | 7 ------- .scripts/tools/texclear | 16 +++++++++------- 4 files changed, 24 insertions(+), 23 deletions(-) delete mode 100755 .scripts/tools/speedvid (limited to '.scripts/tools') diff --git a/.scripts/tools/getbib b/.scripts/tools/getbib index 0ea30d3..bf02694 100755 --- a/.scripts/tools/getbib +++ b/.scripts/tools/getbib @@ -1,15 +1,21 @@ -#!/bin/bash +#!/bin/sh # Give this script a .pdf and it will attempt # to return a proper .bib citation via doi. # Internet connection required. -# Get the doi from metadata, if not possible, get -# doi from pdftotext output, if not possible, exit. -doi=$(pdfinfo "$1" | grep -o doi:.*) || - doi=$(pdftotext "$1" - | grep -o doi.* -m 1) || +if [ -f "$1" ]; +then + # Get the doi from metadata, if not possible, get + # doi from pdftotext output, if not possible, exit. + doi=$(pdfinfo "$1" | grep -io "doi:.*") || + doi=$(pdftotext "$1" 2>/dev/null - | grep -o "doi:.*" -m 1) || exit 1 +else + # If not given file, assume argument is doi + doi="$1" +fi # Check crossref.org for the bib citation. -curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\n" | - sed -e "/^[^\(\t\|@\|}\)]/d" +curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n" | + sed -e "/^[^\\(\\t\\|@\\|}\\)]/d" diff --git a/.scripts/tools/lmc b/.scripts/tools/lmc index 9c92f3f..45cfcd9 100755 --- a/.scripts/tools/lmc +++ b/.scripts/tools/lmc @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # A general audio interface for LARBS. @@ -18,7 +18,7 @@ case "$1" in p*) mpc pause ; pauseallmpv ;; f*) mpc seek +"$num" ;; b*) mpc seek -"$num" ;; - r*) mpc seek 0\% ;; + 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. diff --git a/.scripts/tools/speedvid b/.scripts/tools/speedvid deleted file mode 100755 index ba3a4f6..0000000 --- a/.scripts/tools/speedvid +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -base=$(basename $1) -ext="${base##*.}" -base="${base%.*}" - -ffmpeg -i $1 -vf "setpts=$2*PTS" -an $base'_sped.'$ext diff --git a/.scripts/tools/texclear b/.scripts/tools/texclear index 0e08f1d..20f435c 100755 --- a/.scripts/tools/texclear +++ b/.scripts/tools/texclear @@ -1,12 +1,14 @@ -#!/bin/bash +#!/bin/sh # Clears the build files of a LaTeX/XeLaTeX build. # I have vim run this file whenever I exit a .tex file. -[[ "$1" == *.tex ]] || exit +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|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete ;; + *) printf "Give .tex file as argument.\\n" ;; +esac -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|nav|out|snm|toc|bcf|run\.xml|synctex\.gz|blg|bbl)" -delete -- cgit v1.3.1