<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Simon Cook &#187; Programming</title>
	<atom:link href="http://simoncook.org/blog/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://simoncook.org</link>
	<description>Home Page of Simon Cook</description>
	<lastBuildDate>Thu, 19 Jan 2012 23:41:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Monitoring Bandwidth Usage on a Virgin Media Super Hub (aka the VMNG480)</title>
		<link>http://simoncook.org/blog/2012/01/monitoring-bandwidth-usage-on-a-virgin-media-super-hub-aka-the-vmng480/</link>
		<comments>http://simoncook.org/blog/2012/01/monitoring-bandwidth-usage-on-a-virgin-media-super-hub-aka-the-vmng480/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 19:40:26 +0000</pubDate>
		<dc:creator>Si</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[bandwidth]]></category>
		<category><![CDATA[netgear]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[virgin media]]></category>

		<guid isPermaLink="false">https://simoncook.org/?p=669</guid>
		<description><![CDATA[In the past year I have come at heads with Virgin Media regarding their fair use policy, which is basically &#8220;use all you want at peak times unless you start to slow down other people&#8217;s connections, in which case we give you a warning&#8221;. Apparently I was downloading 60GB non-stop every hour (let&#8217;s ignore the [...]]]></description>
			<content:encoded><![CDATA[<p>In the past year I have come at heads with Virgin Media regarding their fair use policy, which is basically &#8220;use all you want at peak times unless you start to slow down other people&#8217;s connections, in which case we give you a warning&#8221;. Apparently I was downloading 60GB non-stop every hour (let&#8217;s ignore the fact that isn&#8217;t possible on my connection speed for a moment). After frustration that there is no decent persistent bandwidth logging on the router (it gives you the amount you&#8217;ve uploaded and downloaded since the last boot) I wrote a python script that polls the state if the router every minute to check these figures, calculate a delta for how much was transferred in the last minute and store that to a database. Now this script works (I&#8217;ve been using it since July) and I am now releasing it for others to use/improve.</p>
<p>Firstly, anyone who looks at the structure of the script will notice that it was built to function, not to be beautiful. This tool was built so that I could get a log as soon as possible, so I took some very unusual turns in it&#8217;s design. You will see that I am storing a string for all the data that I was collecting from the web server in the database every minute. This is because at the original creation of the script I was unsure whether the router counted in a decimal (i.e. 1000K in 1M) or binary (i.e. 1024K in 1M) fashion. Turns out it&#8217;s using the latter so I could trim that out. This data is also stored because at some point I intended to add a check function that would make sure all the deltas are correct, but that will be added later.</p>
<p>Writing this script has allowed me to find one bug in the routers firmware. At seemingly random points (but in my own experience this occurs after an automatic reboot), the router works as intended but something occurs to cause it to return 4GB for one or both of the two figures. As there is no remote reboot feature on this router, I have to manually reset it, though I may make something that allow me to trigger a reboot on detection of this condition. If I do that, I will document it here.</p>
<p>Originally this script sat in my ~/bandwidth directory on my server, logged to a file called bandwidth.txt and was called once a minute, with a support script being called at midnight that read the entire file, summing up every hour/day, and emailing the summed results for the past 24 hours and 1 day. As you can imagine over time this got slower and slower. It got to a point at the end where it would take almost 2 minutes to generate the report, at which point something had to be done. Which is where the MySQL conversion comes in.</p>
<p>The database was added as an easier store (its easier to request the last line from the database than read in the entire file and discard old results) as well as add more flexible reporting to the script. This conversion involved adding just the previously stored file data, with optimisation coming later. I have been able to create in addition a page that shows the live reports as a webpage as a result of this page. I haven&#8217;t added this to the source yet but I will tweak it to make the code look better before adding. You can see my version running on <a href="http://home.simoncook.org/bandwidth">http://home.simoncook.org/bandwidth</a>.</p>
<p><div id="attachment_671" class="wp-caption aligncenter" style="width: 310px"><a href="http://simoncook.org/wordpress/uploads/2012/01/Screenshot-at-2012-01-13-193758.png" rel="lightbox[669]"><img class="size-medium wp-image-671" title="My current Internet usage statistics" src="http://simoncook.org/wordpress/uploads/2012/01/Screenshot-at-2012-01-13-193758-300x208.png" alt="" width="300" height="208" /></a><p class="wp-caption-text">My current Internet usage statistics</p></div></p>
<p style="text-align: center;"><a href="http://simoncook.org/blog/2012/01/monitoring-bandwidth-usage-on-a-virgin-media-super-hub-aka-the-vmng480/screenshot-at-2012-01-13-193758/" rel="attachment wp-att-671"><br />
</a></p>
<p>This is where the project is. It is functional, but not elegant, and only works with one router, though I feel that it should be easily expanded as the web page scraping is done in one function, so anyone wanting to create a modified version for their router only needs to create an output-compatible version of this function and they&#8217;re good to go. I will modify this script over time both in terms of tidying it up and adding new features that I feel are of use.</p>
<p>The URL for the source for this project is at <a href="https://github.com/simonpcook/bandwidth-VMNG480">https://github.com/simonpcook/bandwidth-VMNG480</a> and if you feel you can make use/make changes for it, feel free to fork it to meet your own needs. I will flesh out some documentation soon (and the required schema will be added to the repo). I hope you find this of use.</p>
<p>Disclaimer: Using this script counts as the single user who can log in. Attempting to login to the router from another computer will give an error message, the current workaround is to administer the router from the computer running the script (or some equivalent such as using a proxy so the router sees the correct source IP) or to disable the script and wait for the login timeout when you want to administer the router.</p>
]]></content:encoded>
			<wfw:commentRss>http://simoncook.org/blog/2012/01/monitoring-bandwidth-usage-on-a-virgin-media-super-hub-aka-the-vmng480/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minecraft Admin Wrapper&#8230; now with Levels!</title>
		<link>http://simoncook.org/blog/2010/08/minecraft-admin-wrapper-now-with-levels/</link>
		<comments>http://simoncook.org/blog/2010/08/minecraft-admin-wrapper-now-with-levels/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 15:33:34 +0000</pubDate>
		<dc:creator>Si</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[minecraft]]></category>
		<category><![CDATA[techious]]></category>

		<guid isPermaLink="false">http://simoncook.org/?p=579</guid>
		<description><![CDATA[I&#8217;m writing a variation on a Minecraft Admin Wrapper, and this will act as a nice page with when things have been added (instead of me spamming new messages every few minutes, I&#8217;ll just edit this post) 16:30: Now with Levels! And now I&#8217;m going to go and get dinner, I&#8217;ll be back in about [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m writing a variation on a Minecraft Admin Wrapper, and this will act as a nice page with when things have been added (instead of me spamming new messages every few minutes, I&#8217;ll just edit this post)</p>
<p><strong>16:30: Now with Levels! </strong><em>And now I&#8217;m going to go and get dinner, I&#8217;ll be back in about 2 hours, ready to program the next stage of the wrapper.</em></p>
<p style="text-align: center;"><strong><a href="https://simoncook.org/wordpress/uploads/2010/08/javaw-2010-08-22-16-28-20-29.png" rel="lightbox[579]"><img class="aligncenter size-medium wp-image-580" title="Now with levels (see, I'm root!)" src="https://simoncook.org/wordpress/uploads/2010/08/javaw-2010-08-22-16-28-20-29-300x169.png" alt="Now with levels (see, I'm root!)" width="300" height="169" /></a>20:40</strong> <em>Version Beta 1 is being used on the server, hopefully it works fine! I will release the source code once complete.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://simoncook.org/blog/2010/08/minecraft-admin-wrapper-now-with-levels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minecraft Tools: SnapShotter 1.0</title>
		<link>http://simoncook.org/blog/2010/08/minecraft-tools-snapshotter-1-0/</link>
		<comments>http://simoncook.org/blog/2010/08/minecraft-tools-snapshotter-1-0/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 10:58:34 +0000</pubDate>
		<dc:creator>Si</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[minecraft]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://simoncook.org/?p=573</guid>
		<description><![CDATA[Although I did post this on the Minecraft Forums, I think I should post this here for anyone who wants to see how simple this script is. What it does is to take a copy of the Minecraft map and copy it to a folder for people to grab (also good for backups when someone [...]]]></description>
			<content:encoded><![CDATA[<p>Although I did post this on the <a href="http://www.minecraftforum.net/viewtopic.php?f=1012&amp;t=27116">Minecraft Forums</a>, I think I should post this here for anyone who wants to see how simple this script is.</p>
<p>What it does is to take a copy of the Minecraft map and copy it to a folder for people to grab (also good for backups when someone TNTs the hell out of your map). If you have any suggestions/improvements, feel free to comment.</p>
<p>(To stop the spamming of rubbish your RSS reader won&#8217;t understand I&#8217;ll put the code under the break.)</p>
<p><span id="more-573"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># Minecraft World Snapshotter</span>
<span style="color: #666666; font-style: italic;"># Version 1.0</span>
<span style="color: #666666; font-style: italic;"># Created by Simon Cook (simon@simoncook.org)</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## CONFIG START</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># WORLD contains the name of the directory the Minecraft world is in</span>
<span style="color: #007800;">WORLD</span>=<span style="color: #ff0000;">&quot;world&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># FILENAME contains the name that will be appended with the date</span>
<span style="color: #007800;">FILENAME</span>=<span style="color: #ff0000;">&quot;world2-&quot;</span>
<span style="color: #666666; font-style: italic;"># DATE contains the date formatting to be used for a file name</span>
<span style="color: #007800;">DATE</span>=<span style="color: #ff0000;">&quot;%Y%m%d-%H%M%S&quot;</span>
<span style="color: #666666; font-style: italic;"># TYPE defines the file type to create (valid: tar bz2 7z zip)</span>
<span style="color: #007800;">TYPE</span>=<span style="color: #ff0000;">&quot;7z&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># DEST if valid, the snapshot will be copied or moved to this directory</span>
<span style="color: #007800;">DEST</span>=<span style="color: #ff0000;">&quot;/var/www/simoncook.org/web/static/minecraft/&quot;</span>
<span style="color: #666666; font-style: italic;"># CPMV is whether to move or copy if DEST is valid (valid: cp mv)</span>
<span style="color: #007800;">CPMV</span>=<span style="color: #ff0000;">&quot;cp&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">## CONFIG END</span>
<span style="color: #666666; font-style: italic;">## DO NOT EDIT UNDER THIS LINE</span>
&nbsp;
<span style="color: #007800;">FILENAME</span>=<span style="color: #007800;">$FILENAME</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #007800;">$DATE</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$WORLD</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Sorry, World <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">$WORLD</span><span style="color: #000099; font-weight: bold;">\&quot;</span> does not exist!&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TYPE</span>&quot;</span> == <span style="color: #ff0000;">&quot;tar&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">FILENAME</span>=<span style="color: #007800;">$FILENAME</span>.tar
    <span style="color: #c20cb9; font-weight: bold;">tar</span> cf <span style="color: #007800;">$FILENAME</span> <span style="color: #007800;">$WORLD</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Snapshot created as <span style="color: #007800;">$FILENAME</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TYPE</span>&quot;</span> == <span style="color: #ff0000;">&quot;bz2&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">FILENAME</span>=<span style="color: #007800;">$FILENAME</span>.tar
    <span style="color: #c20cb9; font-weight: bold;">tar</span> cf <span style="color: #007800;">$FILENAME</span> <span style="color: #007800;">$WORLD</span>
    <span style="color: #c20cb9; font-weight: bold;">bzip2</span> <span style="color: #660033;">-9</span> <span style="color: #007800;">$FILENAME</span>
    <span style="color: #007800;">FILENAME</span>=<span style="color: #007800;">$FILENAME</span>.bz2
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Snapshot created as <span style="color: #007800;">$FILENAME</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TYPE</span>&quot;</span> == <span style="color: #ff0000;">&quot;7z&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">FILENAME</span>=<span style="color: #007800;">$FILENAME</span>.7z
    7za a <span style="color: #660033;">-mx9</span> <span style="color: #007800;">$FILENAME</span> <span style="color: #007800;">$WORLD</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Snapshot created as <span style="color: #007800;">$FILENAME</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TYPE</span>&quot;</span> == <span style="color: #ff0000;">&quot;zip&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">FILENAME</span>=<span style="color: #007800;">$FILENAME</span>.zip
    <span style="color: #c20cb9; font-weight: bold;">zip</span> <span style="color: #660033;">-9rq</span> <span style="color: #007800;">$FILENAME</span> <span style="color: #007800;">$WORLD</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Snapshot created as <span style="color: #007800;">$FILENAME</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DEST</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$CPMV</span>&quot;</span> == <span style="color: #ff0000;">&quot;mv&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #007800;">$FILENAME</span> <span style="color: #007800;">$DEST</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;File moved to <span style="color: #007800;">$DEST</span>&quot;</span>
    <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$CPMV</span>&quot;</span> == <span style="color: #ff0000;">&quot;cp&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$FILENAME</span> <span style="color: #007800;">$DEST</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;File copied to <span style="color: #007800;">$DEST</span>&quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://simoncook.org/blog/2010/08/minecraft-tools-snapshotter-1-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protected: An Interesting Summer Proposition</title>
		<link>http://simoncook.org/blog/2010/06/an-interesting-summer-proposition/</link>
		<comments>http://simoncook.org/blog/2010/06/an-interesting-summer-proposition/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 17:06:13 +0000</pubDate>
		<dc:creator>Si</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[oooh]]></category>
		<category><![CDATA[private]]></category>

		<guid isPermaLink="false">http://simoncook.org/?p=505</guid>
		<description><![CDATA[There is no excerpt because this is a protected post.]]></description>
			<content:encoded><![CDATA[<form action="http://simoncook.org/wordpress/wp-pass.php" method="post">
<p>This post is password protected. To view it please enter your password below:</p>
<p><label for="pwbox-505">Password:<br />
<input name="post_password" id="pwbox-505" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="Submit" /></p></form>
]]></content:encoded>
			<wfw:commentRss>http://simoncook.org/blog/2010/06/an-interesting-summer-proposition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pulling random data from /dev/random</title>
		<link>http://simoncook.org/blog/2010/02/pulling-random-data-from-devrandom/</link>
		<comments>http://simoncook.org/blog/2010/02/pulling-random-data-from-devrandom/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 06:55:44 +0000</pubDate>
		<dc:creator>Si</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[/dev/random]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://simoncook.org/?p=408</guid>
		<description><![CDATA[This is a shell script that will pull 5 random characters from /dev/random and print them out to standard output. It was created as the input component for a random password generator that I am currently writing. Note on using /dev/random: as usual, using this source for entropy will give you pure randomness, though due [...]]]></description>
			<content:encoded><![CDATA[<p>This is a shell script that will pull 5 random characters from /dev/random and print them out to standard output. It was created as the input component for a random password generator that I am currently writing.</p>
<p><strong>Note on using /dev/random</strong>: as usual, using this source for entropy will give you pure randomness, though due to the nature of the random source (see <a href="http://en.wikipedia.org/wiki//dev/random">Wikipedia entry on /dev/random</a>) the script may sometimes lock up and fail to generate a complete output, as it has run out of randomness. If you are intending to use this alot, then it is advised to use /dev/urandom that doesn&#8217;t block, although that comes at the cost of a small bit of entropy.<br />
<span id="more-408"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># Script for pulling x characters from a random source</span>
<span style="color: #666666; font-style: italic;">#   and prints them out to stdout</span>
<span style="color: #666666; font-style: italic;"># Version 1.0.0</span>
<span style="color: #666666; font-style: italic;"># By Simon Cook (https://simoncook.org)</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Fill in the two variables below</span>
<span style="color: #666666; font-style: italic;">#  &quot;entropy&quot; is the source of randomness</span>
<span style="color: #666666; font-style: italic;">#  &quot;chars&quot; is the number of chars we want</span>
<span style="color: #007800;">entropy</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>random
<span style="color: #007800;">chars</span>=<span style="color: #000000;">5</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Pull x characters from source</span>
<span style="color: #007800;">i</span>=<span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #660033;">-r</span> <span style="color: #660033;">-n1</span> char
<span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$char</span>&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> i++ <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span>&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$chars</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
   <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000; font-weight: bold;">&amp;</span>lt; <span style="color: #ff0000;">&quot;<span style="color: #007800;">$entropy</span>&quot;</span></pre></div></div>

<p><strong> Licensing:</strong> This small script is released under the CC-GNU GPL licence.</p>
<p><!-- Creative Commons License --><br />
<a href="http://creativecommons.org/licenses/GPL/2.0/"><br />
<img src="http://creativecommons.org/images/public/cc-GPL-a.png" border="0" alt="CC-GNU GPL" /></a><!-- /Creative Commons License -->.</p>
]]></content:encoded>
			<wfw:commentRss>http://simoncook.org/blog/2010/02/pulling-random-data-from-devrandom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Techious2 Screenshot 1</title>
		<link>http://simoncook.org/blog/2009/01/techious2-screenshot-1/</link>
		<comments>http://simoncook.org/blog/2009/01/techious2-screenshot-1/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 18:59:07 +0000</pubDate>
		<dc:creator>Si</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[techious]]></category>
		<category><![CDATA[Techious2]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.spcook.co.uk/?p=220</guid>
		<description><![CDATA[Time to reveal the first image of Techious2, showing an idea inspired from many elements from my previous websites. Partially it is based on some old Ratchet2 design that never made it to launch. Here it is: Now I&#8217;ve just put text here, but soon I intend to mix these elements with the spage system, [...]]]></description>
			<content:encoded><![CDATA[<p>Time to reveal the first image of Techious2, showing an idea inspired from many elements from my previous websites. Partially it is based on some old Ratchet2 design that never made it to launch. Here it is:</p>
<p style="text-align: center;"><img class="aligncenter" src="http://i5.photobucket.com/albums/y151/connectedcac/techious2ss1.jpg" alt="" width="597" height="480" /></p>
<p>Now I&#8217;ve just put text here, but soon I intend to mix these elements with the spage system, but hopefully you can see my genius <img src='http://simoncook.org/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Comments appreciated <img src='http://simoncook.org/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://simoncook.org/blog/2009/01/techious2-screenshot-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Welcome to the Techious2 Developers Blog!</title>
		<link>http://simoncook.org/blog/2008/12/welcome-to-the-techious2-developers-blog/</link>
		<comments>http://simoncook.org/blog/2008/12/welcome-to-the-techious2-developers-blog/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 16:24:24 +0000</pubDate>
		<dc:creator>Si</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[techious]]></category>
		<category><![CDATA[Techious2]]></category>

		<guid isPermaLink="false">http://www.spcook.co.uk/?p=198</guid>
		<description><![CDATA[Well, kind of, the real link to read this kind of garbage is here, and it only shows the magic that is the Techious2 developer blog posts. Here (or there) I will be posting updates as to how the Techious2 project is going as it happens. Now for a small introduction. Techious2 is (obviously) the [...]]]></description>
			<content:encoded><![CDATA[<p>Well, kind of, the real link to read this kind of garbage is <a href="http://www.spcook.co.uk/blog/category/techious2/">here</a>, and it only shows the magic that is the Techious2 developer blog posts. Here (or there) I will be posting updates as to how the Techious2 project is going as it happens.</p>
<p>Now for a small introduction. Techious2 is (obviously) the new version of the Techious Website, as developed myself and tested by my crack team of testers when it gets to that stage. Originally it was going to be a private thing, but things leak too quicky so I have decided to make it a bit more public. Currently the only information you can know is what I post here at the moment, and also what I also post in the future with more blog posts and stuff.</p>
<p>In this blog I will aim to put updates to the websites along with screenshots for those that think they are worthy enough. I aim to have the website done by the middle of 2009, but we have no idea how long things actually take these days, so it could just be another summer break rushsite <img src='http://simoncook.org/wordpress/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>For keeping up to date with things, you can either use the category feed that will only show the Techious2 posts, or if you currently subscribe to my main RSS feed, you already have all you need to keep up todate.</p>
<p>One final thing, should I make this a seperate blog or use what I intend to?</p>
<p>Note: There is a poll embedded within this post, please visit the site to participate in this post's poll.</p>
<p>That is all, as I have to actually develop stuff for it to be readworthy, so heres to the Techious2 project!</p>
]]></content:encoded>
			<wfw:commentRss>http://simoncook.org/blog/2008/12/welcome-to-the-techious2-developers-blog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New Project: Value Added Tax Converter</title>
		<link>http://simoncook.org/blog/2008/11/new-project-value-added-tax-converter/</link>
		<comments>http://simoncook.org/blog/2008/11/new-project-value-added-tax-converter/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 19:42:44 +0000</pubDate>
		<dc:creator>Si</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[VAT Converter]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[VAT]]></category>

		<guid isPermaLink="false">http://www.spcook.co.uk/?p=178</guid>
		<description><![CDATA[Now it&#8217;s about time for some real content. Presenting the first publicly visible project, the VAT Converter! Inspired by the need to convert prices from the old 17.5% VAT standard over here in the UK to the new 15%, I wrote a little script to do this for you. I will at some point release the [...]]]></description>
			<content:encoded><![CDATA[<p>Now it&#8217;s about time for some real content. Presenting the first <em>publicly visible</em> project, the VAT Converter! Inspired by the need to convert prices from the old 17.5% VAT standard over here in the UK to the new 15%, I wrote a little script to do this for you. I will at some point release the code behind this script after I have deceided on a licence for it (probabily some CC licence), but hey, its content on here right!</p>
<p>The URL to play with the converter is <a href="http://www.spcook.co.uk/projects/vat1715/">http://www.spcook.co.uk/projects/vat1715/</a></p>
<p>For those of you who broke it, or want to suggest improvements, the Project Forum is available at <a href="http://www.spcook.co.uk/forum/forum/vat-converter">http://www.spcook.co.uk/forum/forum/vat-converter</a></p>
<p> </p>
<p>I hope you enjoy this, and possibly find a good quick use for it.</p>
<p> </p>
<p><span style="font-size: 0.8em;">Disclaimer: I take no responsibility for any results you get form the calculator, it is only a calculator and should only be used for own personal interest.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://simoncook.org/blog/2008/11/new-project-value-added-tax-converter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Code Plugins</title>
		<link>http://simoncook.org/blog/2008/11/new-code-plugins/</link>
		<comments>http://simoncook.org/blog/2008/11/new-code-plugins/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 17:45:32 +0000</pubDate>
		<dc:creator>Si</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Spcook]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[hello world]]></category>
		<category><![CDATA[syntax]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://www.spcook.co.uk/?p=130</guid>
		<description><![CDATA[Here goes nothing, a nice new plugin for my blog so I can highlight code&#8230; let&#8217;s see if it works: 1 2 3 4 5 #include &#60;stdio.h&#62; &#160; int main&#40;void&#41;&#123; printf&#40;&#34;Hello World\n&#34;&#41;; &#125; Yup, that seems to work]]></description>
			<content:encoded><![CDATA[<p>Here goes nothing, a nice new plugin for my blog so I can highlight code&#8230; let&#8217;s see if it works:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Hello World<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Yup, that seems to work <img src='http://simoncook.org/wordpress/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://simoncook.org/blog/2008/11/new-code-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

