<?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>lab.joelGillman.com &#187; code</title>
	<atom:link href="http://lab.joelgillman.com/archives/tag/code/feed" rel="self" type="application/rss+xml" />
	<link>http://lab.joelgillman.com</link>
	<description>Sketches, Code Bites and Toys</description>
	<lastBuildDate>Thu, 05 Nov 2009 23:19:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Pseudo Work (fwork)</title>
		<link>http://lab.joelgillman.com/archives/159_pseudo-work</link>
		<comments>http://lab.joelgillman.com/archives/159_pseudo-work#comments</comments>
		<pubDate>Thu, 05 Nov 2009 22:16:30 +0000</pubDate>
		<dc:creator>joel gillman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[source control]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://lab.joelgillman.com/?p=159</guid>
		<description><![CDATA[This script takes a text file (any text file should) and displays it one line at a time with short delays in between.  In other words, you can run this script to make it look like your computer is actually doing something worthwhile.
I had searched around the internet a few times but never really [...]]]></description>
			<content:encoded><![CDATA[<p>This script takes a text file (any text file should) and displays it one line at a time with short delays in between.  In other words, you can run this script to make it <em>look</em> like your computer is actually doing something worthwhile.</p>
<p>I had searched around the internet a few times but never really found anything like this, but that doesn&#8217;t mean it doesn&#8217;t look.  Maybe I&#8217;m just a bad internet searcher.  <a href="http://lab.joelgillman.com/archives/159_pseudo-work">Script after the jump</a>. <span id="more-159"></span></p>
<p><br/></p>
<div class="codecolorer-container bash " style="overflow:auto;white-space:nowrap;width:435px"><div class="bash codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co0">#!/bin/bash</span><br />
<br />
<span class="co0">#####################################################</span><br />
<span class="co0"># Pseudo Work (fwork) Script - by Joel Gillman 2009</span><br />
<span class="co0"># lab.joelgillman.com/archives/159_pseudo-work</span><br />
<span class="co0"># </span><br />
<span class="co0"># Please feel free to edit and change this as you</span><br />
<span class="co0"># &nbsp;like! If &nbsp;you do make any edits I would be curious</span><br />
<span class="co0"># &nbsp;to see what you've done so drop me a line!</span><br />
<span class="co0"># </span><br />
<span class="co0"># DISCLAIMER</span><br />
<span class="co0"># I am in no way a bash scripting expert. Most of what</span><br />
<span class="co0"># &nbsp;I write is copy and paste and trial and error.</span><br />
<span class="co0"># &nbsp;While this script shouldn't hurt anything in your</span><br />
<span class="co0"># &nbsp;system don't hold me responsible if it does! Use</span><br />
<span class="co0"># &nbsp;at your own risk.</span><br />
<span class="co0">#####################################################</span><br />
<br />
<br />
<span class="co0">## test if file (default or otherwise)</span><br />
<span class="kw1">if</span> <span class="br0">&#91;</span> <span class="st0">&quot;$1&quot;</span> = <span class="st_h">''</span> <span class="br0">&#93;</span>; <span class="kw1">then</span><br />
&nbsp; &nbsp; <span class="re2">filename</span>=<span class="st0">&quot;<span class="es2">$HOME</span>/garbage.txt&quot;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re5">-e</span> <span class="re1">$filename</span> <span class="br0">&#93;</span>; <span class="kw1">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">sleep</span> <span class="nu0">0</span><br />
&nbsp; &nbsp; <span class="kw1">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">echo</span> <span class="st0">&quot;No file specified and default file '~/garbage.txt' not found.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">exit</span><br />
&nbsp; &nbsp; <span class="kw1">fi</span><br />
<span class="kw1">elif</span> <span class="br0">&#91;</span> <span class="re5">-e</span> $<span class="nu0">1</span> <span class="br0">&#93;</span>; <span class="kw1">then</span><br />
&nbsp; &nbsp; <span class="re2">filename</span>=$<span class="nu0">1</span><br />
<span class="kw1">else</span><br />
&nbsp; &nbsp; <span class="kw3">echo</span> <span class="st0">&quot;No file found at $1&quot;</span><br />
&nbsp; &nbsp; <span class="kw3">exit</span><br />
<span class="kw1">fi</span><br />
<br />
<span class="co0">## execute fakeness</span><br />
<span class="kw1">while</span> <span class="kw2">read</span> p; <span class="kw1">do</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="st0">&quot;<span class="es4">$(($RANDOM % 10)</span>)&quot;</span> <span class="re5">-eq</span> <span class="nu0">1</span> <span class="br0">&#93;</span>; <span class="kw1">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">let</span> <span class="st0">&quot;R1 = (<span class="es2">$RANDOM</span> % 2)&quot;</span><br />
&nbsp; &nbsp; <span class="kw1">elif</span> <span class="br0">&#91;</span> <span class="st0">&quot;<span class="es4">$(($RANDOM % 50)</span>)&quot;</span> <span class="re5">-eq</span> <span class="nu0">1</span> <span class="br0">&#93;</span>; <span class="kw1">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">let</span> <span class="st0">&quot;R1 = (<span class="es2">$RANDOM</span> % 20)&quot;</span><br />
&nbsp; &nbsp; <span class="kw1">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">let</span> <span class="st0">&quot;R1 = 0&quot;</span><br />
&nbsp; &nbsp; <span class="kw1">fi</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw3">let</span> <span class="st0">&quot;R2 = (<span class="es2">$RANDOM</span> % 10)&quot;</span><br />
&nbsp; &nbsp; <span class="kw3">echo</span> <span class="re1">$p</span><br />
&nbsp; &nbsp; <span class="kw2">sleep</span> <span class="re1">$R1</span>.<span class="re1">$R2</span><br />
<span class="kw1">done</span> <span class="sy0">&lt;</span> <span class="re1">$filename</span></div></div>
<p><a href="http://lab.joelgillman.com/thepress/wp-content/uploads/2009/11/fwork.zip">Download a zip&#8217;d version of the script</a>.<br />
You can <a href="http://lab.joelgillman.com/thepress/wp-content/uploads/2009/11/garbage.txt">download the (2.5MB) text file</a> I&#8217;ve been using.</p>
<p>Let me know what you think!  Any improvements or suggestions would be greatly appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.joelgillman.com/archives/159_pseudo-work/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Circle Crawlers</title>
		<link>http://lab.joelgillman.com/archives/19_circle-crawlers</link>
		<comments>http://lab.joelgillman.com/archives/19_circle-crawlers#comments</comments>
		<pubDate>Fri, 08 Feb 2008 22:59:43 +0000</pubDate>
		<dc:creator>joel gillman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[object oriented]]></category>
		<category><![CDATA[processing]]></category>

		<guid isPermaLink="false">http://lab.joelgillman.com/archives/19_circle-crawlers</guid>
		<description><![CDATA[Circle Crawlers spawns a large number of &#8216;crawlers&#8217; and a smaller number of &#8216;anomalies&#8217; who each crawl around the screen randomly.  The large anomalies move slow and thus never get too far away from the center.  The smaller crawlers can move faster and can break away from the center but always die before [...]]]></description>
			<content:encoded><![CDATA[<p>Circle Crawlers spawns a large number of &#8216;crawlers&#8217; and a smaller number of &#8216;anomalies&#8217; who each crawl around the screen randomly.  The large anomalies move slow and thus never get too far away from the center.  The smaller crawlers can move faster and can break away from the center but always die before they get too far out from their point of origin.<span id="more-19"></span></p>
<p><em>Press &#8216;r&#8217; to reset.</em><br />
<applet class="span-12" code="crawler03" archive="http://lab.joelgillman.com/thepress/wp-content/uploads/2008/02/cirlclecrawlers.jar" width="470" height="470"></applet></p>
<p><a href="http://lab.joelgillman.com/thepress/wp-content/uploads/2008/02/cirlclecrawlers.pde">Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lab.joelgillman.com/archives/19_circle-crawlers/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spawn Object</title>
		<link>http://lab.joelgillman.com/archives/15_spawn-object</link>
		<comments>http://lab.joelgillman.com/archives/15_spawn-object#comments</comments>
		<pubDate>Wed, 30 Jan 2008 06:06:07 +0000</pubDate>
		<dc:creator>joel gillman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[modes]]></category>
		<category><![CDATA[processing]]></category>

		<guid isPermaLink="false">http://lab.joelgillman.com/archives/15_spawn-object</guid>
		<description><![CDATA[I was learning how to properly use objects and classes.  Here there is a base class &#8220;Bug&#8221; and a class to extend it called &#8220;Crawler.&#8221;  Class Bug is never directly called, I had planned on using it in the future, but never did.  Also, I figured out how to use fonts for [...]]]></description>
			<content:encoded><![CDATA[<p>I was learning how to properly use objects and classes.  Here there is a base class &#8220;Bug&#8221; and a class to extend it called &#8220;Crawler.&#8221;  Class Bug is never directly called, I had planned on using it in the future, but never did.  Also, I figured out how to use fonts for text in Processing.<span id="more-15"></span><br />
<applet class="span-12" code="spawn_object3" archive="/thepress/wp-content/uploads/2008/01/spawn_object3.jar" width="470" height="470"></applet></p>
<p><a href="/thepress/wp-content/uploads/2008/01/spawn_object3.pde">Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lab.joelgillman.com/archives/15_spawn-object/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
