<?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>Tue, 12 Jul 2011 15:03:29 +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>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 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<br />
<span style="color: #666666; font-style: italic;">#####################################################</span><br />
<span style="color: #666666; font-style: italic;"># Pseudo Work (fwork) Script - by Joel Gillman 2009</span><br />
<span style="color: #666666; font-style: italic;"># lab.joelgillman.com/archives/159_pseudo-work</span><br />
<span style="color: #666666; font-style: italic;"># </span><br />
<span style="color: #666666; font-style: italic;"># Please feel free to edit and change this as you</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;like! If &nbsp;you do make any edits I would be curious</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;to see what you've done so drop me a line!</span><br />
<span style="color: #666666; font-style: italic;"># </span><br />
<span style="color: #666666; font-style: italic;"># DISCLAIMER</span><br />
<span style="color: #666666; font-style: italic;"># I am in no way a bash scripting expert. Most of what</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;I write is copy and paste and trial and error.</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;While this script shouldn't hurt anything in your</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;system don't hold me responsible if it does! Use</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;at your own risk.</span><br />
<span style="color: #666666; font-style: italic;">#####################################################</span><br />
<br />
<br />
<span style="color: #666666; font-style: italic;">## test if file (default or otherwise)</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> = <span style="color: #ff0000;">''</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #007800;">filename</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$HOME</span>/garbage.txt&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$filename</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">0</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;No file specified and default file '~/garbage.txt' not found.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #007800;">filename</span>=<span style="color: #007800;">$1</span><br />
<span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;No file found at $1&quot;</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
<span style="color: #666666; font-style: italic;">## execute fakeness</span><br />
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> p; <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &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;">$(($RANDOM % 10)</span>)&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;R1 = (<span style="color: #007800;">$RANDOM</span> % 2)&quot;</span><br />
&nbsp; &nbsp; <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;">$(($RANDOM % 50)</span>)&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;R1 = (<span style="color: #007800;">$RANDOM</span> % 20)&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;R1 = 0&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;R2 = (<span style="color: #007800;">$RANDOM</span> % 10)&quot;</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$p</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #007800;">$R1</span>.<span style="color: #007800;">$R2</span><br />
<span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$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 they get [...]]]></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 text in Processing. [...]]]></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>

