In this thread we post projects that have no real (useful) purpose and/or could be accomplished easier way then the method used. The reasons these projects exist is pure geekery. Projects that belong in this thread are often started for no reason other then .. "Why not ?"
I will start with a bash script I wrote that grabs the LOR RSS feed, Scraps w/ Sed/Grep, it then creates simple bar graphs repersenting LORs posts and threads with HTML5's Canvas.
Screenshot :
Example of Canvas output:
http://phun.ca/lor/lorbar.html
This does NOT self update.
Code, y0 :
:ugeek:
I will start with a bash script I wrote that grabs the LOR RSS feed, Scraps w/ Sed/Grep, it then creates simple bar graphs repersenting LORs posts and threads with HTML5's Canvas.
Screenshot :
Example of Canvas output:
http://phun.ca/lor/lorbar.html
This does NOT self update.
Code, y0 :
Code:
#!/bin/bash
wget http://forums.leagueofreason.co.uk/feed.php?mode=forums -O lor.tmp
echo ' <html>'
echo ' <head>'
echo '<style type="text/css">'
echo 'body'
echo '{ '
echo 'background: #00174b ; '
echo '}'
echo '</style>'
echo ' <script type="application/javascript">'
echo ' function draw() {'
echo ' var canvas = document.getElementById("canvas");'
echo ' if (canvas.getContext) {'
echo ' var ctx = canvas.getContext("2d");'
echo ' '
Forums=( `sed -n -e 's/.*label=\(.*\)>.*/\1/p' lor.tmp | sed 's/[^a-zA-Z0-9]//g'`)
forumz=${#Forums[@]}
Topics=( `sed -n -e 's/.*<p>\(.*\)<\/strong>.*/\1/p' lor.tmp | egrep "[0-9]{1,}" -o | sed -n 'p;N'`)
Posts=( `sed -n -e 's/.*<p>\(.*\)<\/strong>.*/\1/p' lor.tmp | egrep "[0-9]{1,}" -o | sed '1d'| sed -n 'p;N'`)
Blab=( `sed -n -e 's/.*<p>\(.*\)<\/strong>.*/\1/p' lor.tmp | sed -e :a -e 's/<[^>]*>//g'`)
for (( i=0;i<$forumz;i++)); do
echo ' ctx.fillStyle = "rgb(255,0,0)";'
echo " ctx.fillRect (10, 10+${i}*50, 1+${Topics[${i}]}/16, 10);"
echo " ctx.fillText(\"Posts : ${Posts[${i}]}\", 350,50+${i}*50);"
echo ' '
echo ' ctx.fillStyle = "rgba(0, 255, 0, 0.5)";'
echo " ctx.fillRect (10, 20+${i}*50, 1+${Posts[${i}]}/16, 10);"
echo " ctx.fillText(\"${Forums[${i}]}\", 3,50+${i}*50);"
echo " ctx.fillText(\"Threads : ${Topics[${i}]}\", 250,50+${i}*50);"
echo ' '
done
echo ' }'
echo ' }'
echo ' </script>'
echo ' </head>'
echo ' <body onload="draw();">'
echo ' <canvas id="canvas" width="1300" height="2000"></canvas>'
echo ' </body>'
echo ' </html>'
:ugeek: