diff --git a/bibview b/bibview
new file mode 100755
index 0000000..f11326b
--- /dev/null
+++ b/bibview
@@ -0,0 +1,30 @@
+#!/bin/bash
+if [ "$1" == "-h" ] ; then
+ echo "
+ bibview - search for citekey in a bibjson.json and preview pdf
+ usage:
+ bibview
+
+ depends:
+ fzf
+ zathura (or other fast pdf viewer)
+
+ defaults:
+ Set the required default file locations (csl file, bib file)
+
+ "
+ exit 0
+fi
+#Setup defaults
+bibdFile=${2:-$HOME/projects/bibd/OMEGA.json}
+#pandoc-citeproc --bib2json ~/projects/bibd/OMEGA.bib > OMEGA.json
+cd $(dirname $bibdFile)
+set -e #exit if an error
+
+# export citeKey=$1
+# doiStr=$(jq -r '.[] | select(.id==env.citeKey).DOI' $bibdFile)
+# urlStr=$(jq -r '.[] | select(.id==env.citeKey).URL' $bibdFile)
+
+#actually this is the good one, opens pdfs quickly
+jq -r '.[] | [.id, .title, .abstract, .keyword, .DOI, .PMID, .author[]?.family, .issued[]?[0]?[0], .["container-title"], .URL] | join(" ")' $bibdFile | fzf --preview 'echo {}' --preview-window=:up:70%:wrap --bind "enter:execute-silent(zathura {-1} &)"
+
diff --git a/cp2figs.sh b/cp2figs.sh
new file mode 100755
index 0000000..20ed3f3
--- /dev/null
+++ b/cp2figs.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#!/bin/bash
+if [ "$1" == "-h" ] ; then
+ echo "
+ cp2figs.sh - copy and convert image to figure assets folder and put html figure string containing relative link to the asset on system clipboard
+ - converts to a smaller asset size for html presentation
+ - default figure assets set as HOME/figures
+
+ Usage: cp2figs.sh img.jpg
+ cp2figs.sh img.jpg ~/myproject/assets
+ "
+ exit 0
+fi
+
+set -e
+
+# fn=$(basename $1)
+fn=$1
+#default image location
+# blobFolder=$HOME/figures
+blobFolder=${2:-$HOME/figures}
+
+#TODO: add xorg-x11 vs wayland logic here
+# wayland: use "wl-copy"
+#xorg-x11: use "xclip -selection clipboard"
+
+origHash=$(md5sum $fn | cut -d ' ' -f 1 | cut -c -7)
+
+newName=$blobFolder/$(basename -s .jpg $fn)_$origHash.jpg
+cp $fn $newName
+convert -resize 1280x1280 -quality 90 $newName $newName
+
+echo "
" | wl-copy
diff --git a/f b/f
new file mode 100755
index 0000000..43c78f5
--- /dev/null
+++ b/f
@@ -0,0 +1,43 @@
+#!/bin/bash
+if [ "$1" == "-h" ] ; then
+ echo "
+ f - fuzzy preview and open text files or pdfs
+ usage:
+ f
+ f p
+
+ depends:
+ fzf
+ grep, git-grep, or ripgrep
+ zathura (or other fast pdf viewer)
+ pdf2bib.sh - handles saving to your bib db
+ "
+ exit 0
+fi
+
+#Setup defaults
+# cslFile=${2:-$HOME/projects/bibd/bibd-md.csl}
+# bibdFile=${3:-$HOME/projects/bibd/OMEGA.bib}
+# cd $(dirname $bibdFile)
+set -e #exit if an error
+inFlag=${1:-"-i --files"}
+
+
+if [ "$1" == "p" ]; then
+
+ ls *.pdf | fzf --preview 'pdftotext -l 2 -nopgbrk -q {1} -' \
+ --preview-window=up:70% --bind "enter:execute-silent(zathura {} &)" \
+ --bind "ctrl-s:execute(pdf2bib.sh {})+reload(ls *.pdf)"
+ exit 1
+fi
+
+if [ -z "$1" ]; then
+ #FZF_DEFAULT_COMMAND=rg -i --files --glob "!.git/*"
+ fzf --delimiter : --preview 'less {1}' \
+ --preview-window=up:70% --bind "enter:execute-silent(gvim {1} &)"
+
+else
+
+ rg $1 | fzf --delimiter : --preview 'less {1}' \
+ --preview-window=up:70% --bind "enter:execute-silent(gvim {1} &)"
+fi
diff --git a/pdf2bib.sh b/pdf2bib.sh
index 2b06f55..8e8dcdc 100755
--- a/pdf2bib.sh
+++ b/pdf2bib.sh
@@ -31,13 +31,25 @@ 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#")
+# doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -i "doi:" --max-count=1 | tr [:upper:] [:lower:] | sed -E "s#doi:(.+)#\1#")
+
+doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -iE "doi:? ?/?10\." --max-count=1 | tr [:upper:] [:lower:] | sed -E "s#.*doi:? ?/?(10.+)#\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#")
+ doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -iE "doi\.org/10\." --max-count=1 | tr [:upper:] [:lower:] | sed -E "s#.+doi\.org/(10.+)#\1#")
fi
+# 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
+# doi=$(pdftotext -q -f 1 -l 1 $fn - | grep -iE "doi ?" --max-count=1 | tr [:upper:] [:lower:] | sed -E "s#doi ?(.+)#\1#")
+# fi
+
if [ -z "$doi" ]; then
echo "doi not found"
exit 1
diff --git a/pdfsplit b/pdfsplit
new file mode 100755
index 0000000..ec5461f
--- /dev/null
+++ b/pdfsplit
@@ -0,0 +1,31 @@
+#!/bin/bash
+if [ "$1" == "-h" ] ; then
+ echo "
+ pdfsplit - extract a range of pdf pages with ghostscript
+
+ usage:
+ pdfsplit firstPage lastPage inputFile.pdf
+
+ output file will be named inputfile_pXX-pYY.pdf
+
+ depends:
+ gs - ghostscript
+
+ "
+ exit 0
+fi
+
+# the following is from a stackoverflow answer
+# function pdfsplit()
+# {
+ # this function uses 3 arguments:
+ # $1 is the first page of the range to extract
+ # $2 is the last page of the range to extract
+ # $3 is the input file
+ gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
+ -dFirstPage=${1} \
+ -dLastPage=${2} \
+ -sOutputFile=${3%.pdf}_p${1}-p${2}.pdf \
+ ${3}
+# }
+
diff --git a/reveal.sh b/reveal.sh
index 12fdd37..85f6752 100755
--- a/reveal.sh
+++ b/reveal.sh
@@ -5,7 +5,7 @@ if [ "$1" == "-h" ] ; then
Useful for serving markdown text files locally with reveal.js
Usage: reveal.sh neuroanatomy1.md
-
+ reveal.sh neuroanatomy1.md 8001
"
echo "$(tput setaf 6)$EDITOR $(tput setaf 7)is currently set as editor"
exit 0
@@ -13,8 +13,9 @@ fi
set -e
-
-appPath="$HOME/projects/dev/reveal.js"
+# appPath="$HOME/projects/dev/reveal.js"
+appPath="$HOME/projects/archive/external/reveal.js"
+portNumber=${2:-8000}
if [[ ! -d $appPath ]]; then
echo "reveal.js not found"
@@ -30,5 +31,5 @@ fi
#add markdown filename to reveal placeholder start file
sed -i -E "s|( $tmpName
+outCitation=$(pandoc -f latex <(echo "\cite{$citeKey}") -t plain -o - --bibliography $tmpName --citeproc --csl $cslFile | tail -n +3)
+rm $tmpName
+
+#tail -n +61 $fn | sed -E "s#(.+\}\})#\1#"
+# fzf --preview="head {}" --preview-window=up:30%
+# fzf --preview="file {}" --preview-window=down:1
+echo $outCitation
+echo $outCitation | wl-copy
diff --git a/woola b/woola
index f9eae98..d5294aa 100755
--- a/woola
+++ b/woola
@@ -8,7 +8,7 @@ if [ "$1" == "-h" ] ; then
By default this app will serve files from the current directory by default using woola.
- Takes an optional flags listed below. For example '--build' to build website files instead of serving.
+ Takes an optional flag of those listed below. For example '--build' to build website files instead of serving.
Optional arguments passed to woola/lib/index.js:
.option('-b, --build', 'Build and write html to path {site.options.dstPath}')
@@ -24,7 +24,7 @@ if [ "$1" == "-h" ] ; then
.option('-x, --x', 'Don\'t open browser on run.')
.option('-v, --verbose', 'verbose output')
- Installation: place in home directory and make this file executable chmod: u=rwX,go= woola
+ Installation: place in home bin directory and make this file executable chmod: u=rwX,go= woola
"
exit 0
fi
@@ -34,8 +34,7 @@ set -e
#helper startup script for woola
appPath="$HOME/projects/dev/woola"
configFile=$HOME/.config/woola/config.js
-# optFlag=${1:-serve}
-optFlag=$1
+optFlag=$@
if [[ -e $configFile ]] && [[ ! -e config.js ]]; then
ln -s $configFile config.js
@@ -58,9 +57,11 @@ fi
# node $appPath/lib/index.js
# fi
-if [[ "$optFlag" ]]; then
- node $appPath/lib/index $optFlag
-else
- node $appPath/lib/index.js
-fi
+# if [[ "$optFlag" ]]; then
+ # node $appPath/lib/index $optFlag
+# else
+ # node $appPath/lib/index.js
+# fi
+
+node $appPath/lib/index $optFlag