<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>I Make Things - CLI</title>
    <link>http://blog.latcarf.com/</link>
    <description>To live a creative life, we must lose our fear of being wrong.</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.4.1 - http://www.s9y.org/</generator>
    
    <image>
        <url>http://blog.latcarf.com/templates/bulletproof/img/s9y_banner_small.png</url>
        <title>RSS: I Make Things - CLI - To live a creative life, we must lose our fear of being wrong.</title>
        <link>http://blog.latcarf.com/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Fix for Tor on Leopard</title>
    <link>http://blog.latcarf.com/archives/136-Fix-for-Tor-on-Leopard.html</link>
            <category>CLI</category>
    
    <comments>http://blog.latcarf.com/archives/136-Fix-for-Tor-on-Leopard.html#comments</comments>
    <wfw:comment>http://blog.latcarf.com/wfwcomment.php?cid=136</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.latcarf.com/rss.php?version=2.0&amp;type=comments&amp;cid=136</wfw:commentRss>
    

    <author>nospam@example.com (Latcarf)</author>
    <content:encoded>
    After installing Mac OS X 10.5 (Leopard) fresh (I won&#039;t go into details &lt;img src=&quot;http://blog.latcarf.com/templates/default/img/emoticons/sad.png&quot; alt=&quot;:-(&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;), I needed to reinstall &lt;a href=&quot;http://blog.latcarf.com/exit.php?url_id=643&amp;amp;entry_id=136&quot; title=&quot;http://tor.eff.org&quot;  onmouseover=&quot;window.status=&#039;http://tor.eff.org&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;Tor&lt;/a&gt;. I found the &lt;a href=&quot;http://blog.latcarf.com/exit.php?url_id=644&amp;amp;entry_id=136&quot; title=&quot;http://www.torproject.org/dist/osx/Tor-0.1.2.18-tiger-universal-Bundle.dmg&quot;  onmouseover=&quot;window.status=&#039;http://www.torproject.org/dist/osx/Tor-0.1.2.18-tiger-universal-Bundle.dmg&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot;&gt;Tor expert installer&lt;/a&gt; didn&#039;t quite do what it was supposed to as far as creating the &lt;tt&gt;_tor&lt;/tt&gt; user the daemon runs as (the user ends up a little mangled - check it out after install with &lt;tt&gt;dscl . -read /Users/tor&lt;/tt&gt;) Since Leopard doesn&#039;t use NetInfo (&lt;tt&gt;niutil&lt;/tt&gt;) anymore, I had to manually create the user with DirectoryServices (&lt;tt&gt;dscl&lt;/tt&gt;). Here&#039;s the quick-and-dirty on what I did...&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bash&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Create Tor Group and User:&lt;/span&gt;&lt;br /&gt;sudo dscl . -create /Groups/_tor&lt;br /&gt;sudo dscl . -create /Groups/_tor PrimaryGroupID &lt;span style=&quot;color: #cc66cc;&quot;&gt;100&lt;/span&gt;&lt;br /&gt;sudo dscl . -create /Groups/_tor RealName &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;Tor Group&quot;&lt;/span&gt;&lt;br /&gt;sudo dscl . -create /Groups/_tor Password &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;*&#039;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;sudo dscl . -create /Users/_tor&lt;br /&gt;sudo dscl . -create /Users/_tor UserShell /usr/bin/false&lt;br /&gt;sudo dscl . -create /Users/_tor RealName &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;Tor Server&quot;&lt;/span&gt;&lt;br /&gt;sudo dscl . -create /Users/_tor UniqueID &lt;span style=&quot;color: #cc66cc;&quot;&gt;100&lt;/span&gt;&lt;br /&gt;sudo dscl . -create /Users/_tor PrimaryGroupID &lt;span style=&quot;color: #cc66cc;&quot;&gt;100&lt;/span&gt;&lt;br /&gt;sudo dscl . -create /Users/_tor NFSHomeDirectory /Library/Tor/var/lib/tor&lt;br /&gt;sudo dscl . -create /Users/_tor Password &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;*&#039;&lt;/span&gt;&lt;br /&gt;sudo dscl . -append /Groups/_tor GroupMembership _tor&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
After that, there was still a little more to do to get Tor to run. I needed to create a place for the logs and fix the StartupItems script. Here&#039;s what I did for that...&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bash&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Create the logs directory&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000066;&quot;&gt;cd&lt;/span&gt; /var/log&lt;br /&gt;sudo mkdir tor&lt;br /&gt;sudo touch tor/tor.log&lt;br /&gt;sudo chown -R _tor:_tor tor&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Fix perms on the &amp;quot;home&amp;quot; directory&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000066;&quot;&gt;cd&lt;/span&gt; /Library/Tor/var/lib&lt;br /&gt;sudo chown -R _tor:_tor tor&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# In /Library/StartupItems/Tor/Tor change TORGROUP from TORGROUP=daemon to:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;TORGROUP=&lt;/span&gt;_tor&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Start the Tor server&lt;/span&gt;&lt;br /&gt;sudo /Library/StartupItems/Tor/Tor start&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Cool. That fixed it. &lt;img src=&quot;http://blog.latcarf.com/templates/default/img/emoticons/cool.png&quot; alt=&quot;8-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; Still not sure whether I want logging in &lt;tt&gt;/var/log/tor&lt;/tt&gt; or &lt;tt&gt;/Library/Tor/var/log/tor&lt;/tt&gt; though... Also, I guess I probably should submit all this to the Tor folks too. I&#039;m so damn lazy.&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Mon, 03 Dec 2007 04:07:44 -0400</pubDate>
    <guid isPermaLink="false">http://blog.latcarf.com/archives/136-guid.html</guid>
    
</item>
<item>
    <title>Download all Space.com Wallpapers</title>
    <link>http://blog.latcarf.com/archives/125-Download-all-Space.com-Wallpapers.html</link>
            <category>CLI</category>
    
    <comments>http://blog.latcarf.com/archives/125-Download-all-Space.com-Wallpapers.html#comments</comments>
    <wfw:comment>http://blog.latcarf.com/wfwcomment.php?cid=125</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.latcarf.com/rss.php?version=2.0&amp;type=comments&amp;cid=125</wfw:commentRss>
    

    <author>nospam@example.com (Latcarf)</author>
    <content:encoded>
    This is a really quick and dirty script I banged out in about a half-hour to download all the wallpapers at &lt;a href=&quot;http://blog.latcarf.com/exit.php?url_id=601&amp;amp;entry_id=125&quot;  onmouseover=&quot;window.status=&#039;http://space.com&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot; target=&quot;locution&quot; title=&quot;Space.com&quot;&gt;Space.com&lt;/a&gt;. I like reading the articles at &lt;a href=&quot;http://blog.latcarf.com/exit.php?url_id=601&amp;amp;entry_id=125&quot;  onmouseover=&quot;window.status=&#039;http://space.com&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot; target=&quot;locution&quot; title=&quot;Space.com&quot;&gt;Space.com&lt;/a&gt; from time to time and I found the wallpapers there are pretty cool. I wanted to grab them all and use them for my Mac OS X screensaver. Of course, downloading them individually (click, click, click, right-click, save as, etc... - ad infinitum), is a pain in the ass. So, the &lt;a href=&quot;http://blog.latcarf.com/exit.php?url_id=601&amp;amp;entry_id=125&quot;  onmouseover=&quot;window.status=&#039;http://space.com&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot; target=&quot;locution&quot; title=&quot;Space.com&quot;&gt;Space.com&lt;/a&gt; Wallpaper Download (sdcwd) script was born! &lt;img src=&quot;http://blog.latcarf.com/templates/default/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
The script recursively downloads all the images of the specified size, creating folders for each collection. Just start it and let it run!&lt;br /&gt;
&lt;br /&gt;
I used the following software and versions, you&#039;ll need &lt;tt&gt;&#039;-o&#039;&lt;/tt&gt; support in &lt;tt&gt;grep&lt;/tt&gt; for sure and have &lt;tt&gt;curl&lt;/tt&gt; and &lt;tt&gt;wget&lt;/tt&gt; installed. Of course, if the urls change at &lt;a href=&quot;http://blog.latcarf.com/exit.php?url_id=601&amp;amp;entry_id=125&quot;  onmouseover=&quot;window.status=&#039;http://space.com&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot; target=&quot;locution&quot; title=&quot;Space.com&quot;&gt;Space.com&lt;/a&gt;, this script will be broken. Your mileage may vary.&lt;br /&gt;
&lt;br /&gt;
Software Versions:&lt;br /&gt;
curl - curl 7.13.1&lt;br /&gt;
grep - grep (GNU grep) 2.5.1&lt;br /&gt;
wget - GNU Wget 1.8.2&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bash&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#!/bin/bash&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Space.com Wallpaper Download (sdcwd)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;image_size=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;1280&quot;&lt;/span&gt; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Set this to 640, 800, 1024, or 1280 depending on the image size you want&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;collections=&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;`curl -s http://www.space.com/php/multimedia/downloads/wallpapers/collection.php?&lt;span style=&quot;color: #0000ff;&quot;&gt;collection=&lt;/span&gt;adrian_lark | \&lt;br /&gt;grep -o &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;option value=&amp;quot;collection.php?collection=&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\(&lt;/span&gt;.*&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\)&lt;/span&gt;&amp;quot;&#039;&lt;/span&gt; | \&lt;br /&gt;sed &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;s,option value=&amp;quot;collection.php?collection=&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\(&lt;/span&gt;.*&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\)&lt;/span&gt;&amp;quot;,&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\1&lt;/span&gt;,&#039;&lt;/span&gt;`&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;collection_url=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;http://www.space.com/php/multimedia/downloads/wallpapers/collection.php?collection=&quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;image_url=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;http://a52.g.akamaitech.net/f/52/827/1d/www.space.com/entertainment/downloads/spaceart/images/&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;logFile=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;sdcwd.log&quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;topDir=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;Space.com_Wallpapers&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;getImages&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;this_collection=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;$1&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;collurl=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;${collection_url}${this_collection}&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt; ! -d &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;$this_collection&quot;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;; &lt;span style=&quot;color: #b1b100;&quot;&gt;then&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; mkdir &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;$this_collection&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;cd&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;$this_collection&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Log&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;----------------------------&quot;&lt;/span&gt; &amp;gt;&amp;gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;../$logFile&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;$this_collection&quot;&lt;/span&gt; &amp;gt;&amp;gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;../$logFile&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;----------------------------&quot;&lt;/span&gt; &amp;gt;&amp;gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;../$logFile&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; curl -s &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;$collurl&quot;&lt;/span&gt; | grep &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;/php/multimedia/imagedisplay/wallpaper_display.php?pic=.*_$image_size&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\.&lt;/span&gt;jpg&quot;&lt;/span&gt; | \&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; grep -o &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;pic=&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\(&lt;/span&gt;.*.jpg&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\)&lt;/span&gt;&quot;&lt;/span&gt; | \&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; sed &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;s,pic=,$image_url,&quot;&lt;/span&gt; | \&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; tee -a &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;../$logFile&quot;&lt;/span&gt; | \&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; xargs wget -q&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Log&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&quot;&lt;/span&gt; &amp;gt;&amp;gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;../$logFile&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt; &amp;gt;&amp;gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;../$logFile&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;cd&lt;/span&gt; ../&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# If we didn&#039;t download any pics for this directory (maybe the requested size wasn&#039;t available)&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# remove the empty directory.&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; find &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;$this_collection&quot;&lt;/span&gt; -&lt;span style=&quot;color: #000066;&quot;&gt;type&lt;/span&gt; d -empty | xargs rmdir&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;fi&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;old_dir=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;`pwd`&quot;&lt;/span&gt;&lt;br /&gt;mkdir &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;$topDir&quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000066;&quot;&gt;cd&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;$topDir&quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;for&lt;/span&gt; this_collection &lt;span style=&quot;color: #b1b100;&quot;&gt;in&lt;/span&gt; $&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;collections&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;@&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;do&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; getImages &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;$this_collection&quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;done&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000066;&quot;&gt;cd&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;$old_dir&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160;&lt;/div&gt; 
    </content:encoded>

    <pubDate>Mon, 09 Apr 2007 01:01:17 -0400</pubDate>
    <guid isPermaLink="false">http://blog.latcarf.com/archives/125-guid.html</guid>
    
</item>
<item>
    <title>Recursively Convert Line-Endings</title>
    <link>http://blog.latcarf.com/archives/124-Recursively-Convert-Line-Endings.html</link>
            <category>CLI</category>
    
    <comments>http://blog.latcarf.com/archives/124-Recursively-Convert-Line-Endings.html#comments</comments>
    <wfw:comment>http://blog.latcarf.com/wfwcomment.php?cid=124</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.latcarf.com/rss.php?version=2.0&amp;type=comments&amp;cid=124</wfw:commentRss>
    

    <author>nospam@example.com (Latcarf)</author>
    <content:encoded>
    &lt;div class=&quot;locution_cli&quot;&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; find . -type f -exec perl -pi -e &#039;s/\r\n?/\n/g&#039; {} \; &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Found on &lt;a href=&quot;http://blog.latcarf.com/exit.php?url_id=586&amp;amp;entry_id=124&quot;  onmouseover=&quot;window.status=&#039;http://madross.com/convert-windows-line-endings-to-unix-os-x/&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot; title=&quot;Madness and Macness&quot; target=&quot;locution&quot;&gt;Madness &amp;amp; Macness&lt;/a&gt; 
    </content:encoded>

    <pubDate>Wed, 07 Mar 2007 22:15:32 -0400</pubDate>
    <guid isPermaLink="false">http://blog.latcarf.com/archives/124-guid.html</guid>
    
</item>
<item>
    <title>Convert Date to UNIX Timestamp</title>
    <link>http://blog.latcarf.com/archives/101-Convert-Date-to-UNIX-Timestamp.html</link>
            <category>CLI</category>
    
    <comments>http://blog.latcarf.com/archives/101-Convert-Date-to-UNIX-Timestamp.html#comments</comments>
    <wfw:comment>http://blog.latcarf.com/wfwcomment.php?cid=101</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.latcarf.com/rss.php?version=2.0&amp;type=comments&amp;cid=101</wfw:commentRss>
    

    <author>nospam@example.com (Latcarf)</author>
    <content:encoded>
    I looked all over trying to find an easy way to convert a date to a UNIX timestamp in a shell or perl script. I was disappointed that I didn&#039;t find anything that was easy, sure and didn&#039;t require extra software. Most of my UNIX scripts have to operate on Mac OS X so I don&#039;t concern myself too much about portability and generally try to use what&#039;s already available on the system.&lt;br /&gt;
&lt;br /&gt;
The easiest way I found to convert a date string to a UNIX timestamp is with PHP&#039;s &lt;tt&gt;strtotime&lt;/tt&gt; function. Fortunately, PHP is included on Mac OS X machine at no extra charge! &lt;img src=&quot;http://blog.latcarf.com/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; This one-liner handles the need pretty well.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;locution_cli&quot;&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; my_stamp=`php -r \ &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&#039;fwrite(STDOUT,strtotime(&quot;2006-05-08 15:23:52&quot;));&#039;` &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; echo $my_stamp&lt;/font&gt; &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
1147127032&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
The constants: &lt;tt&gt;STDIN&lt;/tt&gt;, &lt;tt&gt;STDOUT&lt;/tt&gt;, and &lt;tt&gt;STDERR&lt;/tt&gt; are predefined to make life easy!&lt;br /&gt;
&lt;br /&gt;
For more info, check out: &quot;&lt;a href=&quot;http://blog.latcarf.com/exit.php?url_id=441&amp;amp;entry_id=101&quot;  onmouseover=&quot;window.status=&#039;http://us3.php.net/features.commandline&#039;;return true;&quot; onmouseout=&quot;window.status=&#039;&#039;;return true;&quot; target=&quot;locution&quot; title=&quot;Using PHP from the command line&quot;&gt;Using PHP from the command line&lt;/a&gt;.&quot;&lt;br /&gt;
&lt;br /&gt; 
    </content:encoded>

    <pubDate>Tue, 09 May 2006 13:39:28 -0400</pubDate>
    <guid isPermaLink="false">http://blog.latcarf.com/archives/101-guid.html</guid>
    
</item>
<item>
    <title>Recursively Delete Subversion Properties</title>
    <link>http://blog.latcarf.com/archives/98-Recursively-Delete-Subversion-Properties.html</link>
            <category>CLI</category>
    
    <comments>http://blog.latcarf.com/archives/98-Recursively-Delete-Subversion-Properties.html#comments</comments>
    <wfw:comment>http://blog.latcarf.com/wfwcomment.php?cid=98</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.latcarf.com/rss.php?version=2.0&amp;type=comments&amp;cid=98</wfw:commentRss>
    

    <author>nospam@example.com (Latcarf)</author>
    <content:encoded>
    My conversion from cvs to svn caused a bunch of files to end up with svn:keywords set for Author, Date, Revision, and Id. I recursively deleted the svn:keywords property from all the files with the following command. This could work with other svn property commands as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;locution_cli&quot;&gt;&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; cd ~/sandbox/project/ &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; find . ! -path &quot;*svn*&quot; \&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;&amp;gt;&lt;/font&gt; -exec svn propdel &quot;svn:keywords&quot; &quot;{}&quot; \; &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt; 
    </content:encoded>

    <pubDate>Fri, 14 Apr 2006 19:08:47 -0400</pubDate>
    <guid isPermaLink="false">http://blog.latcarf.com/archives/98-guid.html</guid>
    
</item>
<item>
    <title>iconv Character Set Conversion</title>
    <link>http://blog.latcarf.com/archives/68-iconv-Character-Set-Conversion.html</link>
            <category>CLI</category>
    
    <comments>http://blog.latcarf.com/archives/68-iconv-Character-Set-Conversion.html#comments</comments>
    <wfw:comment>http://blog.latcarf.com/wfwcomment.php?cid=68</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.latcarf.com/rss.php?version=2.0&amp;type=comments&amp;cid=68</wfw:commentRss>
    

    <author>nospam@example.com (Latcarf)</author>
    <content:encoded>
    I ran in to an issue the other day where I needed to perform some regular expression matching on a file and then edit the file&#039;s contents. Not a big problem really, I do it all the time, but this case was different as the file involved was encoded in UTF-16.&lt;br /&gt;
&lt;br /&gt;
I see more and more Unicode files these days and at first I was worried by what I might have to do to manipulate this particular file. A little bit of research led me to something that made life super easy!&lt;br /&gt;
&lt;br /&gt;
The UNIX command (available on Mac OS X and Debian boxes) &#039;&lt;b&gt;iconv&lt;/b&gt;&#039; does the work for me. &#039;iconv&#039; can convert to any character set encoding available on your particular system. For my purposes, I just converted my UTF-16 file into a MacRoman file. Next, I manipulated to my heart&#039;s content, then I re-converted to UTF-16. It was easy as pie. I also used the command to convert a whole bunch of UTF-16 files to UTF-8, it was no problem. Here&#039;s the actual command in action:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;locution_cli&quot;&gt;&lt;font color=&quot;#69C&quot;&gt;$ &lt;/font&gt;iconv -f UTF-16 -t MacRoman my_file &gt; my_new_file&lt;font color=&quot;green&quot;&gt; &amp;#172;&lt;/font&gt;&lt;/div&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Fri, 01 Apr 2005 17:57:17 -0400</pubDate>
    <guid isPermaLink="false">http://blog.latcarf.com/archives/68-guid.html</guid>
    
</item>
<item>
    <title>Awk's Built-in NF Variable</title>
    <link>http://blog.latcarf.com/archives/67-Awks-Built-in-NF-Variable.html</link>
            <category>CLI</category>
    
    <comments>http://blog.latcarf.com/archives/67-Awks-Built-in-NF-Variable.html#comments</comments>
    <wfw:comment>http://blog.latcarf.com/wfwcomment.php?cid=67</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.latcarf.com/rss.php?version=2.0&amp;type=comments&amp;cid=67</wfw:commentRss>
    

    <author>nospam@example.com (Latcarf)</author>
    <content:encoded>
    Use the awk &#039;NF&#039; (number of fields) built-in variable as an easy way to get the last field of a multi-word output. Here is an example using Mac OS X&#039;s hdiutil command to get just the calculated checksum of a disk image.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;locution_cli&quot;&gt;&lt;font color=&quot;#69C&quot;&gt;$ &lt;/font&gt;foo=`hdiutil checksum -type UDIF-CRC32 myimage.dmg`&lt;font color=&quot;green&quot;&gt; &amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$ &lt;/font&gt; echo $foo | awk &#039;{print $NF}&#039;&lt;font color=&quot;green&quot;&gt; &amp;#172;&lt;/font&gt;&lt;br /&gt;
$5C63390B&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Tue, 29 Mar 2005 15:26:58 -0400</pubDate>
    <guid isPermaLink="false">http://blog.latcarf.com/archives/67-guid.html</guid>
    
</item>
<item>
    <title>Mac OS X RAM Disk</title>
    <link>http://blog.latcarf.com/archives/66-Mac-OS-X-RAM-Disk.html</link>
            <category>CLI</category>
    
    <comments>http://blog.latcarf.com/archives/66-Mac-OS-X-RAM-Disk.html#comments</comments>
    <wfw:comment>http://blog.latcarf.com/wfwcomment.php?cid=66</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.latcarf.com/rss.php?version=2.0&amp;type=comments&amp;cid=66</wfw:commentRss>
    

    <author>nospam@example.com (Latcarf)</author>
    <content:encoded>
    Here&#039;s a cli way to create RAM disks on Mac OS X. Unless you have a huge amount of RAM, you&#039;ll probably not want to do this. Besides, Mac OS X has surperb i/o caching and virtual memory management so you might not see much of a performance boost with a RAM disk. I compiled one of our apps on a RAM disk and it didn&#039;t make a lick of difference in compile speed. Anyway, here&#039;s how to create the RAM disk:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;locution_cli&quot;&gt;&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; NUMSECTORS=1228800 # 600MB &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; VOLUMENAME=RAM_Disk &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; mydev=`hdid -nomount ram://$NUMSECTORS` &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; newfs_hfs -v $VOLUMENAME $mydev &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; mkdir /Volumes/$VOLUMENAME &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; mount -t hfs $mydev /Volumes/$VOLUMENAME &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;/div&gt;&lt;br /&gt;
Here&#039;s is how to remove the RAM disk:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;locution_cli&quot;&gt;&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; umount $mydev &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; hdiutil detach $mydev &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; rmdir /Volumes/$VOLUMENAME &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Wed, 23 Mar 2005 19:13:38 -0400</pubDate>
    <guid isPermaLink="false">http://blog.latcarf.com/archives/66-guid.html</guid>
    
</item>
<item>
    <title>Can't Export Arrays in BASH</title>
    <link>http://blog.latcarf.com/archives/61-Cant-Export-Arrays-in-BASH.html</link>
            <category>CLI</category>
    
    <comments>http://blog.latcarf.com/archives/61-Cant-Export-Arrays-in-BASH.html#comments</comments>
    <wfw:comment>http://blog.latcarf.com/wfwcomment.php?cid=61</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.latcarf.com/rss.php?version=2.0&amp;type=comments&amp;cid=61</wfw:commentRss>
    

    <author>nospam@example.com (Latcarf)</author>
    <content:encoded>
    After fiddling for hours with a script born of a Frankenstein marriage between AppleScript and bash, I found out what I am trying to do impossible. &gt;:-o&lt;br /&gt;
&lt;br /&gt;
Arrays cannot be exported in the bash shell. Let me say that again for posterity. You cannot export an array in bash, ever! This fact is a real pain in the ass. I think I understand why; The environment is actually an array of variables and bash only supports one-dimensional arrays. Therefore, you can&#039;t move an array into an array. &lt;img src=&quot;http://blog.latcarf.com/templates/default/img/emoticons/sad.png&quot; alt=&quot;:-(&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;&lt;a href=&quot;http://blog.latcarf.com/archives/61-Cant-Export-Arrays-in-BASH.html#extended&quot;&gt;Continue reading &quot;Can&#039;t Export Arrays in BASH&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Mon, 14 Mar 2005 20:03:50 -0400</pubDate>
    <guid isPermaLink="false">http://blog.latcarf.com/archives/61-guid.html</guid>
    
</item>
<item>
    <title>Output man pages to a file</title>
    <link>http://blog.latcarf.com/archives/40-Output-man-pages-to-a-file.html</link>
            <category>CLI</category>
    
    <comments>http://blog.latcarf.com/archives/40-Output-man-pages-to-a-file.html#comments</comments>
    <wfw:comment>http://blog.latcarf.com/wfwcomment.php?cid=40</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.latcarf.com/rss.php?version=2.0&amp;type=comments&amp;cid=40</wfw:commentRss>
    

    <author>nospam@example.com (Latcarf)</author>
    <content:encoded>
    &lt;div class=&quot;locution_cli&quot;&gt;&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; man &quot;command_name&quot; | col -b &gt; ~/filename &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;/div&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Wed, 09 Feb 2005 15:49:48 -0400</pubDate>
    <guid isPermaLink="false">http://blog.latcarf.com/archives/40-guid.html</guid>
    
</item>
<item>
    <title>A good way to create user home directories in Mac OS X</title>
    <link>http://blog.latcarf.com/archives/17-A-good-way-to-create-user-home-directories-in-Mac-OS-X.html</link>
            <category>CLI</category>
    
    <comments>http://blog.latcarf.com/archives/17-A-good-way-to-create-user-home-directories-in-Mac-OS-X.html#comments</comments>
    <wfw:comment>http://blog.latcarf.com/wfwcomment.php?cid=17</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.latcarf.com/rss.php?version=2.0&amp;type=comments&amp;cid=17</wfw:commentRss>
    

    <author>nospam@example.com (Latcarf)</author>
    <content:encoded>
    &lt;div class=&quot;locution_cli&quot;&gt;&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; sudo cp -R /System/Library/User\ Template\ &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;&amp;gt;&lt;/font&gt; /English.lproj/Users/myuser&lt;br /&gt;
&lt;font color=&quot;#69C&quot;&gt;$&lt;/font&gt; sudo chown -R myuser:staff /Users/myuser &lt;font color=&quot;green&quot;&gt;&amp;#172;&lt;/font&gt;&lt;/div&gt;&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Tue, 21 Dec 2004 20:00:00 -0400</pubDate>
    <guid isPermaLink="false">http://blog.latcarf.com/archives/17-guid.html</guid>
    
</item>

</channel>
</rss>