<?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>Laughing Meme &#187; shell</title>
	<atom:link href="http://laughingmeme.org/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://laughingmeme.org</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 02 Apr 2012 20:12:19 +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>bceval: arbitrary precision math for PHP without extensions</title>
		<link>http://laughingmeme.org/2008/03/25/bceval-arbitrary-precision-math-for-php-without-extensions/</link>
		<comments>http://laughingmeme.org/2008/03/25/bceval-arbitrary-precision-math-for-php-without-extensions/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 20:50:38 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[big numbers]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://laughingmeme.org/2008/03/25/bceval-arbitrary-precision-math-for-php-without-extensions/</guid>
		<description><![CDATA[I needed arbitrary precision math in PHP, and wasn&#8217;t willing to rebuild PHP to add the bcmath extensions. All hail backticks. function bceval($expr) { return trim(`echo "$expr" &#124; bc`); } Used like so $end = bceval("$start + $batchsize - 1"); Wet cat territory.]]></description>
			<content:encoded><![CDATA[<p>I needed arbitrary precision math in PHP, and wasn&#8217;t willing to rebuild PHP to add the <a href="http://www.php.net/bc">bcmath</a> extensions.  All hail backticks.</p>

<pre><code>function bceval($expr) {
  return trim(`echo "$expr" | bc`);
}
</code></pre>

<p>Used like so</p>

<pre><code>$end = bceval("$start + $batchsize - 1");
</code></pre>

<p><a href="http://simonwillison.net/2003/Jun/24/philosophy/">Wet cat</a> territory.</p>
]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2008/03/25/bceval-arbitrary-precision-math-for-php-without-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shell Scripting and Agg Stats</title>
		<link>http://laughingmeme.org/2005/09/21/shell-scripting-and-agg-stats/</link>
		<comments>http://laughingmeme.org/2005/09/21/shell-scripting-and-agg-stats/#comments</comments>
		<pubDate>Thu, 22 Sep 2005 00:22:50 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[aggregation]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[stats]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=1136</guid>
		<description><![CDATA[Been a while since I dug into my aggregator stats (intrigued by FeedBurner mentioning their tracking 2000 aggregators), and while I&#8217;ve got my Perl script, but I was alarmed to realize that I had forgotten the shell for doing the equivalent. So killing time waiting for J I re-created it. Assumes you&#8217;re using Apache&#8217;s &#8220;full&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Been a while since I dug into my aggregator stats (intrigued by FeedBurner mentioning their <a href="http://www.burningdoor.com/feedburner/archives/001422.html">tracking 2000 aggregators</a>), and while I&#8217;ve got <a href="http://laughingmeme.org/code/parse_apache.pl">my Perl script</a>, but I was alarmed to realize that I had forgotten the shell for doing the equivalent.  </p>

<p>So killing time waiting for J I re-created it.  Assumes you&#8217;re using Apache&#8217;s &#8220;full&#8221; log format (and that your feed is &#8220;index.rdf&#8221;)</p>

<pre><code>sudo grep '/index.rdf' access.log | cut --delimiter=\" -f6,1 --output-delimiter="=" | 
sed 's/ - - \[[^=]*//' | sort | uniq | cut --delimiter="=" -f2 | sort | uniq -c | sort -n
</code></pre>

<p>Returns a count of unique IPs per User-Agent.  Tack on a little awk to get aggregate counts.</p>

<pre><code>| awk '{sum += $1; print sum}'
</code></pre>

<p>Of course folks like <a href="http://bloglines.com">Bloglines</a>, <a href="http://rojo.com">Rojo</a>, Yahoo FeedSeeker, Feedster, and FeedLounge (among others I&#8217;m sure) are rolling up the user counts. Of course FeedLounge and FeedSeeker are counted multiple times as they add time sensitive info to their User-Agent (that has got to be against some best practices!), and Bloglines comes from a couple of different IPs.</p>

<p>Interestingly, Google Desktop is showing up as generating not only the highest number of hits, but the highest number of 200s.</p>
]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2005/09/21/shell-scripting-and-agg-stats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Shell &#8211; an interactive eval environment with access to the current page.</title>
		<link>http://laughingmeme.org/2005/08/18/javascript-shell-an-interactive-eval-environment-with-access-to-the-current-page/</link>
		<comments>http://laughingmeme.org/2005/08/18/javascript-shell-an-interactive-eval-environment-with-access-to-the-current-page/#comments</comments>
		<pubDate>Thu, 18 Aug 2005 21:26:04 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[web2.0]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=2986</guid>
		<description><![CDATA[How come no one told me this existed?! Now I just need some time to play with it]]></description>
			<content:encoded><![CDATA[<p>How come no one told me this existed?!  Now I just need some time to play with it</p>
<p><a href='http://www.squarefree.com/shell/'>http://www.squarefree.com/shell/</a></p>]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2005/08/18/javascript-shell-an-interactive-eval-environment-with-access-to-the-current-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Kettle Dilemma and Growl</title>
		<link>http://laughingmeme.org/2004/12/04/the-kettle-dilemma-and-growl/</link>
		<comments>http://laughingmeme.org/2004/12/04/the-kettle-dilemma-and-growl/#comments</comments>
		<pubDate>Sun, 05 Dec 2004 02:24:08 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[kettle]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=968</guid>
		<description><![CDATA[I can be a little distracted at times, but the sight of a heavy, solid black kettle glowing an eery incandescent orange tends to rivet my attention. I don&#8217;t know about you but I have a habit on these cold wet nights to put a kettle on, and then start a project while waiting for [...]]]></description>
			<content:encoded><![CDATA[<p>I can be a little distracted at times, but the sight of a heavy, solid black kettle glowing an eery incandescent orange tends to rivet my attention.</p>

<p>I don&#8217;t know about you but I have a habit on these cold wet nights to put a kettle on, and then start a project while waiting for the water to boil.  And I get distracted, and come back a view hours later.  So inspired by a comment on <a href="http://www.macosxhints.com/article.php?story=20040922131625587">Remind as command-line iCal replacement</a>, I wrote a simple bash script to growl at me 5 minutes after I run it.</p>

<h3>Growl</h3>

<p>Download <a href="http://growl.info/downloads.php">Growl</a>, and <a href="http://growl.info/files/growlnotify.tgz">GrowlNotify</a>.  Install the Growl.dmg, and extract the growlnotify binary and copy it /usr/local/bin (or somewhere else in your path).  Now go to System preferences and turn on the Growl framework.</p>

<h3>No <code>at</code></h3>

<p>My first attempt was going to use <code>at</code>, but after fiddling for a  bit (and reaching out for expert assistance from Josh) I found the following line at the top of <code>at</code> man pages:</p>

<blockquote>
at, batch, atq, atrm are all disabled by default on Mac OS X.
</blockquote>

<h3>pure bash</h3>

<p>Rather then fiddle with overriding Apple&#8217;s descision in this matter, I did a little googling and figured out how to simulate what I wanted in bash.</p>

<p>Without further ado, my <code>kettle<em>is</em>on</code> script.</p>

<pre>
#!/bin/sh

DELAY=300
TITLE='Time to take the kettle off'
MSG='Seriously, new kettles are expensive'

{
sleep $DELAY
echo $MSG | growlnotify $TITLE 2&gt;/dev/null
} &#038;

</pre>

<p>Copy this into your path, and you should be all set.</p>

<h3>Obvious Improvements</h3>

<p>Obviously it would be nice if the script took arguments on the command line.  Even better would be if the notifications stuck around a little longer then the default 5 seconds.  But those are both for another night (wasted too much time on <code>at</code>)</p>

<p>Additionally this script is entirely incompatible with a good book, as with most other non-OS X running devices.</p>
]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2004/12/04/the-kettle-dilemma-and-growl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

