<?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>Schadenfreude &#187; _why</title>
	<atom:link href="http://www.ralree.com/tag/_why/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ralree.com</link>
	<description>Malicious enjoyment derived from observing someone else's misfortune</description>
	<lastBuildDate>Sun, 28 Feb 2010 04:18:37 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DNS for bash</title>
		<link>http://www.ralree.com/2008/03/31/dns-for-bash/</link>
		<comments>http://www.ralree.com/2008/03/31/dns-for-bash/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 01:16:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[camping]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2008/03/31/dns-for-bash</guid>
		<description><![CDATA[Today, I decided I wanted a network service that propagated variables and aliases to every login shell that subscribed to it.  This is dangerous on a large scale, but perfectly acceptable on my small home network where everyone trusts everyone else.
First, I got Camping installed, bringing back fond memories of Ruby development.  I [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I decided I wanted a network service that propagated variables and aliases to every login shell that subscribed to it.  This is dangerous on a large scale, but perfectly acceptable on my small home network where everyone trusts everyone else.</p>
<p>First, I got <a href="http://code.whytheluckystiff.net/camping">Camping</a> installed, bringing back fond memories of Ruby development.  I then copied off the blog example, and created TreeHugger, a 427 line script that provides a web interface to edit the variables, and a plain text output for the shells to source.  </p>
<p><a href="http://modzer0.cs.uaf.edu/repos/hank/code/ruby/treehugger.rb">This script</a>, when run, allows some simple MVC actions to an sqlite3 database.</p>
<p><img src="http://ralree.com/assets/2008/3/31/screenshot2.png" alt="Example Screenshot"/></p>
<p>As you can see, I have some aliases here I want to send to all the subscribing hosts.  Eventually, I want to add some detection functionality to the database (mostly reverse DNS lookups for host rule referencing).  I just have to access <code>/out</code> to get my desired output:</p>
<pre><code>
# Treehugger Configuration
# Aliases
alias ai='sudo apt-get install'
alias aup='sudo apt-get update'
alias aug='sudo apt-get upgrade'

# Environment Variables
</code></pre>
<p>Now, to get this into bash.  I looked into making the <code>date</code> command spit out pretty unique timestamps.  Turns out you can do this with the nanoseconds format:</p>
<pre><code>
$ date +%s%N
1206926780157462141
</code></pre>
<p>I made it so <code>wget</code> saves the treehugger config to a tempfile using the somewhat random seed above as a filename suffix, and then I have my shell source it:</p>
<pre><code>
FILENAME=/tmp/treehugger-`date +%s%N`; 2&gt;/dev/null wget -O $FILENAME  http://rofl.who/treehugger/out &#038;&#038; source $FILENAME &#038;&#038; rm $FILENAME
</code></pre>
<p>And now I have nice aliases on my laptop served up from my desktop as fresh as the shell:</p>
<pre><code>
hank@davros:~$ alias
alias ai='sudo apt-get install'
alias aug='sudo apt-get upgrade'
alias aup='sudo apt-get update'
alias ls='ls --color=auto'
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2008/03/31/dns-for-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending Adblock Google Blockers Away</title>
		<link>http://www.ralree.com/2007/08/19/sending-adblock-users-where-they-belong/</link>
		<comments>http://www.ralree.com/2007/08/19/sending-adblock-users-where-they-belong/#comments</comments>
		<pubDate>Sun, 19 Aug 2007 17:42:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[advertising]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/sending-adblock-users-where-they-belong</guid>
		<description><![CDATA[Of course I know that a simple Greasemonkey script can very easily thwart this, but I don&#8217;t expect most people to go out and find it to defeat this.  If you don&#8217;t like my google ads, you can read this wonderful entry.



function sendJerksAway() {
      // Bye
    [...]]]></description>
			<content:encoded><![CDATA[<p>Of course I know that a simple Greasemonkey script can very easily thwart this, but I don&#8217;t expect most people to go out and find it to defeat this.  If you don&#8217;t like my google ads, you can read <a href="http://google.blognewschannel.com/archives/2007/07/24/google-recommends-turning-off-adblock/">this wonderful entry</a>.</p>
<div class="CodeRay">
<div class="code">
<pre><code>
<span class="r">function</span> sendJerksAway() {
      <span class="c">// Bye</span>
      <span class="fu">eval</span>(<span class="fu">unescape</span>(<span class="s"><span class="dl">&quot;</span><span class="k">%69%66%28%24</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%24%28%75%6e%65%73%63%61%70%65</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%28%27%25%35%62%25%36</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%65%25%36%31%25%36</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%64%25%36%35%25%33</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%64%25%36%37%25%36%66%25%36%66%25</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%36%37%25%36%63%25%36%35%25</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%35%66%25%36%31%25%36%34%25%37%33%25%35%66</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%25%36%36%25%37%32%25</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%36%31%25%36%64%25%36%35%25%35%64%27%29%29%2e%6c</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%65%6e%67%74%68%20%3d%3d</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%20%30%29%20%64%6f%63%75%6d%65%6e%74</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%2e%6c%6f%63%61%74%69%6f</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%6e%20%3d%20%22%68%74%74%70%3a</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%2f%2f%67%6f%6f%67%6c%65%2e%62%6c%6f</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%67%6e%65%77%73%63%68</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%61%6e%6e%65%6c%2e%63%6f%6d</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%2f%61%72%63%68%69%76%65%73</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%2f%32%30%30%37%2f%30%37</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%2f%32%34%2f%67%6f%6f%67%6c%65%2d%72%65%63%6f%6d</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%6d%65%6e%64</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%73%2d%74%75%72%6e%69%6e%67</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%2d%6f%66%66%2d%61</span><span class="dl">&quot;</span></span> +
      <span class="s"><span class="dl">&quot;</span><span class="k">%64%62%6c%6f%63%6b%2f%22</span><span class="dl">&quot;</span></span>));
}
</code></pre>
</div>
</div>
<p>Then it&#8217;s just this:</p>
<pre><code>
&lt;body onLoad="sendJerksAway();"&gt;
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2007/08/19/sending-adblock-users-where-they-belong/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Processing: It&#8217;s totally not Flash</title>
		<link>http://www.ralree.com/2007/07/20/processing-it-s-totally-not-flash/</link>
		<comments>http://www.ralree.com/2007/07/20/processing-it-s-totally-not-flash/#comments</comments>
		<pubDate>Fri, 20 Jul 2007 04:41:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[proce55ing]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/processing-it-s-totally-not-flash</guid>
		<description><![CDATA[I&#8217;m not one to advocate Java generally, but Processing is totally hawt.  Here&#8217;s something I screwed around with today:







Ball[] myBalls;

void setup()
{
  size(500,500);
  frameRate(25);

  myBalls = new Ball[300];
  for (int i = 0; i &#60; 300; i++) {
    myBalls[i] = new Ball();
    myBalls[i].x = random(0, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not one to advocate Java generally, but <a href="http://www.processing.org">Processing</a> is totally hawt.  Here&#8217;s something I screwed around with today:</p>
<div>
<object classid="java:sketch_070719a.class"<br />
                  type=&#8221;application/x-java-applet&#8221;<br />
                  archive=&#8221;/assets/2007/7/20/sketch_070719a.jar&#8221;<br />
                  width=&#8221;500&#8243; height=&#8221;500&#8243;<br />
                  standby=&#8221;Loading Processing software&#8230;&#8221; ><param name="archive" value="/assets/2007/7/20/sketch_070719a.jar" /><param name="mayscript" value="true" /><param name="scriptable" value="true" /><param name="boxmessage" value="Loading Processing software..." /><param name="boxbgcolor" value="#000" /><param name="test_string" value="outer" /><object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"<br />
   codebase=&#8221;http://java.sun.com/update/1.4.2/jinstall-1_4_2_12-windows-i586.cab&#8221;<br />
   width=&#8221;500&#8243; height=&#8221;500&#8243;<br />
   standby=&#8221;Loading Processing software&#8230;&#8221;  ><param name="code" value="sketch_070719a" /><param name="archive"<br />
     value=&#8221;/assets/2007/7/20/sketch_070719a.jar&#8221; /><param name="mayscript" value="true" /><param name="scriptable" value="true" /><param name="image" value="loading.gif" /><param name="boxmessage" value="Loading Processing software..." /><param name="boxbgcolor" value="#000" /><param name="test_string" value="inner" /></object><br />
</object>
</div>
<div class="CodeRay">
<div class="code">
<pre>
Ball[] myBalls;

<span class="r">void</span> setup()
{
  size(500,500);
  frameRate(25);

  myBalls = new Ball[300];
  <span class="r">for</span> (<span class="r">int</span> i = 0; i &lt; 300; i++) {
    myBalls[i] = new Ball();
    myBalls[i].x = <span class="fu">random</span>(0, 500);
    myBalls[i].y = <span class="fu">random</span>(0, 500);
    myBalls[i].r = <span class="fu">random</span>(0, 10);
    myBalls[i].xv = <span class="fu">random</span>(-5, 5);
    myBalls[i].yv = <span class="fu">random</span>(-5, 5);
    myBalls[i].mycolor = <span class="r">int</span>(<span class="fu">random</span>(0, 100));
    myBalls[i].myseed = <span class="r">int</span>(<span class="fu">random</span>(25,100));
  }
}

<span class="r">void</span> draw() {
  background(0);
  <span class="r">for</span> (<span class="r">int</span> i = 0; i &lt; 300; i++) {
    myBalls[i].run();
  }
}

<span class="r">class</span> Ball
{
  <span class="r">float</span> x; <span class="c">//X acis centroid</span>
  <span class="r">float</span> y; <span class="c">//Y axis centroid\
  float r; // Radius</span>
  <span class="r">float</span> xv; <span class="c">//X axis velocity</span>
  <span class="r">float</span> yv; <span class="c">//Y axis velocity</span>
  <span class="r">int</span> mycolor;
  <span class="r">int</span> myseed;
  <span class="r">int</span> counter;

  <span class="r">void</span> run()
  {
    drawShape();

    x += xv;
    y += yv;

    yv += 0.4;

    <span class="r">if</span>(x &lt; 0 || x &gt; width) {
      xv = -xv;
    }
    <span class="r">else</span> <span class="r">if</span>(y &lt; 0 || y &gt; height) {
      yv = -1.1 * yv;
    }

    <span class="r">if</span>(counter % myseed == 0) {
      xv = <span class="fu">random</span>(-5,5);
      yv = <span class="fu">random</span>(-5,5);
    }
    counter++;
  }

  <span class="r">void</span> drawShape()
  {
    smooth();
    ellipseMode(CENTER_RADIUS);
    noStroke();
    fill(mycolor);
    ellipse(x,y,r,r);
  }
}
</pre>
</div>
</div>
<p>You can download it here: <a href="http://ralree.info/assets/2007/7/20/sketch_070719a.pde">sketch_070719a</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2007/07/20/processing-it-s-totally-not-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>_why thinks I&#8217;m a bike</title>
		<link>http://www.ralree.com/2006/10/06/_why-thinks-im-a-bike/</link>
		<comments>http://www.ralree.com/2006/10/06/_why-thinks-im-a-bike/#comments</comments>
		<pubDate>Fri, 06 Oct 2006 17:59:34 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[camping]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/_why-thinks-im-a-bike</guid>
		<description><![CDATA[I got featured on
Redhanded.
Apparently, I&#8217;m a bike.  Probably because of my behavior under the name
o`o in IRC.  Sigh, it&#8217;s my only claim to fame. :(
]]></description>
			<content:encoded><![CDATA[<p>I got featured on<br />
<a href="http://redhanded.hobix.com/inspect/evanSCampingSlides.html">Redhanded</a>.<br />
Apparently, I&#8217;m a bike.  Probably because of my behavior under the name<br />
<strong>o`o</strong> in IRC.  Sigh, it&#8217;s my only claim to fame. :(</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2006/10/06/_why-thinks-im-a-bike/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Extending RedCloth</title>
		<link>http://www.ralree.com/2006/09/13/extending-redcloth/</link>
		<comments>http://www.ralree.com/2006/09/13/extending-redcloth/#comments</comments>
		<pubDate>Wed, 13 Sep 2006 18:52:31 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/extending-redcloth</guid>
		<description><![CDATA[I wanted to put emoticons into Textile for
Beast, but to do it, I needed to use very
few lines of code since there is a 500LOC limit on Beast.  After a long time
debugging, here&#8217;s what I came up with:
First, I made a new method in the RedCloth namespace.

class RedCloth
  def refs_smiley(text)
    [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to put emoticons into Textile for<br />
<a href="http://modzer0.cs.uaf.edu/forum/">Beast</a>, but to do it, I needed to use very<br />
few lines of code since there is a 500LOC limit on Beast.  After a long time<br />
debugging, here&#8217;s what I came up with:</p>
<p>First, I made a new method in the RedCloth namespace.</p>
<pre><code>
class RedCloth
  def refs_smiley(text)
    text.gsub!(/(\s)~(:P|:D|:O|:o|:S|:\||;\)|:'\(|:\)|:\()/) do |m|
      bef,ma = $~[1..2]
      filename = ActionController::AbstractRequest.relative_url_root+"/images/emoticons/"+(ma.split(//).collect{|l|l[0]}.join('_'))+".png"
      "#{bef}&lt;img src='#{filename}' title='#{ma}' class='smiley' /&gt;"
    end
  end
end
</code></pre>
<p>All I&#8217;m doing here is some nifty gsubbing with a block.  The resultant<br />
replacement expression is the last thing returned by the block.  This RegExp<br />
will match any of the possible emoticons I specified as long as they are<br />
preceeded by a ~.  This prevents things like <strong>:Person</strong> from being converted<br />
into :Person. <a href="http://modzer0.cs.uaf.edu/forum/forums/2/topics/2">Here</a> is<br />
the post about it with all the emotes I allow.  Try it out.  While I was at<br />
it, I re-activated tables for Textile in Beast.  This was totally necessary. ;)</p>
<p>Then I changed the text format helper in Beast to reflect my new method:</p>
<pre><code>
  def format_text(text)
    RedCloth.new(auto_link(text.to_s)).to_html(:textile,:refs_smiley)
  end
</code></pre>
<p>The key part here is the options passed to <strong>to_html</strong>.  This allows you to<br />
pick any rules you want for your code generation.  I found that when I named<br />
the method <strong>smiley</strong>, it wouldn&#8217;t be called.  That&#8217;s because there is a<br />
RegExp match that happens when the rule methods are called that matches on<br />
methods that begin with <strong>refs_</strong>.  I think you could get around that<br />
somehow, but I just went with it.  The default options that are implicit on a<br />
call of <strong>to_html</strong> are <strong>:markdown,:textile</strong>, and as you can see, I left out<br />
markdown.  Also, I realized that <strong>white_list</strong> was causing my generated<br />
tables to be ruined, so I took that out.  This might be a little dangerous,<br />
but I&#8217;m not too worried at this point.  I might have to submit a patch (or<br />
make a modification) to the white_list plugin.  The possibilities here are<br />
endless, thanks to <a href="http://redhanded.hobix.com">_why</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2006/09/13/extending-redcloth/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>DNS Mania</title>
		<link>http://www.ralree.com/2006/09/02/dns-mania/</link>
		<comments>http://www.ralree.com/2006/09/02/dns-mania/#comments</comments>
		<pubDate>Sat, 02 Sep 2006 15:26:02 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[camping]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/dns-mania</guid>
		<description><![CDATA[Well, I was stumbling today and found OpenDNS. I
was excited to find that I could make it coexist with OpenNIC in my dhclient
configuration.  Here&#8217;s the resultant line that makes all this magic happen:

prepend domain-name-servers 63.226.12.96, 208.67.222.222, 208.67.220.220;

So now, when I use dhcp to grab an IP, I end up prepending these nameservers
onto my resolv.conf. [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I was stumbling today and found <a href="http://www.opendns.com/">OpenDNS</a>. I<br />
was excited to find that I could make it coexist with OpenNIC in my dhclient<br />
configuration.  Here&#8217;s the resultant line that makes all this magic happen:</p>
<pre><code>
prepend domain-name-servers 63.226.12.96, 208.67.222.222, 208.67.220.220;
</code></pre>
<p>So now, when I use dhcp to grab an IP, I end up prepending these nameservers<br />
onto my resolv.conf.  OpenDNS makes spam sites and domain squatters disappear.<br />
And it makes the average request a lot faster.</p>
<p>Yesterday, <a href="http://dayne.broderson.org">bish0p</a> and I sat down and started<br />
work on <a href="http://mydns.bboy.net/">MyDNS</a>.  It turns out that the db structure<br />
isn&#8217;t all that bad, so it will be fairly straightforward to build a<br />
Rails/Camping interface for it.  I already started one in Camping called<br />
Beacon.  I was going to name it ChunkyBeacon, but <strong>#camping</strong> decided<br />
against that.</p>
<p>In other news, I&#8217;m going to leave Fairbanks for a while soon.  It will be<br />
exciting to go on this adventure into the <em>real</em> world for four months.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2006/09/02/dns-mania/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TryRuby Alias (For Ruby Non-Believers)</title>
		<link>http://www.ralree.com/2006/08/25/tryruby-alias-for-ruby-non-believers/</link>
		<comments>http://www.ralree.com/2006/08/25/tryruby-alias-for-ruby-non-believers/#comments</comments>
		<pubDate>Fri, 25 Aug 2006 17:21:03 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/tryruby-alias-for-ruby-non-believers</guid>
		<description><![CDATA[Today, I decided I needed a quick way for my friends who run Linux to try ruby.  Using _why&#8217;s awesome curl implementation of tryruby, here is the ultimate alias for any bashrc:

alias tryruby='sh -c "$(curl -s http://tryruby.hobix.com/try.sh)"'

]]></description>
			<content:encoded><![CDATA[<p>Today, I decided I needed a quick way for my friends who run Linux to try ruby.  Using <strong>_why</strong>&#8217;s awesome curl implementation of tryruby, here is the ultimate alias for any bashrc:</p>
<pre><code>
alias tryruby='sh -c "$(curl -s http://tryruby.hobix.com/try.sh)"'
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2006/08/25/tryruby-alias-for-ruby-non-believers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parsing Amazon with Hpricot</title>
		<link>http://www.ralree.com/2006/07/06/parsing-amazon-with-hpricot/</link>
		<comments>http://www.ralree.com/2006/07/06/parsing-amazon-with-hpricot/#comments</comments>
		<pubDate>Thu, 06 Jul 2006 01:07:34 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[hpricot]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/parsing-amazon-with-hpricot</guid>
		<description><![CDATA[_why made a really sweet HTML parser called Hpricot.   This allows you to easily parse a remote document using Open-URI.  Here&#8217;s how to do it:



require 'rubygems'
require_gem 'hpricot'
require 'open-uri'
puts &#34;Grabbing Page...&#34;
html = open(&#34;http://www.amazon.com/gp/product/1844300439/ref=amb_cob_bh_194691301/002-0086113-2532879?n=283155&#34;)
puts &#34;Parsing...&#34;
doc = Hpricot.parse(html)
(doc.search(&#34;//table//td[@id='prodImageCell']&#34;)/:img).each do &#124;link&#124;
  p link.attributes
end






{&#34;src&#34;=&#62;&#34;http://ec1.images-amazon.com/images/P/1844300439.01._AA240_SCLZZZZZZZ_V54614147_.jpg&#34;, &#34;border&#34;=&#62;&#34;0&#34;, &#34;id&#34;=&#62;&#34;prodImage&#34;, &#34;height&#34;=&#62;&#34;240&#34;, &#34;alt&#34;=&#62;&#34;Cobblers&#34;, &#34;width&#34;=&#62;&#34;240&#34;}




ruby -rrubygems -ropen-uri -e "require 'hpricot';(Hpricot.parse(open('http://www.amazon.com/gp/product/1844300439/ref=amb_cob_bh_194691301/002-0086113-2532879?n=283155')).search(\"//table//td[@id='prodImageCell']\")/:img).each {&#124;link&#124; p [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://redhanded.hobix.com">_why</a> made a really sweet HTML parser called <a href="http://redhanded.hobix.com/inspect/okayGiveHpricot02AGo.html">Hpricot</a>.   This allows you to easily parse a remote document using Open-URI.  Here&#8217;s how to do it:</p>
<div class="CodeRay">
<div class="code">
<pre><code>
require <span class="s"><span class="dl">'</span><span class="k">rubygems</span><span class="dl">'</span></span>
require_gem <span class="s"><span class="dl">'</span><span class="k">hpricot</span><span class="dl">'</span></span>
require <span class="s"><span class="dl">'</span><span class="k">open-uri</span><span class="dl">'</span></span>
puts <span class="s"><span class="dl">&quot;</span><span class="k">Grabbing Page...</span><span class="dl">&quot;</span></span>
html = open(<span class="s"><span class="dl">&quot;</span><span class="k">http://www.amazon.com/gp/product/1844300439/ref=amb_cob_bh_194691301/002-0086113-2532879?n=283155</span><span class="dl">&quot;</span></span>)
puts <span class="s"><span class="dl">&quot;</span><span class="k">Parsing...</span><span class="dl">&quot;</span></span>
doc = <span class="co">Hpricot</span>.parse(html)
(doc.search(<span class="s"><span class="dl">&quot;</span><span class="k">//table//td[@id='prodImageCell']</span><span class="dl">&quot;</span></span>)/<span class="sy">:img</span>).each <span class="r">do</span> |link|
  p link.attributes
<span class="r">end</span>
</code></pre>
</div>
</div>
<div class="CodeRay">
<div class="code">
<pre><code>
{<span class="s"><span class="dl">&quot;</span><span class="k">src</span><span class="dl">&quot;</span></span>=&gt;<span class="s"><span class="dl">&quot;</span><span class="k">http://ec1.images-amazon.com/images/P/1844300439.01._AA240_SCLZZZZZZZ_V54614147_.jpg</span><span class="dl">&quot;</span></span>, <span class="s"><span class="dl">&quot;</span><span class="k">border</span><span class="dl">&quot;</span></span>=&gt;<span class="s"><span class="dl">&quot;</span><span class="k">0</span><span class="dl">&quot;</span></span>, <span class="s"><span class="dl">&quot;</span><span class="k">id</span><span class="dl">&quot;</span></span>=&gt;<span class="s"><span class="dl">&quot;</span><span class="k">prodImage</span><span class="dl">&quot;</span></span>, <span class="s"><span class="dl">&quot;</span><span class="k">height</span><span class="dl">&quot;</span></span>=&gt;<span class="s"><span class="dl">&quot;</span><span class="k">240</span><span class="dl">&quot;</span></span>, <span class="s"><span class="dl">&quot;</span><span class="k">alt</span><span class="dl">&quot;</span></span>=&gt;<span class="s"><span class="dl">&quot;</span><span class="k">Cobblers</span><span class="dl">&quot;</span></span>, <span class="s"><span class="dl">&quot;</span><span class="k">width</span><span class="dl">&quot;</span></span>=&gt;<span class="s"><span class="dl">&quot;</span><span class="k">240</span><span class="dl">&quot;</span></span>}
</code></pre>
</div>
</div>
<pre><code>
ruby -rrubygems -ropen-uri -e "require 'hpricot';(Hpricot.parse(open('http://www.amazon.com/gp/product/1844300439/ref=amb_cob_bh_194691301/002-0086113-2532879?n=283155')).search(\"//table//td[@id='prodImageCell']\")/:img).each {|link| p link.attributes }"
</code></pre>
<p>Amazing stuff really.  The parser is so amazingly fast.  All the time is spent fetching the page, not parsing!</p>
<p>Also, &#8220;Sunset, Sunrise&#8221; by Razor Ramon is awesome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2006/07/06/parsing-amazon-with-hpricot/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>RubySig using Why&#8217;s Remote Require!</title>
		<link>http://www.ralree.com/2006/06/22/rubysig-using-whys-remote-require/</link>
		<comments>http://www.ralree.com/2006/06/22/rubysig-using-whys-remote-require/#comments</comments>
		<pubDate>Thu, 22 Jun 2006 17:14:31 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[poignant]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[require]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[signature]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/rubysig-using-whys-remote-require</guid>
		<description><![CDATA[Using Why&#8217;s insane URI require stuff, I revised my sig by making a file called rubysig.txt on modzer0:



$_=[1165125995,541553253,1734811772,543711598,1799381356,1634954081,778396789,545005639,1346849637,2033852464,2016687683,825700673,48];$/=&#34;&#34;;:c.id2name.hex.times{$/&#60;&#60;78.chr};$/&#60;&#60;99.chr;$\=$_.pack($/);puts$\



and calling it like this:



ruby -ropen-uri -e 'eval(open(&#34;http://modzer0.cs.uaf.edu/~hardwarehank/rubysig.txt&#34;).read)'



I just made a DNS redirect for the URL at sig.ralree.info so soon it will be this:



ruby -ropen-uri -e 'eval(open(&#34;http://sig.ralree.info&#34;).read)'



Yay for Why!
]]></description>
			<content:encoded><![CDATA[<p>Using <a href="http://redhanded.hobix.com/bits/stowingYerLibrariesOffInTheCutNPaste.html">Why&#8217;s insane URI require stuff</a>, I revised my sig by making a file called rubysig.txt on modzer0:</p>
<div class="CodeRay">
<div class="code">
<pre><code>
<span class="gv">$_</span>=[<span class="i">1165125995</span>,<span class="i">541553253</span>,<span class="i">1734811772</span>,<span class="i">543711598</span>,<span class="i">1799381356</span>,<span class="i">1634954081</span>,<span class="i">778396789</span>,<span class="i">545005639</span>,<span class="i">1346849637</span>,<span class="i">2033852464</span>,<span class="i">2016687683</span>,<span class="i">825700673</span>,<span class="i">48</span>];<span class="gv">$/</span>=<span class="s"><span class="dl">&quot;</span><span class="dl">&quot;</span></span>;<span class="sy">:c</span>.id2name.hex.times{<span class="gv">$/</span>&lt;&lt;<span class="i">78</span>.chr};<span class="gv">$/</span>&lt;&lt;<span class="i">99</span>.chr;<span class="gv">$\</span>=<span class="gv">$_</span>.pack(<span class="gv">$/</span>);puts<span class="gv">$\</span>
</code></pre>
</div>
</div>
<p>and calling it like this:</p>
<div class="CodeRay">
<div class="code">
<pre><code>
ruby -ropen-uri -e <span class="s"><span class="dl">'</span><span class="k">eval(open(&quot;http://modzer0.cs.uaf.edu/~hardwarehank/rubysig.txt&quot;).read)</span><span class="dl">'</span></span>
</code></pre>
</div>
</div>
<p>I just made a DNS redirect for the URL at <strong>sig.ralree.info</strong> so soon it will be this:</p>
<div class="CodeRay">
<div class="code">
<pre><code>
ruby -ropen-uri -e <span class="s"><span class="dl">'</span><span class="k">eval(open(&quot;http://sig.ralree.info&quot;).read)</span><span class="dl">'</span></span>
</code></pre>
</div>
</div>
<p>Yay for Why!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2006/06/22/rubysig-using-whys-remote-require/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPod Linux Journey Begins</title>
		<link>http://www.ralree.com/2006/05/28/ipod-linux-journey-begins/</link>
		<comments>http://www.ralree.com/2006/05/28/ipod-linux-journey-begins/#comments</comments>
		<pubDate>Sun, 28 May 2006 13:08:03 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[kazehakaze]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/ipod-linux-journey-begins</guid>
		<description><![CDATA[Intro
I wrote a HOWTO
on compiling the iPod Linux Installer.  Once I got it compiled, I could not get it to recognize my iPod, so I decided to do it by hand, which was very easy.  I started with my 20GB 4th Generation iPod, which was had dead batteries for quite a while.  [...]]]></description>
			<content:encoded><![CDATA[<h3>Intro</h3>
<p>I wrote a <a href="http://ipodlinux.org/Building_Installer#Building_under_Linux">HOWTO</a><br />
on compiling the iPod Linux Installer.  Once I got it compiled, I could not get it to recognize my iPod, so I decided to do it by hand, which was very easy.  I started with my 20GB 4th Generation iPod, which was had dead batteries for quite a while.  I created a giant FAT32 Partition on it and formatted it, then I downloaded the latest iPod update software in Windows.  I used the software to <strong>Restore</strong> my iPod to a clean slate Apple OS WinPod configuration.  Then, I rebooted, and used the iPodLinux wiki as a guide.  </p>
<p>I found their wiki is a bit cumbersome to use since some of the information is outdated.  So, I decided to log my experience here.</p>
<h3>Firmware</h3>
<p>First, I needed to back up the original firmware to disk for integration into the new Loader firmware, as well as just to back it up for restoration.  First, I plugged in my iPod, and saw it was initialized to <em>/dev/sda</em>.  I then followed <a href="http://ipodlinux.org/Loader_2#Preparation_.28once.29">these</a> instructions, backing up and patching my firmware.  Basically, you need to get <a href="http://ipodlinux.org/Make_fw">make_fw</a> first.  I got the <a href="http://ipodlinux.org/images/6/66/Make_fw-linux-i386.tgz">x86 Linux build</a>, which worked fine.  This is basically it:</p>
<pre><code>
# dd if=/dev/sda1 of=orig_firmware.bin
$ ./make_fw -o apple_os.bin -e 0 orig_firmware.bin
$ ./make_fw -g 4 -v -o my_sw.bin -i apple_os.bin loader.bin
</code></pre>
<p>I then needed to partition my iPod to accept the Linux partition, as well as to resize the wasteful firmware partition.  I used the following configuration:</p>
<p>Then I disk-dumped the firmware I generated onto the firmware partition of the iPod</p>
<pre><code>
# dd if=my_sw.bin of=/dev/sda1
</code></pre>
<p>That done, I partitioned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2006/05/28/ipod-linux-journey-begins/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.447 seconds -->
