diff --git a/dim b/dim index 845f4a4..2ad71b2 100755 --- a/dim +++ b/dim @@ -2,7 +2,7 @@ #dim: control display brightness from terminal #usage: dim x #where x is an integer for a new display brightness within the [min,max] range of [0,100] -#user should be part of the video user group to run this wcd ithout sudo +#user should be part of the video user group to run this without sudo #James B. Ackman 2019-02-06T15:55:20-08:00 #check kernel backlight driver names on your machine: `ls -l /sys/class/backlight/*` diff --git a/mv2figs.sh b/mv2figs.sh index 98f7cf9..1db8f45 100755 --- a/mv2figs.sh +++ b/mv2figs.sh @@ -1,5 +1,5 @@ #!/bin/bash -#mv2figs: used by the screenshot shortcut set in .config/i3/config +#mv2figs: used by the screenshot shortcut set in .config/i3/config #default image location blobFolder=$HOME/figures diff --git a/pdf2bib.sh b/pdf2bib.sh index 5fac809..8d587b7 100755 --- a/pdf2bib.sh +++ b/pdf2bib.sh @@ -1,31 +1,49 @@ #!/bin/bash -#pdf2bib -# usage: -# pdf2bib.sh file.pdf -# depends: -# xsltproc - xml processor, from GNOME project -# pubmed2bibtex.xsl - xml processor stylesheet -#James Ackman 2018-11-07T14:41:53-08:00 +if [ "$1" == "-h" ] ; then + echo " + pdf2bib - search for a doi within a pdf, query pubmed, and append bibtex entry with pdf to your local bib database file. Last two steps are identical to sdoi.sh + + usage: + pdf2bib.sh file.pdf + + depends: + pdftotext - from ghostscript or poppler or texlive ? + xsltproc - xml processor, from GNOME project + pubmed2bibtex.xsl - xml processor stylesheet + + defaults: + Set the three required default file locations (xsl file, bib file, pdf directory) + " + exit 0 +fi #Setup defaults -styleSheet="$HOME/bin/pubmed2bibtex.xsl" -bibdFileOut="$HOME/projects/bibd/OMEGA.bib" -pdfPathOut="$HOME/projects/bibd/papers" +styleSheet=${pubmedStyleSheet:-$HOME/bin/pubmed2bibtex.xsl} +bibdFileOut=${bibdFileOut:-$HOME/projects/bibd/OMEGA.bib} +pdfPathOut=${pdfPathOut:-$HOME/projects/bibd/papers} relPath=$(basename $pdfPathOut) fn=$1 set -e #exit if an error + echo "using $pdfPathOut" echo "using $bibdFileOut" #try to extract doi from pdf and retrieve a pubmed id +#for 'DOI:' syntax doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -i doi: --max-count=1 | tr [:upper:] [:lower:] | sed -E "s#doi:(.+)#\1#") +#for 'https://doi.org' syntax +if [ -z "$doi" ]; then + doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -i "doi.org/" --max-count=1 | tr [:upper:] [:lower:] | sed -E "s#.+doi\.org\/(.+)#\1#") +fi + if [ -z "$doi" ]; then echo "doi not found" exit 1 fi + ## TODO: dedupe this with sdoi.sh uid=$(curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=$doi&field=doi&retmode=xml" | grep -E "[0-9]+" | sed -E "s#([0-9]+)#\1#") diff --git a/reveal.sh b/reveal.sh index 69898f9..12fdd37 100755 --- a/reveal.sh +++ b/reveal.sh @@ -1,6 +1,18 @@ #!/bin/bash -#installation: place in home directory and make this file executable `chmod u=rwX,go= reveal.sh` -#usage example: `./reveal.sh neuroanatomy1.md` +if [ "$1" == "-h" ] ; then + echo " + reveal - helper app for opening reveal.js markdown presentations + Useful for serving markdown text files locally with reveal.js + + Usage: reveal.sh neuroanatomy1.md + + " + echo "$(tput setaf 6)$EDITOR $(tput setaf 7)is currently set as editor" + exit 0 +fi + +set -e + appPath="$HOME/projects/dev/reveal.js" diff --git a/sdoi.sh b/sdoi.sh index d50a39e..4eb1bd5 100755 --- a/sdoi.sh +++ b/sdoi.sh @@ -1,12 +1,26 @@ #!/bin/bash -#sdoi - search for doi and append bibtex entry to db -# usage: -# sdoi.sh 'doi.string' +if [ "$1" == "-h" ] ; then + echo " + sdoi - search for doi guid on pubmed and append bibtex entry to bibtex db. Optionally import a downloaded pdf. + + usage: + sdoi.sh 'doi' + sdoi.sh 'doi' download.pdf + + depends: + xsltproc - xml processor, from GNOME project + pubmed2bibtex.xsl - xml processor stylesheet + + defaults: + Set the three required default file locations (xsl file, bib file, pdf directory) + " + exit 0 +fi #Setup defaults -styleSheet="$HOME/bin/pubmed2bibtex.xsl" -bibdFileOut="$HOME/projects/bibd/OMEGA.bib" -pdfPathOut="$HOME/projects/bibd/papers" +styleSheet=${pubmedStyleSheet:-$HOME/bin/pubmed2bibtex.xsl} +bibdFileOut=${bibdFileOut:-$HOME/projects/bibd/OMEGA.bib} +pdfPathOut=${pdfPathOut:-$HOME/projects/bibd/papers} relPath=$(basename $pdfPathOut) doi=$1 fn=$2 diff --git a/shrinkpdf.sh b/shrinkpdf.sh index e4d3af8..ed69c8f 100755 --- a/shrinkpdf.sh +++ b/shrinkpdf.sh @@ -20,6 +20,7 @@ set -e #Setup defaults fn=$1 fn2=$2 + set -e #exit if an error #decide whether to use a provided new file name or too write over the original filename diff --git a/spmid.sh b/spmid.sh index 8ecf46b..3b1fcf2 100755 --- a/spmid.sh +++ b/spmid.sh @@ -1,13 +1,26 @@ #!/bin/bash -#spmid - search for pubmed id and append bibtex entry to db -# usage: -# spmid.sh '12345678' -# spmid.sh '12345678' download.pdf +if [ "$1" == "-h" ] ; then + echo " + spmid - search for pubmed guid and append bibtex entry to bibtex db. Optionally import an associated pdf. + usage: + spmid.sh '12345678' + spmid.sh '12345678' download.pdf + + depends: + xsltproc - xml processor, from GNOME project + pubmed2bibtex.xsl - xml processor stylesheet + + defaults: + Set the three required default file locations (xsl file, bib file, pdf directory) + + " + exit 0 +fi #Setup defaults -styleSheet="$HOME/bin/pubmed2bibtex.xsl" -bibdFileOut="$HOME/projects/bibd/OMEGA.bib" -pdfPathOut="$HOME/projects/bibd/papers" +styleSheet=${pubmedStyleSheet:-$HOME/bin/pubmed2bibtex.xsl} +bibdFileOut=${bibdFileOut:-$HOME/projects/bibd/OMEGA.bib} +pdfPathOut=${pdfPathOut:-$HOME/projects/bibd/papers} relPath=$(basename $pdfPathOut) uid=$1 fn=$2 diff --git a/spubmed.sh b/spubmed.sh index 36edb84..4d9cd20 100755 --- a/spubmed.sh +++ b/spubmed.sh @@ -1,14 +1,29 @@ #!/bin/bash -#spubmed.sh - search for pubmed for author, journal, year -# usage: -# spubmed.sh 'kaas' 'trends+neurosci' '1995' -# spubmed.sh 'rakic' 'j+comp+neurol' '1972' +if [ "$1" == "-h" ] ; then + echo " + spubmed.sh - search for pubmed for author, journal, year + + usage: + spubmed.sh 'kaas' 'trends+neurosci' '1995' + spubmed.sh 'rakic' 'j+comp+neurol' '1972' + + depends: + xsltproc - xml processor, from GNOME project + pubmed2bibtex.xsl - xml processor stylesheet + + defaults: + Set the three required default file locations (xsl file, bib file, pdf directory) + + " + exit 0 +fi #Setup defaults -styleSheet="$HOME/bin/pubmed2bibtex.xsl" -bibdFileOut="$HOME/projects/bibd/OMEGA.bib" -pdfPathOut="$HOME/projects/bibd/papers" +styleSheet=${pubmedStyleSheet:-$HOME/bin/pubmed2bibtex.xsl} +bibdFileOut=${bibdFileOut:-$HOME/projects/bibd/OMEGA.bib} +pdfPathOut=${pdfPathOut:-$HOME/projects/bibd/papers} relPath=$(basename $pdfPathOut) + author=$1 journal=$2 year=$3 diff --git a/woola b/woola index 5d87e69..8f53936 100755 --- a/woola +++ b/woola @@ -1,7 +1,25 @@ #!/bin/bash +if [ "$1" == "-h" ] ; then + echo " + woola shell script - a helper app to invoke the woola markdown content build or server programs + + Usage: woola + woola build + + Takes an optional flag that can be 'build' to build website files instead of serving. + By default this app will serve files from the current directory by default using woola. + + Installation: place in home directory and make this file executable chmod: u=rwX,go= woola + " + exit 0 +fi + +set -e + #helper startup script for woola appPath="$HOME/projects/dev/woola" configFile=$HOME/.config/woola/config.js +optFlag=${1:-serve} if [[ -e $configFile ]] && [[ ! -e config.js ]]; then ln -s $configFile config.js @@ -18,5 +36,9 @@ fi #if [[ ! -d figures ]]; then # ln -s $HOME/figures figures #fi -node $appPath/lib/index.js +if [[ "$optFlag" == "build" ]]; then + node $appPath/lib/index --build +else + node $appPath/lib/index.js +fi