<?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>Denis Lemire&#039;s Site &#187; Code</title>
	<atom:link href="http://www.denis.lemire.name/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.denis.lemire.name</link>
	<description>Random musings of a technophile.</description>
	<lastBuildDate>Mon, 23 Jan 2012 05:00:41 +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>Hacking Prowl and Irssi</title>
		<link>http://www.denis.lemire.name/2009/07/07/prowl-irssi-hack/</link>
		<comments>http://www.denis.lemire.name/2009/07/07/prowl-irssi-hack/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 02:36:43 +0000</pubDate>
		<dc:creator>Denis Lemire</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tera-Byte]]></category>

		<guid isPermaLink="false">http://www.denis.lemire.name/?p=169</guid>
		<description><![CDATA[The moment I stumbled upon Prowl (a new iPhone App that routes Growl notifications to your iPhone via Apple&#8217;s push service) I knew I would find some powerful uses for it. At Tera-Byte, several of my colleagues telecommute. In order to stay in constant communication with each other, we all use good ol&#8217; IRC. In [...]]]></description>
			<content:encoded><![CDATA[<div><a href="http://prowl.weks.net/"><img src="/images/posts/prowl-logo.png" alt="" style="float: right; margin: -10px 10px 10px 10px" /></a></div>
<p> The moment I stumbled upon <a href="http://prowl.weks.net/">Prowl</a> (a new iPhone App that routes <a href="http://growl.info/">Growl</a> notifications to your iPhone via Apple&#8217;s push service) I knew I would find some powerful uses for it.</p>
<p>At Tera-Byte, several of my colleagues telecommute. In order to stay in constant communication with each other, we all use good ol&#8217; IRC. In order to be readily available and allow quick roaming from one location to an other, I use <a href="http://irssi.org/">Irssi</a>&#8216;s proxy module which runs continuously within a screen session on my co-located server.</p>
<p>On my Desktops and iPhone I run <a href="http://colloquy.info/">Colloquy</a> which connects to my Irssi proxy. Although push capabilities are planned for Colloquy, it&#8217;s not ready yet. Prowl appeared to be the perfect band-aid for the situation.</p>
<p><span id="more-169"></span></p>
<p>My original plan was to use Prowl as intended and have Colloquy&#8217;s Growl notifications directed to my iPhone. This had some limitations, most importantly it required leaving Colloquy running on my work desktop.</p>
<p>Fortunately the developer of Prowl provided <a href="http://prowl.weks.net/static/prowl.pl">an example perl script</a> to push notifications to Prowl independently of Growl. I&#8217;ve never attempted to work with Irssi script&#8217;s, but it appeared I had all the required pieces to build something clever.</p>
<p>I downloaded BCOW&#8217;s <a href="http://scripts.irssi.org/scripts/awayproxy.pl">awayproxy.pl</a> script as a starting point and began to hack away at it. The result: <a href="http://github.com/denislemire/prowl-irssi/raw/master/prowlnotify.pl">prowlnotify.pl</a>. </p>
<p>Change the prowluser and prowlpass lines then load this script into Irssi. While you&#8217;re connected to your proxy the script will do nothing. When your last IRC client disconnects it will push all subsequent public messages containing your nick as well as private messages to your iPhone via Prowl. How sweet it is!</p>
<p>Of course, this post would not be complete without an obligatory screenshot. Nobody appeared to have anything to say today, so I was down and out. In my desperation I called upon <a href="http://cshaiku.com/">cshaiku</a> to grace me with his words of wisdom:</p>
<p><img src="/images/posts/prowl-screenshot.png" alt="" style="display: block; margin-left: auto; margin-right: auto; margin-top: 10px margin-bottom: 10px; border: 1px solid red" /></p>
<p><strong>Update:</strong> I have now updated this script to use the new Prowl apikeys. Editing the script is no longer required. Simply copy your Prowl key into <em>~/.prowlkey</em>.</p>
<hr />
<p><strong>Another update:</strong> Every time I try to search Google for an Irssi plugin to work with Colloquy&#8217;s push notification feature instead of using Prowl I find my own page. Amusing, but not helpful!</p>
<p>Just found a <a href='http://static.ssji.net/colloquy_push.pl.txt'>Colloquy push script for Irssi</a> written by Nicolas Pouillon that does exactly that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.denis.lemire.name/2009/07/07/prowl-irssi-hack/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Running Motorola CNUT 3 on Mac OS X</title>
		<link>http://www.denis.lemire.name/2009/06/02/cnut3-osx/</link>
		<comments>http://www.denis.lemire.name/2009/06/02/cnut3-osx/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 04:35:43 +0000</pubDate>
		<dc:creator>Denis Lemire</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.denis.lemire.name/?p=143</guid>
		<description><![CDATA[Almost a week short of two years ago I ported Motorola&#8217;s CNUT tool to OS X. I originally did so to satisfy my personal use but also decided to share the package for others who fall into the tiny niche of being responsible for the administration of Canopy networks and wanting to use OS X [...]]]></description>
			<content:encoded><![CDATA[<div><a href="http://www.canopywireless.com"><img src="/images/posts/CanopyCluster.png" alt="" style="float: right; margin: 10px" /></a></div>
<p> Almost a week short of two years ago I <a href="http://www.denis.lemire.name/2007/06/06/cnut-osx/">ported Motorola&#8217;s CNUT tool</a> to OS X. I originally did so to satisfy my personal use but also decided to share the package for others who fall into the tiny niche of being responsible for the administration of Canopy networks and wanting to use OS X to do so.</p>
<p>As my need lessened for such a package due to a change in positions and responsibilities, the package was neglected shortly after. Although the original package still works, Canopy firmware 9.0 and later require the use of CNUT 3.x.</p>
<p><span id="more-143"></span></p>
<p>Due, however, to <strong>overwhelming</strong> pressure from the users of the original ports (or comments from three different users, rather), I have decided its high time to fill the niche once again.</p>
<h3>Good news, everyone!</h3>
<p>CNUT 3.12.3 (the latest release as of this writing) now runs natively on OS X! The new <a href="http://www.denis.lemire.name/download/cnut-3.12.3_1.dmg">package</a> has been tested (meaning it appears to run) on OS X Leopard. I haven&#8217;t tested it on previous releases or attempted any actual AP or SM upgrades using the utility, but I have little reason to believe it doesn&#8217;t work. As I no longer regularly roll out Canopy updates, I&#8217;ll depend on the feedback of whomever downloads the package to determine if it works as well as the previous package.</p>
<p><strong>The usual disclaimer as per the previous release:</strong> if my attempt at being helpful caused your Canopy Network to be annihilated in a fierce and fiery disaster of biblical proportions and voids your Canopy warranty, I hereby disclaim all liability.</p>
<p>In addition, this release is by no means endorsed, authorized or supported by Motorola. It contains their intellectual property including copyrighted and unaltered but substantially repackaged Java byte code and Trademarks.</p>
<p>The package is being distributed with good intentions based on the concept of a community of users improving the solutions used for the greater good of the community.</p>
<p>If Motorola’s legal department becomes offended at the existence and distribution of this package, I will of course have to remove it. Though I am sincerely hoping they recognize this as a useful contribution.</p>
<p>You&#8217;re welcome. <img src='http://www.denis.lemire.name/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.denis.lemire.name/2009/06/02/cnut3-osx/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Running Motorola CNUT on Mac OS X</title>
		<link>http://www.denis.lemire.name/2007/06/06/cnut-osx/</link>
		<comments>http://www.denis.lemire.name/2007/06/06/cnut-osx/#comments</comments>
		<pubDate>Thu, 07 Jun 2007 04:29:39 +0000</pubDate>
		<dc:creator>Denis Lemire</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Triton]]></category>

		<guid isPermaLink="false">http://www.denis.lemire.name/2007/06/06/cnut-osx/</guid>
		<description><![CDATA[The AirSurfer WISP network I manage for Triton Networking Solutions Ltd. utilizes hundreds of Motorola Canopy Subscriber modules to connect individual broadband clients to our network. In order to mass manage these devices, Motorola provides CNUT. CNUT is a great tool, but in spite of the fact that it was written in cross platform languages [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.canopywireless.com"><img src="/images/posts/CanopyCluster.png" alt="" style="float: right; margin: 10px" /></a> The AirSurfer <acronym title="Wireless Internet Service Provider">WISP</acronym> network I manage for Triton Networking Solutions Ltd. utilizes hundreds of <a href="http://www.canopywireless.com">Motorola Canopy</a> Subscriber modules to connect individual broadband clients to our network.</p>
<p>In order to mass manage these devices, Motorola provides <acronym title="Canopy Network Update Tool">CNUT</acronym>. CNUT is a great tool, but in spite of the fact that it was written in cross platform languages from day one (Currently Java, previously some Perl in the mix for good measure) it  is only packaged for Windows and Linux systems.</p>
<p>I&#8217;ve been dissatisfied for some time in the exclusion of support for CNUT on my <a href="http://www.apple.com/macosx/tiger/">desktop OS of choice</a>. Being in a creative and inspired mood late yesterday evening, I did what any self respecting, Canopy using, red blooded, vigilante coding network geek would do.</p>
<p><span id="more-54"></span></p>
<p>I downloaded the Linux package to my trusty <a href="http://www.ubuntu.com/">Ubuntu</a> based laptop, jumped through the installation hoops, ripped out all the Java jar and class files and began to play.</p>
<p><strong>Behold!</strong> &#8211; CNUT running under Mac OS Tiger (10.4.9) on a PowerMac G5:</p>
<p><a href="/images/posts/cnut-osx.jpg"><img src="/images/posts/cnut-osx-thumb.png" alt="" /></a></p>
<p>The resulting <a href="/download/cnut-2.20.r1-pkg1.dmg">OS X disk image</a> contains a Mac OS X Application Bundle with all the necessary dependencies to run CNUT. It has all been packaged in such a way as to look and feel as close as possible to a native application. Installation is as simple as drag and drop, as per the typical Mac OS experience.</p>
<p><strong>Disclaimer:</strong> I have tested this package on both PowerPC and Intel based Macintosh computers. I have successfully used it to upgrade firmware on numerous modules in a production environment. To the best of my knowledge, it works at least as well as the official Motorola package. That being said, if my attempt at being helpful caused your Canopy Network to be annihilated in a fierce and fiery disaster of biblical proportions and voids your Canopy warranty, I hereby disclaim all liability.</p>
<p>In addition, this release is by no means endorsed, authorized or supported by Motorola. It contains their intellectual property including copyrighted and unaltered but substantially repackaged Java byte code and Trademarks. The package is being distributed with good intentions based on the concept of a community of users improving the solutions used for the greater good of the community. </p>
<p>If Motorola&#8217;s legal department becomes offended at  the existence and distribution of this package, I will of course have to remove it. Though I am sincerely hoping they recognize this as a useful contribution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.denis.lemire.name/2007/06/06/cnut-osx/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Batch PNG Optimization</title>
		<link>http://www.denis.lemire.name/2007/04/24/pngout/</link>
		<comments>http://www.denis.lemire.name/2007/04/24/pngout/#comments</comments>
		<pubDate>Wed, 25 Apr 2007 02:39:55 +0000</pubDate>
		<dc:creator>Denis Lemire</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.denis.lemire.name/2007/04/24/pngout/</guid>
		<description><![CDATA[When designing web sites, squeezing your design down to as few kilobytes as possible is a critical operation to keep your site responsive to visitors with low-bandwidth internet connections. In a well designed web site, markup is almost insignificant in size relative to the image files that make up a visually rich presentation. In order [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.perl.com"><img src="/images/posts/perl.png" style="float: right; margin: 15px" alt=""/></a> When designing web sites, squeezing your design down to as few kilobytes as possible is a critical operation to keep your site responsive to visitors with low-bandwidth internet connections.</p>
<p>In a well designed web site, markup is almost insignificant in size relative to the image files that make up a visually rich presentation. In order to create image files that are as tiny as possible, I use <a href="http://advsys.net/ken/">Ken Silverman</a>&#8216;s <a href="http://advsys.net/ken/utils.htm">PNGOUT</a> utility.</p>
<p>While PNGOUT serves my purposes very well, it has two flaws:</p>
<ol>
<li>No batch operation</li>
<li>No support for FreeBSD</li>
</ol>
<p>Fortunately, I can do something to address the first issue.</p>
<p><span id="more-48"></span></p>
<p>Below is a perl script I just finished pounding out. Given a base directory and optionally, custom pngout arguments, this script will recursively traverse through all subdirectories optimizing the PNG images via the pngout utility.</p>
<pre>
#!/usr/bin/perl

use strict;
use warnings;

use Cwd;

my $pngoutpath = "/usr/local/bin/pngout";

if (@ARGV == 2) {
	recurseDir ($ARGV[0], $ARGV[1]);
} elsif (@ARGV == 1) {
	recurseDir ($ARGV[0], 0);
} else {
	print "Usage: recursive-pngout dir [args]\n";
}

sub recurseDir
{
	my ($curpath, $args) = @_;

	if (opendir (CURDIR, $curpath)) {
		chdir ($curpath);

		my @files = readdir(CURDIR);
		closedir (CURDIR);

		foreach my $file (@files)
		{
			next if $file eq ".";
			next if $file eq "..";

			recurseDir ($file, $args);
		}

		chdir ('..');
	} else {
		if ($curpath =~ /.png$/) {
			my $dir = getcwd;

			if ($args) {
				system ("$pngoutpath $args $dir/$curpath");
			} else {
				system ("$pngoutpath $dir/$curpath");
			}
		}

		return;
	}
}
</pre>
<p>I know this could have been accomplished by a shell one-liner, but my abilities with the shell are a little rusty. I also tend to think in perl when I&#8217;m tackling a quick solution to a problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.denis.lemire.name/2007/04/24/pngout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

