<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.2" -->
<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/"
	>

<channel>
	<title>Nat Friedman</title>
	<link>http://nat.org/blog</link>
	<description></description>
	<pubDate>Sat, 08 Nov 2008 21:04:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>
	<language>en</language>
			<item>
		<title>Happy Saturday</title>
		<link>http://nat.org/blog/?p=831</link>
		<comments>http://nat.org/blog/?p=831#comments</comments>
		<pubDate>Sat, 08 Nov 2008 12:18:23 +0000</pubDate>
		<dc:creator>nat</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nat.org/blog/?p=831</guid>
		<description><![CDATA[Thursday night at dinner, one of Stephanie's colleagues gave me a puzzle to play with.

The idea is to twist and turn the little blocks until they form a 3&#215;3x3 cube.  This morning, after messing with it for a few minutes, I decided I didn't want to brute-force it manually.  So I wrote a little script.

And [...]]]></description>
			<content:encoded><![CDATA[<p>Thursday night at dinner, one of Stephanie's colleagues gave me a puzzle to play with.</p>
<p><img src="http://nat.org/puzzle-start.jpg" align="middle" height="450" hspace="20" vspace="20" width="600" /></p>
<p>The idea is to twist and turn the little blocks until they form a 3&#215;3x3 cube.  This morning, after messing with it for a few minutes, I decided I didn't want to brute-force it manually.  So I wrote a little script.</p>
<p><img src="http://nat.org/xedczk.png" align="middle" height="574" hspace="20" vspace="20" width="678" /></p>
<p>And that, my friends, is just about a perfect Saturday morning.</p>
<p><img src="http://nat.org/puzzle-complete.jpg" align="middle" height="450" hspace="20" vspace="20" width="600" /></p>
<p>(The script is <a href="http://nat.org/puzzle.rb">here</a>.)</p>
]]></content:encoded>
			<wfw:commentRss>http://nat.org/blog/?feed=rss2&amp;p=831</wfw:commentRss>
		</item>
		<item>
		<title>Geeks Fighting Corruption</title>
		<link>http://nat.org/blog/?p=830</link>
		<comments>http://nat.org/blog/?p=830#comments</comments>
		<pubDate>Fri, 17 Oct 2008 21:42:52 +0000</pubDate>
		<dc:creator>nat</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nat.org/blog/?p=830</guid>
		<description><![CDATA[One of the things I'm really hopeful about is technology that can improve the transparency of government.  Money is a corrupting influence in politics, but websites that track every campaign contribution, contract bid, earmark author, and the passage of every bill through its development give corrupt politicians and self-interested lobbyists nowhere to hide.  [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things I'm really hopeful about is technology that can improve the transparency of government.  Money is a corrupting influence in politics, but websites that track every campaign contribution, contract bid, earmark author, and the passage of every bill through its development give corrupt politicians and self-interested lobbyists nowhere to hide.  And that's a good thing.  Sunlight, as Supreme Court Justice Louis Brandeis said, is the best disinfectant.</p>
<p>When Larry Lessig announced <a href="http://www.lessig.org/blog/2007/06/required_reading_the_next_10_y.html">his campaign to end corruption in politics</a>, he started encouraging hackers to attack this problem, to build websites and databases that lay bare the innerworkings of our politics.  There are a few well-known projects in this area, like <a href="http://www.sunlightfoundation.com/">The Sunlight Foundation</a>, <a href="http://www.opensecrets.org/">Open Secrets</a>, and <a href="http://www.followthemoney.org/">followthemoney.org</a>.  There's also <a href="http://www.usaspending.gov">USASpending.gov</a>, the website "where Americans can see where their money goes," the product of a law co-sponsored by Barack Obama.</p>
<p><img src="http://waldo.jaquith.org/images/photos/waldo/ac200605-thumb.jpg" title="Waldo Jaquith" alt="Waldo Jaquith" align="right" height="187" hspace="20" vspace="20" width="150" />Recently on twitter I learned that Charlottesville provocateur and long-time friend <a href="http://waldo.jaquith.org/">Waldo Jaquith</a> created and runs <a href="http://www.richmondsunlight.org/">Richmond Sunlight</a>, a one-man sunlight site to track Virginia state politics.  On it, you can track the progress of bills and the activities of the legislators in the Virginia state congress.  The site has no ads and no for-pay section and Waldo runs it purely because he believes in what he's doing.</p>
<p>Running the site takes a huge amount of work, and a little money.  One of Richmond Sunlight's most important features is the collection of <a href="http://www.richmondsunlight.org/minutes">videos of the Virginia General Assembly</a>.  To get these videos online, Waldo has to manually convert DVDs provided by the state into a format suitable for posting online.   It's a lengthy process that involves OCRing parts of the video to extract bill numbers and legislator names to index and tag the videos properly.  He's doing all this on his only computer &#8212; an aging Mac Mini.  And unbelievably, Waldo actually has to <em>purchase</em> these videos from the General Assembly.  And he has ambitious plans for the site.  Last night Waldo posted an <a href="http://waldo.jaquith.org/blog/2008/10/richmond-sunlight-plea/">appeal for resources to help him grow the project</a>:</p>
<blockquote><p><em>While hundreds of thousands of people have found the site very useful, I look at it and see unfulfilled promise. I want to rewrite Richmond Sunlight and give it away to a nonpartisan political group in every state in the union. I want to complete the API so that anybody can write software to interact with the Capital Sunlight in their own state (and let <a href="http://waldo.jaquith.org/blog/2008/01/rs-daily-press/">even more newspapers</a> integrate it into their own websites). I want a Facebook application, I want daily podcasts, I want people recording secret subcommittee votes, I want to mash up the daily floor calendar with campaign finance data with minutes with video and create the most radical transparency a state legislature has ever seen.</em></p></blockquote>
<p>Waldo is doing exactly what Larry Lessig is encouraging us all to do.  He's dreaming big about open government.  But he needs help today to do the daily business of running <a href="http://www.richmondsunlight.org/">Richmond Sunlight</a>.  So, what do you say we pitch in to help a corruption-fighting geek in need?  If you'd like to help <a href="http://waldo.jaquith.org/blog/2008/10/richmond-sunlight-plea/">buy Waldo a new computer</a> so that he can put these videos online faster without spending his whole weekend swapping discs and waiting for codecs to convert, <a href="http://waldo.jaquith.org/blog/2008/10/richmond-sunlight-plea/">visit his blog and drop him a line</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nat.org/blog/?feed=rss2&amp;p=830</wfw:commentRss>
		</item>
		<item>
		<title>Love (and blogging)</title>
		<link>http://nat.org/blog/?p=829</link>
		<comments>http://nat.org/blog/?p=829#comments</comments>
		<pubDate>Sun, 07 Sep 2008 23:00:19 +0000</pubDate>
		<dc:creator>nat</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nat.org/blog/?p=829</guid>
		<description><![CDATA[It's been a while since I wrote regularly on this blog, and people have been asking, with decreasing regularity, why my blog posts sputtered out.
At first, I wanted to take a break to shake off the "I can't wait to blog about this" impulse that was starting to spring up in the middle of almost [...]]]></description>
			<content:encoded><![CDATA[<p>It's been a while since I wrote regularly on this blog, and people have been asking, with decreasing regularity, why my blog posts sputtered out.</p>
<p>At first, I wanted to take a break to shake off the "<em>I can't wait to blog about this</em>" impulse that was starting to spring up in the middle of almost everything I was doing, and was threatening the in-the-moment joy of life's little adventures by making them into a kind of low-grade performance literature.</p>
<p>Then, in early 2007, I moved to Munich and got busy learning about another culture.  Moving to a new place has a way of disrupting all your old habits, so I stopped going to yoga and I stopped posting here, but I started programming a lot again (yay!), and running a few times a week.</p>
<p>And then <a href="http://twitter.com/natfriedman">twitter</a> erupted into my social group like an invasive species and I found that my public-writing energy nibbled away bit by bit, never building past whatever critical threshold is required for something to be (dare I say) <em>bloggable</em>.</p>
<p>And then, unexpectedly, at a conference in Paris, I met the most dazzling girl.  Smart and kind-hearted, and with an incredible appetite for life, she lived in Munich.  When I moved here, she helped me find an apartment and get settled.  Somewhere in there, she completely stole my heart.  And so, earlier this year, on a hill in San Francisco, I asked her to be my wife, and she said "why the hell not" (I'm paraphrasing here).</p>
<p><center><img src="http://nat.org/stephanie-timessquare.jpg" alt="Stephanie" title="Stephanie" align="middle" height="467" width="700" /></center> </p>
<p>We both love to travel, and she's amused by my sense of whimsy.  Over the last year we've had a lot of fun running around Europe.  (More on that later.) And so I've found someone I want to share life's adventures with, and you guys have recently taken second priority.  Sorry about that, but I'm sure you can understand :-).</p>
<p><center><img src="http://nat.org/gondola.jpg" height="750" width="500" /></center></p>
<p>We do plan to have an actual wedding sometime next year, though we're not sure exactly when or where.  So, stay tuned for future episodes, now featuring Stephanie (introductory glam shot below).</p>
<p><center><img src="http://nat.org/superstephanie.jpg" height="528" width="700" /></center></p>
]]></content:encoded>
			<wfw:commentRss>http://nat.org/blog/?feed=rss2&amp;p=829</wfw:commentRss>
		</item>
		<item>
		<title>We're Hiring</title>
		<link>http://nat.org/blog/?p=828</link>
		<comments>http://nat.org/blog/?p=828#comments</comments>
		<pubDate>Tue, 20 May 2008 14:49:58 +0000</pubDate>
		<dc:creator>nat</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nat.org/blog/?p=828</guid>
		<description><![CDATA[
One of my most fun responsibilities at Novell is running the SUSE Incubation Team: a  small team of developers focused on innovation, prototyping, and exploratory hacking.  Our charter is to come up with disruptive ideas that take Novell's Linux business in exciting new directions.
The team is a diverse group, ranging from web developers who love [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://nat.org/novell-hiring.png" title="We're Hiring" alt="We're Hiring" height="200" align="right" width="200" /></p>
<p>One of my most fun responsibilities at Novell is running the SUSE Incubation Team: a  small team of developers focused on innovation, prototyping, and exploratory hacking.  Our charter is to come up with disruptive ideas that take Novell's Linux business in exciting new directions.</p>
<p>The team is a diverse group, ranging from web developers who love working in Ruby on Rails to kernel hackers and virtualization experts, and it's a great privilege to work with them.  We have an upbeat culture that's tolerant of experimentation, we're obsessive about delivering innovative and amazing experiences to our users, and we hold each other to high standards.  Besides our exploratory development work, the team is also responsible for running the twice-a-year <a href="http://arstechnica.com/articles/culture/novell-hack-week-an-experiment-in-innovation.ars" title="Ars Technica Article about the first Hack Week">SUSE Hack Week</a>.</p>
<p>As it happens, one of our projects &#8212; an innovative web application &#8212; is starting to look promising and so we're working on getting it ready for a limited public beta.  And we're looking for a few talented, energetic developers to help us get there.</p>
<p>The job descriptions are below.  Keep in mind that we're not looking for specialists: we're a small team, and we need people who are willing and happy to shift gears whenever necessary.</p>
<p>If any of these sound interesting to you, <a href="mailto:cambrian@novell.com?subject=Job" title="Email us" target="_blank">mail us</a> your CV/resume.</p>
<p>We're open to hiring people<em> in any location</em>, but we have a slight preference for people who can work in Nürnberg, Germany, and a preference for people close to the UTC+1 timezone.  We offer competitive salaries and benefits in a fun, tight-knit team.</p>
<h3>Quality Engineer</h3>
<p>If               you believe that quality is priority one and that great QA also means               writing code, then this could be the job for you.  We are looking for a skilled               programmer to help create and run a robust testing environment for an               innovative new web service.</p>
<p>Your responsibilities will include building and maintaining a test               harness and test environments; automating UI testing of our web application; monitoring and analyzing test results; helping to fill in unit and               functional tests; creating test environments; and playing the role of bugmaster in our               bugzilla.</p>
<p>The ideal person will be a strong programmer who can tell a good bug report from a bad               one, will consider themself a whiz at scripting (shell, perl -               whatever works for you), and will enjoy understanding the ins and outs of a sophisticated system.</p>
<h3>Deployment and Release Engineer</h3>
<p>Interested in designing and operating a streamlined deployment architecture for a cluster of several hundred cores?  We are looking for an               engineer to architect and manage the build, release and deployment infrastructure for our new web service.</p>
<p>Your responsibilities will include creating and maintaining deployment               scripts; creating deployable packages and images; system               administration of production machines; building RPM packages and               virtual images to simplify deployment; and setting up and maintaining               a cluster monitoring infrastructure.</p>
<p>Linux packaging and system administration skills, and experience deploying web applications are a must;               experience with Ruby on Rails is a plus; solid programming skills and a strong focus on delivering a great user experience are              required.  Infrequent travel to our data center in Boston will also be required.</p>
<h3>Developer</h3>
<p>This position will be working today on the core of our web application, which is mostly written in Ruby on Rails, Perl and in C.  Ideal candidates will be creative self-starters with a strong focus on user experience and performance, and will have good communication skills and experience working in teams.</p>
<p>Because of the nature of our team, we can't allow ourselves to be defined by the tools we happen to be using at any given time.  Today you might be writing Ruby on Rails, but tomorrow you could find yourself knee-deep in C: whatever it takes to get the job done.  Above all, we're looking for smart programmers who don't mind learning a new codebase or a new language overnight, and who are willing to hit a few dead ends before arriving at the perfect solution.  We're also looking for people who are good writers, and with good design skills.</p>
<p>If you're applying for this position, please send us some code that you've written that you're particularly proud of.</p>
]]></content:encoded>
			<wfw:commentRss>http://nat.org/blog/?feed=rss2&amp;p=828</wfw:commentRss>
		</item>
		<item>
		<title>Rack servers in Boston, make money</title>
		<link>http://nat.org/blog/?p=827</link>
		<comments>http://nat.org/blog/?p=827#comments</comments>
		<pubDate>Fri, 09 May 2008 20:17:41 +0000</pubDate>
		<dc:creator>nat</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nat.org/blog/?p=827</guid>
		<description><![CDATA[We're looking for a neat, meticulous person to help us rack and wire some servers next week, on Tuesday and Wednesday.  The tasks are unboxing, carrying, mounting, screwing, wiring, and testing the servers.   Pay is $20/hour, duration is until we're done, location is in Waltham (we'll pay for your transport).
If you're interested, send [...]]]></description>
			<content:encoded><![CDATA[<p>We're looking for a neat, meticulous person to help us rack and wire some servers next week, on Tuesday and Wednesday.  The tasks are unboxing, carrying, mounting, screwing, wiring, and testing the servers.   Pay is $20/hour, duration is until we're done, location is in Waltham (we'll pay for your transport).</p>
<p>If you're interested, send mail to <a href="mailto:pzb@novell.com">pzb@novell.com</a> and mention any relevant experience or skills.</p>
]]></content:encoded>
			<wfw:commentRss>http://nat.org/blog/?feed=rss2&amp;p=827</wfw:commentRss>
		</item>
		<item>
		<title>More Tweetable Scripts</title>
		<link>http://nat.org/blog/?p=826</link>
		<comments>http://nat.org/blog/?p=826#comments</comments>
		<pubDate>Sun, 27 Apr 2008 13:23:02 +0000</pubDate>
		<dc:creator>nat</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nat.org/blog/?p=826</guid>
		<description><![CDATA[ A few more tweetable commandlines have emerged since I posted the last round-up.
From pupitetris, this little work of art:
a=1;for i in {1..34};do printf %$[40-${#a}]s"$(eval $(echo $a*$a&#124;bc&#124;sed 's/$/0/;s/\([0-9]\)/tput setab \1; echo -n \\ ;/g'))"\\n;a=1$a;done
This Linux-specific commandline from Justin:
s=.o0O0o.o0O0o.o0O0o.o0O0o.o0O0o.o0O0o.o0;n(){ for x in `seq $1 $2 $3`;do notify-send ${s:0:x}; done };while :;do n 1 2 39;n 39 [...]]]></description>
			<content:encoded><![CDATA[<p> A few more tweetable commandlines have emerged since I posted <a href="http://nat.org/blog/?p=825" title="the last round-up">the last round-up</a>.</p>
<p><span class="entry-title entry-content">From <a href="http://twitter.com/pupitetris" title="pupitetris">pupitetris</a>, this little work of art:</span></p>
<p><strong><span class="entry-title entry-content">a=1;for i in {1..34};do printf %$[40-${#a}]s"$(eval $(echo $a*$a|bc|sed 's/$/0/;s/\([0-9]\)/tput setab \1; echo -n \\ ;/g'))"\\n;a=1$a;done</span></strong></p>
<p>This Linux-specific commandline from <a href="http://www.bouncybouncy.net" title="Justin">Justin</a>:</p>
<p><strong>s<span class="entry-title entry-content">=.o0O0o.o0O0o.o0O0o.o0O0o.o0O0o.o0O0o.o0;n(){ for x in `seq $1 $2 $3`;do notify-send ${s:0:x}; done };while :;do n 1 2 39;n 39 -2 1;done</span></strong></p>
<p>And I wrote these two:</p>
<p><strong><span class="entry-title entry-content"> 			  clear;for x in {0..150}; do y=`echo "12+6*s($x/6)"|bc -l|cut -d. -f 1`;echo -en \\e[$y\;"$(($x/2))"HX; sleep .1;done  			</span></strong></p>
<p><strong> s=`seq 9|shuf`;while :;do for((i=0;i&lt;15;i+=2));do echo $s;a=${s:i:1};b=${s:i+2:1};[ $a -gt $b ]&amp;&amp;s=${s:0:i}$b\ $a${s:i+3};sleep .2;done;done</strong></p>
<p>That last one is a bubble-sort implementation in 140 characters.   Unfortunately, 140 characters is one character too many for a twitter post.  Can you figure out how to shave off a character or two? (You'll need a recent version of coreutils for <em>shuf</em>).</p>
<p>Thanks to some helpful hints in the comments (<a href="http://abock.org">abock</a>, <a href="http://debain.org/">knipknap</a>, Mitch) we're down to 137 chars:</p>
<p><strong>s=`shuf -i1-9`;while i=;do for((;i&lt;15;i+=2));do echo $s;a=${s:i:1};b=${s:i+2:1};[ $a \&gt; $b ]&amp;&amp;s=${s:0:i}$b\ $a${s:i+3};sleep .2;done;done</strong></p>
<p>I'll be posting more <a href="http://twitter.com/natfriedman" title="on twitter">on twitter</a> as people send them in.</p>
]]></content:encoded>
			<wfw:commentRss>http://nat.org/blog/?feed=rss2&amp;p=826</wfw:commentRss>
		</item>
		<item>
		<title>Ten Tweetable Scripts</title>
		<link>http://nat.org/blog/?p=825</link>
		<comments>http://nat.org/blog/?p=825#comments</comments>
		<pubDate>Fri, 11 Apr 2008 14:09:21 +0000</pubDate>
		<dc:creator>nat</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nat.org/blog/?p=825</guid>
		<description><![CDATA[Yesterday morning I proposed a contest to create the best one-line program that would fit inside Twitter's 140-character buffer.  To kick things off, I wrote this 105-character script which displays a small animation:
s="-&#60;";while true;do echo -ne "$s\r";s=`sed 's/-&#62;$/-&#60;-/;s/^&#60;/&#62;/;s/-&#60;/&#60;-/;s/&#62;-/-&#62;/;'&#60;&#60;&#60;$s`;sleep 0.1;done
Arturo (or Pupi as his friends call him) wrote a 135-character morse code decoder in shell: [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday morning <a href="http://nat.org/blog/?p=824">I proposed a contest</a> to create the best one-line program that would fit inside Twitter's 140-character buffer.  To kick things off, I wrote this 105-character script which displays a small animation:</p>
<p><strong>s="-&lt;";while true;do echo -ne "$s\r";s=`sed 's/-&gt;$/-&lt;-/;s/^&lt;/&gt;/;s/-&lt;/&lt;-/;s/&gt;-/-&gt;/;'&lt;&lt;&lt;$s`;sleep 0.1;done</strong></p>
<p>Arturo (or Pupi as his friends call him) wrote a 135-character <a href="http://en.wikipedia.org/wiki/Morse_code">morse code</a> decoder in shell:<strong><span class="entry-title entry-content"> </span></strong><strong><span class="entry-title entry-content"></span></strong></p>
<p><strong><span class="entry-title entry-content">m=etianmsurwdkgohvf?l?pjbxcyzq;p=0;while read -sn1 c;do [ -z "$c" ]&amp;&amp;p=0&amp;&amp;echo&amp;&amp;continue;let p+=c;echo -ne \\b${m:$p:1};let p+=p+2;done</span></strong></p>
<p>Press '0&#8242; for dot, '1&#8242; for dash, and hit space (or enter) as a char separator.  Wow!</p>
<p>I learned a few tricks from Arturo's script.  First, he uses the ${} braces operator to take substrings, like so:</p>
<p>${var:offset:length}</p>
<p>This is incredibly useful!  You can actually do shell arithmetic in the offset and length parameters, too.  So for example,</p>
<p>${var:i+1:a-3}</p>
<p>is valid for shell variables $i and $a.  And to find the length of a string, you can  use:</p>
<p>${#str}</p>
<p>So<strong> str="foobar"; echo ${#str} </strong>will print "6".  You can read more about the braces operator in the <a href="http://www.delorie.com/gnu/docs/bash/bashref_29.html">bash info page</a>.</p>
<p>Another thing I learned from Arturo's script is the versatility of the 'read&#8217; builtin in bash.  Pupi uses the -s argument, which causes read not to echo its input (useful for inputting passwords) and -n1 which tells it to only read one character. Also, Arturo uses [ test] &amp;&amp; operation, which is a handy short-hand for an if statement in shell (and other languages).</p>
<p><a href="http://twitter.com/pixelbeat_/statuses/786563202">Pádraig Brady</a> wrote this excellent screensaver:</p>
<p><strong>tr -c "[:digit:]" " " &lt; /dev/urandom | dd cbs=$COLUMNS conv=lcase,unblock | GREP_COLOR="1;32" grep --color "[^ ]"</strong></p>
<p><span class="fn">Pádraig  makes use of the square-brace character class operator in tr(1) to filter out all the numerals, which bash </span><span class="fn"><a href="http://www.dc.turkuamk.fi/docs/gnu/bash/bashref.html#SEC35">also supports</a>.</span></p>
<p>Building on what I learned from Pupi, here is one I wrote that I call paint.sh:</p>
<p><strong>c=12322123;x=20;y=20;while read -sn1 p;do k=${c:(p-1)*2:2};let x+=$((k/10-2));let y+=$((k%10-2));echo -en \\033[$y\;"$x"HX;done<br />
</strong><br />
Use the 1 2 3 and 4 keys to move the cursor around the screen.  It's  an etch-a-sketch for your terminal!   You can see that I made use of the read -sn1 trick from pupi as well as the braces operator to substring.   I also used <a href="http://en.wikipedia.org/wiki/ANSI_escape_code">ANSI escape codes</a> to position the cursor.</p>
<p>And this is one I call rockband.sh (<strong>Updated</strong> - works much better now!):</p>
<p><strong>while read -sn1 p;do s="";for((i=0;i&lt;$p;i++));do s=x$s;done; yes $s &gt; /dev/audio&amp;sleep 0.1;kill %%;done<br />
</strong><br />
Use the number keys to play different tones.   When you're done, hit Control-c.</p>
<p>The way it works is that the ASCII value of each character you send to /dev/audio specifies the excursion of the speaker diaphragm (roughly).   The 'yes&#8217; command prints whatever string you give it, followed by a newline character (ASCII 13, pretty low), over and over again.  So the longer the string of 'x&#8217; characters you pass to 'yes', and which 'yes&#8217; prints between newlines, the slower the oscillation of the speaker diaphragm, and the lower the tone.  Neat, huh?  I learned this trick from my boyhood friend <a href="http://www.cis.upenn.edu/~edloper/">Edward Loper</a> many years ago.</p>
<p>And here's the last one I wrote:</p>
<p><strong> s=" #55755071317011117011117075557";for i in `seq 2 $((${#s}-1))`; do k=${s:i:1}; for b in 1 2 4; do echo -n "${s:(k&amp;b)/b:1}"; done; echo; done</strong></p>
<p><a href="http://twitter.com/migueldeicaza/statuses/786967147">Miguel submitted</a> this tiny function plotter:</p>
<p><strong><span class="entry-title entry-content">for x in `seq -1 .05 1`; do y=`echo "s($x*8)*10+10" | bc -l`; for p in `seq 0 $y`; do echo -n " "; done; echo "*" ;done</span></strong></p>
<p>And here's another plot:</p>
<p><strong><span class="entry-title entry-content"> for x in `seq -5 .5 5`; do y=`echo "$x*$x" | bc`; for p in `seq 0 $y`; do echo -n " "; done; echo "*" ;done </span></strong></p>
<p>Those last three scripts make use of the venerable "seq" command to generate a series of numbers.   Miguel uses fractional steps, but if you only need integers you can also use braces in shell, like this:</p>
<p><strong>sum=0;for i in {1..100}; do let sum+=i; done; echo $sum</strong></p>
<p>Ryan Paul of <a href="http://arstechnica.com/authors.ars/segphault">ArsTechnica fame</a> wrote <a href="http://twitter.com/segphault/statuses/786922118">this Ruby script</a>:</p>
<p><strong><span class="entry-title entry-content"> proc{|f|f[proc{|x|x+1},0]}[proc{|x,y|proc{|f,z|x[proc{|w|y[f,w]},z]}}[proc{|f,x|f[f[f[f[f[f[f[x]]]]]]]},proc{|f,x|f[f[f[f[f[f[x]]]]]]}]]  </span></strong></p>
<p>Ryan is using the "proc" primitive in Ruby, which allows you to create an anonymous function (like lambda in lisp), and which I didn't know about even though I've been coding Ruby off and on the last few months.  He uses <a href="http://en.wikipedia.org/wiki/Church_encoding">Church encoding</a> to encode the numbers 7 and 6, and lambda calculus to multiply them, thus confirming that he is the most awesome IT journalist working today.</p>
<p>Finally, Jay Wren sent in <a href="http://twitter.com/sillyevar/statuses/786468110">this C program</a>:</p>
<p><strong> <span class="entry-title entry-content">main(x,y){for(;x++;) for(y=2;x%y;)printf( ++y/x+"\0%d\n",x);}</span></strong></p>
<p>of which he is not the original author (and which I suspect was an <a href="http://www.ioccc.org/">IOCCC</a> entry), but which is a very compact way of generating all the prime numbers.  The author uses the args to main to save space on variable declaration, and the leading null-terminator in the string is a really clever way to select whether or not to print the output without an if statement.  Lots of cleverness in there (though the algorithm to find primes is just brute force).</p>
<p>There were too many good entries to declare a winner, and maybe a contest was the wrong idea anyway.  But this was a lot of fun.  If you want to <a href="http://twitter.com/natfriedman">send me a script on twitter</a>, be sure to send a "@natfriedman" message after, so that I notice you.</p>
]]></content:encoded>
			<wfw:commentRss>http://nat.org/blog/?feed=rss2&amp;p=825</wfw:commentRss>
		</item>
		<item>
		<title>Take the Tweetable Script Challenge</title>
		<link>http://nat.org/blog/?p=824</link>
		<comments>http://nat.org/blog/?p=824#comments</comments>
		<pubDate>Thu, 10 Apr 2008 13:37:39 +0000</pubDate>
		<dc:creator>nat</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nat.org/blog/?p=824</guid>
		<description><![CDATA[ Twitter limits posts ("tweets") to 140 characters.  This constraint makes sending updates to your friends challenging, but it makes programming more interesting.   I just tweeted this 105 character shell script:
s="-&#60;";while true;do echo -ne "$s\r";s=`sed 's/-&#62;$/-&#60;-/;s/^&#60;/&#62;/;s/-&#60;/&#60;-/;s/&#62;-/-&#62;/;'&#60;&#60;&#60;$s`;sleep 0.1;done
(Pasting from the tweet link seems to work a lot better than pasting from my blog &#8212; [...]]]></description>
			<content:encoded><![CDATA[<p> <a href="http://www.twitter.com/">Twitter</a> limits posts ("tweets") to 140 characters.  This constraint makes sending updates to your friends challenging, but it makes programming more interesting.   I <a href="http://twitter.com/natfriedman/statuses/786449030">just tweeted</a> this 105 character shell script:</p>
<blockquote><p>s="-&lt;";while true;do echo -ne "$s\r";s=`sed 's/-&gt;$/-&lt;-/;s/^&lt;/&gt;/;s/-&lt;/&lt;-/;s/&gt;-/-&gt;/;'&lt;&lt;&lt;$s`;sleep 0.1;done</p></blockquote>
<p>(Pasting from the <a href="http://twitter.com/natfriedman/statuses/786449030">tweet link</a> seems to work a lot better than pasting from my blog &#8212; not sure what wordpress is doing to that script) (Fixed - disabled smart quoting in wordpress).</p>
<p>Cute, huh? <img src='http://nat.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  But you can probably do better.  Tweet your one-liner, and then send a @natfriedman message on Twitter so that I notice it.  Best tweetable script posted today wins.  All the basic shell languages are allowed, but your script has to be pastable into the shell, i.e. "perl -e" is ok.</p>
]]></content:encoded>
			<wfw:commentRss>http://nat.org/blog/?feed=rss2&amp;p=824</wfw:commentRss>
		</item>
		<item>
		<title>Guns, Guts and God</title>
		<link>http://nat.org/blog/?p=823</link>
		<comments>http://nat.org/blog/?p=823#comments</comments>
		<pubDate>Sun, 30 Mar 2008 21:36:59 +0000</pubDate>
		<dc:creator>nat</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nat.org/blog/?p=823</guid>
		<description><![CDATA[ At dinner during a recent meeting of Democrats Abroad in Brussels, an articulate American investment banker from London recounted the story of a visit he'd made to a Republican gathering in the US where he learned that the unofficial motto of the Republican party is:

Guns, Guts and God make America great.  Republican Party.

This [...]]]></description>
			<content:encoded><![CDATA[<p> At dinner during a recent meeting of <a href="http://www.democratsabroad.org/">Democrats Abroad</a> in Brussels, an articulate American investment banker from London recounted the story of a visit he'd made to a Republican gathering in the US where he learned that the unofficial motto of the Republican party is:</p>
<blockquote></blockquote>
<p><em>Guns, Guts and God make America great.  Republican Party.</em></p>
<blockquote></blockquote>
<p>This pithy catchphrase impressed me.  In 9 words it defines a coalition of voters (church-goers, rural gun-owners, and military families), emphasizes strong patriotism, and sketches a personality that's instantly familiar to many people.</p>
<p>"So," he went on to ask, "what's the analogous slogan for Democrats?"</p>
<p>There were a lot of intelligent people at the table, and murmured discussion followed.  The closest anyone could get to a counterpart was the familiar "Strength through diversity."  But it doesn't pack the rhetorical punch of the Republican slogan.  In fact, it could be cynically interpreted as another way of saying "We couldn't agree on a motto."</p>
<p>I found myself wondering whether this was an inherent state of affairs.  In a two-party system, if one party comprises a well-defined coalition, the other party could end up picking up the scraps &#8212; and be left with such a diverse group of members that it would have trouble expressing common cause, except "we're not them."</p>
<p>Or maybe a group defined by its tolerance, rationality, and empiricism simply can't deliver the kind of bumper-sticker policy positions as the Republican party.</p>
<p>Certainly the division we see right now between the Obama and Clinton supporters hasn't happened in the Republican party, despite the fact that McCain is despised by many conservatives.</p>
<p>I was reminded of another quote I read recently:</p>
<blockquote></blockquote>
<p><em>A conservative is a liberal who got mugged and a liberal is a conservative who got arrested.</em></p>
<blockquote></blockquote>
<p>There's a symmetry in here which would seem to point the way to some kind of catchphrase.</p>
<p>Liberal political groups in other parts of the world manage to cohere well, and to express themselves compellingly.</p>
<p>Can you come up with a catchy slogan for the Democratic Party?</p>
]]></content:encoded>
			<wfw:commentRss>http://nat.org/blog/?feed=rss2&amp;p=823</wfw:commentRss>
		</item>
		<item>
		<title>Low-expectation microblogging</title>
		<link>http://nat.org/blog/?p=820</link>
		<comments>http://nat.org/blog/?p=820#comments</comments>
		<pubDate>Thu, 14 Feb 2008 14:31:38 +0000</pubDate>
		<dc:creator>nat</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nat.org/blog/?p=820</guid>
		<description><![CDATA[I started using twitter recently, at twitter.com/natfriedman.  One of the things that's nice about twitter is that no one expects you to say anything really interesting there. "Blogging for retards" is another way to put that.  It reminds me of Ze Frank's "keeping us company" (in a good way!).

]]></description>
			<content:encoded><![CDATA[<p>I started using twitter recently, at <a href="http://twitter.com/natfriedman">twitter.com/natfriedman</a>.  One of the things that's nice about twitter is that no one expects you to say anything really interesting there. "Blogging for retards" is another way to put that.  It reminds me of <a href="http://www.zefrank.com/">Ze Frank</a>'s "keeping us company" (in a good way!).</p>
<p><img src="http://nat.org/avatar.jpg" title="my avatar" alt="my avatar" height="116" width="116" /></p>
]]></content:encoded>
			<wfw:commentRss>http://nat.org/blog/?feed=rss2&amp;p=820</wfw:commentRss>
		</item>
	</channel>
</rss>
