<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">]>
<rss version="2.0" xml:base="http://randomfoo.net/code" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>random($code) blogs</title>
 <link>http://randomfoo.net/code/blog</link>
 <description></description>
 <language>en</language>
<item>
 <title>addusers.pl for Confluence</title>
 <link>http://randomfoo.net/code/Confluence/addusers.pl</link>
 <description>&lt;p&gt;Here&#039;s a script I wrote a couple weeks ago for easing user management for Confluence.  It turns adding users and users to groups into a much less painful affair.&lt;/p&gt;

&lt;p&gt;Requires:&lt;/p&gt;
&lt;pre&gt;WWW::Mechanize
HTML::TokeParser
Crypt::RandPasswd&lt;/pre&gt;

&lt;p&gt;Should be an easy breezy install w/ CPAN (&lt;code&gt;perl -MPCAN -e shell&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;Instructions are included with the code, and the code is pretty straightforward as well.  If you&#039;re dealing with lots of users, trust me, it&#039;ll save you time.&lt;/p&gt;</description>
 <comments>http://randomfoo.net/code/Confluence/addusers.pl#comment</comments>
 <category domain="http://randomfoo.net/code/taxonomy/term/21">Major</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/39">Perl</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/34">Web</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/5">Public Domain</category>
 <enclosure url="http://randomfoo.net/code/files/addusers.pl.txt" length="2788" type="text/plain" />
 <pubDate>Mon, 25 Apr 2005 12:37:36 -0700</pubDate>
 <dc:creator>lhl</dc:creator>
 <guid isPermaLink="false">19 at http://randomfoo.net/code</guid>
</item>
<item>
 <title>iTunes Opener</title>
 <link>http://randomfoo.net/code/iTunes/iTunes Opener.sitx</link>
 <description>&lt;p&gt;I&#039;ve been horrible about releases, here&#039;s one that fixes iTunes&#039; crap M3U handling.  Here&#039;s the &lt;a href=&quot;http://randomfoo.net/blog/id/3348&quot;&gt;original blog entry&lt;/a&gt; I wrote about it.&lt;/p&gt;
&lt;p&gt;Basically, this will intercept M3Us and then create individual playlists for them instead of dumping the songs directly into your Library (where after playing the first song, the songs in the lists are scattered to whatever your Library ordering is).&lt;/p&gt;
</description>
 <comments>http://randomfoo.net/code/iTunes/iTunes Opener.sitx#comment</comments>
 <category domain="http://randomfoo.net/code/taxonomy/term/53">AppleScript</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/21">Major</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/55">OS X</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/5">Public Domain</category>
 <enclosure url="http://randomfoo.net/code/files/iTunes Opener.sitx" length="54821" type="application/octet-stream" />
 <pubDate>Sun, 17 Apr 2005 21:51:47 -0700</pubDate>
 <dc:creator>lhl</dc:creator>
 <guid isPermaLink="false">18 at http://randomfoo.net/code</guid>
</item>
<item>
 <title>flickrer - automatic Flickr uploading</title>
 <link>http://randomfoo.net/code/node/17</link>
 <description>&lt;p&gt;Here&#039;s a script I&#039;ve been using for the past couple of weeks since I started really using Flickr.&lt;/p&gt;

&lt;p&gt;Requires:&lt;/p&gt;
&lt;pre&gt;File::Basename
File::Copy
LWP::UserAgent
Flickr::Upload&lt;/pre&gt;

&lt;p&gt;Should be an easy breezy install w/ CPAN (&lt;code&gt;perl -MPCAN -e shell&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;flickrer first checks that it isn&#039;t already running via a process search, then looks the files from the &lt;code&gt;dropbox&lt;/code&gt; and locks (via . rename) while uploading.  This makes it pretty safe to run at regular intervals via cron.  Once it finishes it moves the file to the sentbox.  I run sips, OS X&#039;s built in image processing utility to reduce the size of the images, as even w/ a Pro account (1GB/mo), u/ling full photo files would be quickly pass quota.&lt;/p&gt;</description>
 <comments>http://randomfoo.net/code/node/17#comment</comments>
 <category domain="http://randomfoo.net/code/gpl">GPL</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/21">Major</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/39">Perl</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/34">Web</category>
 <enclosure url="http://randomfoo.net/code/files/flickrer" length="2557" type="application/octet-stream" />
 <pubDate>Thu, 02 Dec 2004 16:25:28 -0800</pubDate>
 <dc:creator>lhl</dc:creator>
 <guid isPermaLink="false">17 at http://randomfoo.net/code</guid>
</item>
<item>
 <title>DropCash PHP Output</title>
 <link>http://randomfoo.net/code/node/16</link>
 <description>&lt;p&gt;I started &lt;a href=&quot;http://www.dropcash.com/campaign/lhl/octobernovember_bandwidth/&quot;&gt;my first Dropcash campaign&lt;/a&gt; today. and coded up a large custom &quot;badge&quot; for my campaign with a little bit of PHP glue.&lt;/p&gt;

&lt;p&gt;If you&#039;re using PHP5 you&#039;ll probably want to use &lt;a href=&quot;http://www.zend.com/php5/articles/php5-simplexml.php&quot;&gt;SimpleXML&lt;/a&gt;, which looks totally rockin&#039;, but for us less adventurous shlubs, give &lt;a href=&quot;http://www.sitepoint.com/article/xml-php-pear-xml_serializer&quot;&gt;PEAR::XML_Serializer&lt;/a&gt; an install (you might need to -f for since it&#039;s still &#039;beta&#039;) and check this out:&lt;/p&gt;

&lt;pre&gt;&amp;lt;?php
  // Caching
  $cache = &#039;/tmp/dropcash&#039;;
  $agelimit = 5 * 60; // 5 minutes
  $timestamp = @filemtime($cachefile);
  $age = time() - $timestamp;

  if($age &gt; $agelimit || $_SERVER[&#039;QUERY_STRING&#039;] == &#039;update&#039;) {
    $f = fopen($cache, &#039;w&#039;);
    fwrite($f, file_get_contents(&#039;http://www.dropcash.com/campaign/[user]/[campaign_name]/xml&#039;));
  }

  $xml = file_get_contents($cache);

  require_once &#039;XML/Unserializer.php&#039;;
  $u = &amp;new XML_Unserializer();
  $u-&gt;unserialize($xml);
  $dc = $u-&gt;getUnserializedData();

  $percent = $dc[&#039;percentage&#039;];
  $percentpx = floor($percent * 4); // 400px bar
  $goal =  $dc[&#039;goal&#039;];
  $collected = $dc[&#039;total_collected&#039;];
?&amp;gt;&lt;/pre&gt;

&lt;p&gt;This will probably make more sense w/ the rest of the badge code since it&#039;s a bit style-based (for the percentpx).&lt;/p&gt;</description>
 <comments>http://randomfoo.net/code/node/16#comment</comments>
 <category domain="http://randomfoo.net/code/taxonomy/term/29">Example</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/21">Major</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/38">PHP</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/12">random($foo)</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/34">Web</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/5">Public Domain</category>
 <enclosure url="http://randomfoo.net/code/files/dropcash.php.txt" length="3883" type="text/plain" />
 <pubDate>Fri, 22 Oct 2004 22:27:14 -0700</pubDate>
 <dc:creator>lhl</dc:creator>
 <guid isPermaLink="false">16 at http://randomfoo.net/code</guid>
</item>
<item>
 <title>record - a simple recording script for your Mac</title>
 <link>http://randomfoo.net/code/record</link>
 <description>&lt;p&gt;Written originally for OSCON 2002, this is a simple record script that I wrote for my Mac (and my home-built headphone-embedded binaural microphone).  I recently updated this to make sure that it still works (it does), although honestly, if you have an iPod, I recommend picking up a &lt;a href=&quot;http://www.griffintechnology.com/products/italk/&quot;&gt;Griffin iTalk&lt;/a&gt;, it&#039;s great.&lt;/p&gt;

&lt;p&gt;Still, this is a handy script to have in your ~bin just in case.&lt;/p&gt;

&lt;p&gt;I recommend using &lt;a href=&quot;http://fink.sourceforge.net/&quot;&gt;Fink&lt;/a&gt; to install esdrec and lame:&lt;/p&gt;

&lt;pre&gt;sudo fink install esound
sudo fink install lame&lt;/pre&gt;

&lt;p&gt;TODO: switch modify encoding paramaters?&lt;/p&gt;</description>
 <comments>http://randomfoo.net/code/record#comment</comments>
 <category domain="http://randomfoo.net/code/gpl">GPL</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/21">Major</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/55">OS X</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/40">Shell</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/35">Unix</category>
 <enclosure url="http://randomfoo.net/code/files/record" length="611" type="application/octet-stream" />
 <pubDate>Thu, 21 Oct 2004 15:59:10 -0700</pubDate>
 <dc:creator>lhl</dc:creator>
 <guid isPermaLink="false">15 at http://randomfoo.net/code</guid>
</item>
<item>
 <title>CRM114 Mail.app Training Scripts</title>
 <link>http://randomfoo.net/code/Mail.app/CRM114 Smart Training___shift-s.scpt</link>
 <description>&lt;p&gt;At the beginning of this year, I knew I needed a new Spam filtering solution and switched to a &lt;a href=&quot;http://www.qcc.ca/~charlesc/software/getmail-4/&quot;&gt;getmail&lt;/a&gt; (much better than fetchmail&lt;/a&gt;) and more robust Procmail setup, running &lt;a href=&quot;http://crm114.sourceforge.net/&quot;&gt;CRM114&lt;/a&gt;, an advanced learning filter based on alien space technology (well, more accurately, math beyond my ken).&lt;/p&gt;

&lt;p&gt;Full setup information belongs in the scope of another site, but I also wrote some AppleScripts to make training much easier w/ Apple&#039;s Mail.app&lt;/p&gt;

&lt;p&gt;I&#039;ve included the earlier manual training scripts, as well as the subsequent &#039;smart&#039; training script that I continue to use today.  I suspect I&#039;ll continue using this until I switch to a fully automated, web/db-based &lt;acronym title=&quot;Train Until No Errors&quot;&gt;TUNE&lt;/acronym&gt; method.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://randomfoo.net/code/Mail.app/CRM114 Smart Training___shift-s.scpt&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://randomfoo.net/code/Mail.app/CRM114 Smart Training___shift-s.scpt#comment</comments>
 <category domain="http://randomfoo.net/code/taxonomy/term/53">AppleScript</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/57">CRM114</category>
 <category domain="http://randomfoo.net/code/gpl">GPL</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/54">Mail</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/56">Mail.app</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/21">Major</category>
 <enclosure url="http://randomfoo.net/code/files/CRM114 Train Ham___shift-h.scpt" length="2212" type="application/octet-stream" />
 <pubDate>Wed, 20 Oct 2004 21:21:26 -0700</pubDate>
 <dc:creator>lhl</dc:creator>
 <guid isPermaLink="false">14 at http://randomfoo.net/code</guid>
</item>
<item>
 <title>Self-Updating Web Software</title>
 <link>http://randomfoo.net/code/node/13</link>
 <description>&lt;p&gt;Anil announced the &lt;a href=&quot;http://www.sixapart.com/pronet/2004/10/movable_type_31_2.html&quot;&gt;recent release of MT 3.12&lt;/a&gt;, which has, among other things, &lt;q&gt;automatic generation of .htaccess files for dynamic pages&lt;/q&gt;.&lt;/p&gt;

&lt;p&gt;One of the great things about Drupal is its integrated URL handling, so that&#039;s definitely part of the way to go.  Apache, or &#039;full system&#039; integration is certainly a big step for web software to take.  Of course, there are those pesky permissions problems and securities risks...&lt;/p&gt;

&lt;p&gt;Here&#039;s a little bit I wrote a while back for a file that&#039;s in a public folder listing (labeled &#039;!!!_donotclick_youwillbebanned.foo&#039; and w/ a robots.txt Deny rule) to block aggressive spiders:&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://randomfoo.net/code/node/13&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://randomfoo.net/code/node/13#comment</comments>
 <category domain="http://randomfoo.net/code/taxonomy/term/24">Brainfart</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/29">Example</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/38">PHP</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/28">Related</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/45">TODO</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/34">Web</category>
 <pubDate>Wed, 20 Oct 2004 09:15:10 -0700</pubDate>
 <dc:creator>lhl</dc:creator>
 <guid isPermaLink="false">13 at http://randomfoo.net/code</guid>
</item>
<item>
 <title>random($code) pre-launch checklist</title>
 <link>http://randomfoo.net/code/TODO</link>
 <description>&lt;p&gt;Note to visitors: this site is pre-launch, and will be undergoing extensive overhauls ... err, when I have time.  &lt;/p&gt;
&lt;p&gt;So, after election project stuff I went on vacation for a little while, which led to a couple &lt;a href=&quot;http://rollingresistance.org/&quot;&gt;other things&lt;/a&gt;.  In between, I moved my blog over to a new system, and everything has halted while I grind away in crunchtime on work work.&lt;/p&gt;
&lt;p&gt;TODO&lt;br /&gt;
* update to 4.5.0&lt;br /&gt;
* 3 column layout skeleton - see &lt;a href=&quot;http://randomfoo.net/code/node/4&quot;&gt;site org&lt;/a&gt;&lt;br /&gt;
* Top Blurb&lt;br /&gt;
* automatically tack license link to proper blurb, add to packages&lt;br /&gt;
* install Markdown&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://randomfoo.net/code/TODO&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://randomfoo.net/code/TODO#comment</comments>
 <category domain="http://randomfoo.net/code/taxonomy/term/27">Design Spec</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/37">Drupal</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/9">random($code)</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/26">RFE</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/45">TODO</category>
 <pubDate>Wed, 20 Oct 2004 09:03:51 -0700</pubDate>
 <dc:creator>lhl</dc:creator>
 <guid isPermaLink="false">12 at http://randomfoo.net/code</guid>
</item>
<item>
 <title>include.py - Trac Macro</title>
 <link>http://randomfoo.net/code/trac/include.py</link>
 <description>&lt;p&gt;Inserts the output of an external URL.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;pre&gt;[[include(http://www.example.com/)]]&lt;/pre&gt;

&lt;p&gt;Ver: 0.7.1+&lt;/p&gt;
</description>
 <comments>http://randomfoo.net/code/trac/include.py#comment</comments>
 <category domain="http://randomfoo.net/code/gpl">GPL</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/42">Python</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/52">Trac</category>
 <enclosure url="http://randomfoo.net/code/files/include.py.txt" length="228" type="text/plain" />
 <pubDate>Wed, 20 Oct 2004 00:03:04 -0700</pubDate>
 <dc:creator>lhl</dc:creator>
 <guid isPermaLink="false">11 at http://randomfoo.net/code</guid>
</item>
<item>
 <title>hiptop.pl - Sidekick Address Exporter 0.2.1</title>
 <link>http://randomfoo.net/code/Sidekick/hiptop.pl</link>
 <description>&lt;p&gt;Written last winter, this is the Mechanize script I used to dump my T-Mobile Sidekick&#039;s (Danger Hiptop) Address Book into an iCal compatible format.&lt;/p&gt;
&lt;p&gt;It&#039;s quite unfinished, and possibly not working anymore (if the site&#039;s changed).  But in case there&#039;s &lt;em &gt;still&lt;/em&gt; (for shame, Danger, for shame) not any syncing software available, this is a good starting point.&lt;/p&gt;
&lt;p&gt;Originally posted on &lt;a href=&quot;http://www.hiptop.com/forums/viewtopic.php?t=11290&quot;&gt;the Danger Forums here&lt;/a&gt;.&lt;/p&gt;
</description>
 <comments>http://randomfoo.net/code/Sidekick/hiptop.pl#comment</comments>
 <category domain="http://randomfoo.net/code/gpl">GPL</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/21">Major</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/39">Perl</category>
 <category domain="http://randomfoo.net/code/taxonomy/term/35">Unix</category>
 <enclosure url="http://randomfoo.net/code/files/hiptop.pl.txt" length="12393" type="text/plain" />
 <pubDate>Tue, 19 Oct 2004 21:15:52 -0700</pubDate>
 <dc:creator>lhl</dc:creator>
 <guid isPermaLink="false">10 at http://randomfoo.net/code</guid>
</item>
</channel>
</rss>
