aboutsummaryrefslogtreecommitdiff
path: root/bin/setbg-texample
diff options
context:
space:
mode:
authorCamil Staps2016-04-08 18:30:37 +0200
committerCamil Staps2016-11-30 19:11:42 +0100
commit3c3c27e61ba5251ead8b5457e331752c4d4bb1b6 (patch)
treeb04e4537a2a67cd08883e7cb1e8d7e7b50cbe32a /bin/setbg-texample
parentFix volume shortcuts (diff)
fix some errors in setbg-texample; not all
Diffstat (limited to 'bin/setbg-texample')
-rwxr-xr-xbin/setbg-texample4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/setbg-texample b/bin/setbg-texample
index 3721944..e577b5b 100755
--- a/bin/setbg-texample
+++ b/bin/setbg-texample
@@ -14,11 +14,13 @@ PAGE=$RANDOM; let "PAGE %= 22"; let "PAGE += 1"
cd /tmp
wget -qO texample.html "http://texample.net/tikz/examples/all/?page=$PAGE"
EXAMPLES="$(grep '^<dl' texample.html | wc -l)"
-awk -v n=0 "BEGIN{n=int(rand()*$EXAMPLES)} /^<dl/{l++} (l==n){print} END{}" texample.html | sponge texample.html
+awk -v n=0 "BEGIN{n=int(rand()*$EXAMPLES)+1} /^<dl/{l++} (l==n){print} END{}" texample.html | sponge texample.html
PDF="$(grep '\/media\/tikz\/examples\/PDF' texample.html | sed "s/.*<a href=\"\([^\"]*\)\">PDF<\/a>.*/\1/")"
TEX="$(grep '\/media\/tikz\/examples\/TEX' texample.html | grep -v writelatex | sed "s/.*<a href=\"\(.*\)\">TEX<\/a>.*/\1/")"
+echo $PDF $TEX
+
wget -qO- "http://texample.net$PDF" | convert -size "x$SCR_HEIGHT" -density 300 - /tmp/bg.png
wget -qO- "http://texample.net$TEX" | sed -n '/\\begin{document}/,/\\end{document}/p' | pygmentize -l latex -O font_size=$FONT_SIZE -o /tmp/bg-src.png