Last active
April 3, 2016 21:44
-
-
Save ashiklom/412af086383a333b44f9fa1398f560a7 to your computer and use it in GitHub Desktop.
Convert expert-mode code to a URL and download the corresponding figure from IRIDL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
infile=$1 | |
outfile=${infile/code/gif} | |
if [ `head -n1 $infile` == "auxfig" ]; then | |
code=`tail -n +2 $infile` | |
echo "Auxfile" | |
auxfile=1 | |
else | |
code=`cat $infile` | |
auxfile=0 | |
fi | |
baseurl='http://iridl.ldeo.columbia.edu/'`echo $code | tr '\n' '/' | tr ' ' '/'` | |
url="$baseurl"'+.gif' | |
wget -O plot.gif $url | |
if [ $auxfile -eq 1 ]; then | |
baseurl="$baseurl"'.auxfig' | |
url="$baseurl"'+.gif' | |
wget -O leg.gif $url | |
gm convert plot.gif leg.gif -append $outfile | |
rm -rf plot.gif leg.gif | |
else | |
mv plot.gif $outfile | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docs := $(patsubst %.md, %.pdf, $(wildcard *.md)) | |
images := $(patsubst %.code, %.gif, $(wildcard *.code)) | |
all: $(images) $(docs) | |
%.pdf : %.md $(images) | |
pandoc -o $@ $< | |
%.gif : %.code | |
./code.to.url.sh $< | |
clean: | |
rm -rf *.pdf *.gif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment