aboutsummaryrefslogtreecommitdiff
path: root/bin/setbg-texample
diff options
context:
space:
mode:
Diffstat (limited to 'bin/setbg-texample')
-rwxr-xr-xbin/setbg-texample46
1 files changed, 0 insertions, 46 deletions
diff --git a/bin/setbg-texample b/bin/setbg-texample
deleted file mode 100755
index ee996d3..0000000
--- a/bin/setbg-texample
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-
-SCR_WIDTH=1980
-SCR_HEIGHT=1080
-PADDING=50
-FONT_SIZE=20
-
-function fail() {
- if [ -f ~/.bg.png ]; then
- feh --bg-max -B white ~/.bg.png
- fi
- exit -1;
-}
-
-# Test internet
-timeout 4 wget -q --spider http://texample.net
-if [ $? -ne 0 ]; then fail; fi
-
-let "SCR_WIDTH -= 2 * $PADDING"
-let "SCR_WIDTH /= 2"
-let "SCR_HEIGHT -= 2 * $PADDING"
-
-PAGE=$RANDOM; let "PAGE %= 22"; let "PAGE += 1"
-
-# Fetch list of texamples
-cd /tmp
-wget -qO texample.html "http://texample.net/tikz/examples/all/?page=$PAGE"
-if [ $? -ne 0 ]; then fail; fi
-
-EXAMPLES="$(grep '^<dl' texample.html | wc -l)"
-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
-
-montage -geometry "+$PADDING+$PADDING" /tmp/bg-src.png /tmp/bg.png "/tmp/bg-$PAGE.png"
-rm /tmp/bg{,-src}.png
-if [ $? -ne 0 ]; then fail; fi
-
-feh -B white --bg-max "/tmp/bg-$PAGE.png"
-