<?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>Blog.ubrious &#187; Mac OS X</title>
	<atom:link href="http://blog.ubrio.us/category/osx/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ubrio.us</link>
	<description>An Ordinary Web Developer's Blog</description>
	<lastBuildDate>Thu, 19 Jan 2012 00:44:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>OSX, RubyGems and cross-thread violations in rb_gc</title>
		<link>http://blog.ubrio.us/nix/osx-rubygems-and-cross-thread-violations-in-rb_gc/</link>
		<comments>http://blog.ubrio.us/nix/osx-rubygems-and-cross-thread-violations-in-rb_gc/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 15:37:40 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Nix]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[gems]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/?p=104</guid>
		<description><![CDATA[I recently decided to migrate away from OSX&#8217;s default ruby install yesterday and noticed a few quirky hangups. Firstly, for some reason, and I&#8217;m not sure if it is just me or not, OSX&#8217;s default $PATH variable is putting /usr/local/bin AFTER /bin making your local installs not enabled by default. (Editing the /etc/paths didn&#8217;t do [...]]]></description>
			<content:encoded><![CDATA[<p>I recently decided to migrate away from OSX&#8217;s default ruby install yesterday and noticed a few quirky hangups. Firstly, for some reason, and I&#8217;m not sure if it is just me or not, OSX&#8217;s default $PATH variable is putting /usr/local/bin AFTER /bin making your local installs not enabled by default. (Editing the /etc/paths didn&#8217;t do the trick so I manually added it to PATH).</p>
<p>The installation went easily for both ruby gems and ruby, but I decided to take a &#8217;short cut&#8217; and copy all my gems from /Library/Ruby/Gems into my /usr/local/lib directory which started raising all kinds of errors &#8212; this one, in particular was obnoxious.</p>
<p><code>[BUG] cross-thread violation on rb_gc()</code></p>
<p>Luckily, all that means is that I copied over gems which were compiled against the standard OSX ruby version and not the new one. This was a little script I wrote which will show you which gems need to be re-compiled. Just <tt>cd</tt> over to your /usr/local/lib/ruby/gems/1.8/gems directory and run:</p>
<p><code><span>gems $></span>ls -1 **/**/*.bundle|ruby -pe '$_.gsub! /\-.*/, ""'|uniq</code></p>
<p>to get a list, or pipe that into <code><span>$></span> sudo gem install</code> and that should clear up those gc issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/nix/osx-rubygems-and-cross-thread-violations-in-rb_gc/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>shakebook pro for leopard &#8211; switch spaces with violence!</title>
		<link>http://blog.ubrio.us/code/shakebook-pro-for-leopard-switch-spaces-with-violence/</link>
		<comments>http://blog.ubrio.us/code/shakebook-pro-for-leopard-switch-spaces-with-violence/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 22:59:21 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[laptop]]></category>
		<category><![CDATA[smack]]></category>
		<category><![CDATA[violence]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/ruby/shakebook-pro-for-leopard-switch-spaces-with-violence/</guid>
		<description><![CDATA[
Update!
Switch spaces using your Apple Remote! (Or view the project on GitHub)

I was just goin around on the interblagosphere today and stumbled upon Erling Ellingsen&#8217;s smackbook pro. If you&#8217;ve never heard of this then you&#8217;re in for a shock. The basic idea behind what he has created is a way to switch virtual desktops simply [...]]]></description>
			<content:encoded><![CDATA[<div class='tip'>
<strong>Update!</strong><br />
<a href='http://blog.ubrio.us/web/ruby-dsl-for-apple-remotes/'>Switch spaces using your Apple Remote!</a> <small>(Or view the project on <a href='http://github.com/robhurring/apple-remote' onclick="pageTracker._trackPageview('/outgoing/github.com/robhurring/apple-remote?referer=');">GitHub</a>)</small>
</div>
<p>I was just goin around on the interblagosphere today and stumbled upon <a href="http://blog.medallia.com/2006/05/smacbook_pro.html" onclick="pageTracker._trackPageview('/outgoing/blog.medallia.com/2006/05/smacbook_pro.html?referer=');">Erling Ellingsen&#8217;s smackbook pro</a>. If you&#8217;ve never heard of this then you&#8217;re in for a shock. The basic idea behind what he has created is a way to switch virtual desktops simply by tapping the side of the laptop&#8217;s monitor.</p>
<p>I was immediately in love and wanted to play with it a bit but he was using <a href='http://desktopmanager.berlios.de/' onclick="pageTracker._trackPageview('/outgoing/desktopmanager.berlios.de/?referer=');">DesktopManager</a> to do the space switching. Since I&#8217;m running leopard on the laptop I figured that was a waste of time and I&#8217;d never actually use a 3&#8242;d party virtual desktop switching app&#8230; and so the journey began. I turned to my mortal enemy, applescript, to accomplish this. After some browsing and hacking I found that this simple code can send CONTROL-# keystrokes to get the job done:</p>
<pre>tell application "System Events"
	tell process "Finder"
		keystroke "[SPACENUMBER]" using control down
	end tell
end tell
</pre>
<p>If you toss that into <tt>osascript</tt> from the command line we can finally start to get somewhere. So the next step was to grab that sudden motion sensor app. Erling was using <a href='http://www.osxbook.com/software/sms/amstracker/' onclick="pageTracker._trackPageview('/outgoing/www.osxbook.com/software/sms/amstracker/?referer=');">AMSTracker</a> by Amit Singh so that seemed a good place to start. After that a quick ruby script tied the SMS dump to the applescript and a fun new project was born. It is a lotta bit rough around the edges and needs some sensitivity tuning, but it _does_ get the job done&#8230; just be a little rough* <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<blockquote><p>I am definitely not responsible for any damage caused by using this script &#8212; it was a proof of concept hack.</p></blockquote>
<h3>Based off &#8220;SmackBook Pro&#8221;</h3>
<div class='wp-caption alignleft'>
<img src="http://file.ubrio.us/wordpress/default.jpg" alt="" title="default" width="130" height="97" class="alignnone size-full wp-image-96" /></p>
<p class='wp-caption-text'><a href='http://www.youtube.com/v/6uvQTTPr9Rw&#038;hl=en' rel='flash' class='lightview' title="Smackbook Pro::Bad and Rad" onclick="pageTracker._trackPageview('/outgoing/www.youtube.com/v/6uvQTTPr9Rw_038_hl=en?referer=');">YouTube Video</a></p>
</div>
<p>This is not mine, but mine does essentially the same thing, only using native Leopard spaces&#8230; and ruby.</p>
<p><br clear='both' /></p>
<h3>Where to get the script?</h3>
<ul>
<li><a href='http://code.google.com/p/shakebook/' onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/shakebook/?referer=');">shakebook project site</a></li>
</ul>
<p>Running it is as simple as <code><span>$></span>AMSTracker -S -u0.01 | shakebook.rb</code> then tap away (or shake if you want to be careful)</p>
<div class='success'>Revisions will probably be made to sensitize it once I have time to mess around with it &#8212; if you come up with anything shoot me back a comment <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/code/shakebook-pro-for-leopard-switch-spaces-with-violence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>get protected ical calendars in google calendar</title>
		<link>http://blog.ubrio.us/php/google-calendar-add-private-calendars-from-ical/</link>
		<comments>http://blog.ubrio.us/php/google-calendar-add-private-calendars-from-ical/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 15:26:13 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[ical]]></category>
		<category><![CDATA[webdav]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/osx/google-calendar-add-private-calendars-from-ical/</guid>
		<description><![CDATA[This is a short and sweet post. I was trying to merge and sync all my calendars (something I do every so often which leaves me frustrated, drunk and huddled in a corner crying) and decided on google calendar as a main point since I have my work Outlook synced up with it (using their [...]]]></description>
			<content:encoded><![CDATA[<p>This is a short and sweet post. I was trying to merge and sync all my calendars (something I do every so often which leaves me frustrated, drunk and huddled in a corner crying) and decided on google calendar as a main point since I have my work Outlook synced up with it (using their outlook sync program). I setup a simple WebDAV url on my good ole&#8217; <a href='http://www.dreamhost.com/r.cgi?210778' title='low blow, i know' onclick="pageTracker._trackPageview('/outgoing/www.dreamhost.com/r.cgi?210778&amp;referer=');">dreamhost</a> and had a password protected directory to publish my schedule to from iCal.</p>
<p>iCal can publish to a password protected directory just fine &#8212; but to my surprise, google calendar could _not_ read from one&#8230; _only_ public urls. Wtf? I&#8217;m really hoping I overlooked something because this is just pathetic.</p>
<p>Anyway, the solution turned out to be dirt simple. Keep all protected calendars in a /private folder on my domain and have a public facing script to route stuff. So I went to work, and a few minutes later, here it is.</p>
<p>I tested this just now and google calendar can indeed read my password protected calendar so thats cool. It isn&#8217;t the best way I&#8217;m sure &#8212; but, hey, it only took a few minutes <small>(<strong>edit:</strong> less time than it took to write this post in fact)</small> and it gets the job done. (Plus I don&#8217;t exactly have a &#8220;personal&#8221; personal calendar, I&#8217;d just rather it not be public.)</p>
<p><strong class='note'>view the <a href='http://code.ubrio.us/projects/show/google-ical' onclick="pageTracker._trackPageview('/outgoing/code.ubrio.us/projects/show/google-ical?referer=');">protected ical calendars in google</a> project page</strong></p>
<p>Hope that can help someone. Or if there were any suggestions feel free to e-mail me <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/php/google-calendar-add-private-calendars-from-ical/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Firebug and YSlow for Safari</title>
		<link>http://blog.ubrio.us/web/firebug-safari-yslow/</link>
		<comments>http://blog.ubrio.us/web/firebug-safari-yslow/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 00:37:27 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[optimizing]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[web inspector]]></category>
		<category><![CDATA[yslow]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/osx/firebug-safari-yslow/</guid>
		<description><![CDATA[I was reading up on another one of those &#8220;top X command line hacks for OS X&#8221; posts (more specifically Mac OS X Tips) and came across something I never really paid attention to. It was the &#8220;Inspect Element&#8221; menu item on the right-click menu in safari. If you don&#8217;t see this, thats probably because [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading up on another one of those &#8220;top X command line hacks for OS X&#8221; posts (more specifically <a href="http://macosxtips.co.uk/index_files/tips-for-safari-3.html" onclick="pageTracker._trackPageview('/outgoing/macosxtips.co.uk/index_files/tips-for-safari-3.html?referer=');">Mac OS X Tips</a>) and came across something I never really paid attention to. It was the &#8220;Inspect Element&#8221; menu item on the right-click menu in safari. If you don&#8217;t see this, thats probably because you do not have the Debug menu enabled, you can do that with </p>
<p><code><span>$></span>defaults write com.apple.Safari IncludeDebugMenu 1</code> </p>
<p>(<small>swapping the 1 with a 0 to remove it</small>).</p>
<p>This WebInspector window is actually pretty useful and shares a lot of the functionality of <a href="http://www.getfirebug.com/" onclick="pageTracker._trackPageview('/outgoing/www.getfirebug.com/?referer=');">FireBug</a> and <a href="http://developer.yahoo.com/yslow/" onclick="pageTracker._trackPageview('/outgoing/developer.yahoo.com/yslow/?referer=');">YSlow</a> for FireFox. I&#8217;m specifically referring to Safari 3.0 from here on out, and all screen shots will also be of this version.</p>
<h3>Lets do a little comparison &#8212; what does WebInspector offer?</h3>
<p><small>Using this site as my guinea pig</small></p>
<h5>FireBug Similarities</h5>
<p>This contains all the normal stuff such as DOM, stylesheet, javascript and image browsing. The only real difference here is that you cannot edit your CSS live &#8212; which I never really use anyway.</p>
<div class='wp-caption alignright'>
<a href="http://file.ubrio.us/blog/wi-document.png" rel="gallery[fbs]" title="WebInspector::HTML Document" class='lightview' onclick="pageTracker._trackPageview('/outgoing/file.ubrio.us/blog/wi-document.png?referer=');"><img src="http://file.ubrio.us/blog/wi-document-thumb.png" /></a></p>
<p class='wp-caption-text'>Web Inspector</p>
</div>
<div class='wp-caption alignleft'>
<a href="http://file.ubrio.us/blog/wi-console.png" rel="gallery[fbs]" title="WebInspector::Error Console"  class='lightview' onclick="pageTracker._trackPageview('/outgoing/file.ubrio.us/blog/wi-console.png?referer=');"><img src="http://file.ubrio.us/blog/wi-console-thumb.png" /></a></p>
<p class='wp-caption-text'>Web Inspector</p>
</div>
<p><br clear='both' /></p>
<p>The other handy feature is the console. This will alert you of all the website&#8217;s quirks. I had to use Google as an example here because my site, naturally, has no errors that show up <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h5>YSlow Similarities</h5>
<div class='wp-caption alignright'>
<a href="http://file.ubrio.us/blog/wi-network.png" rel="gallery[fbs]" title="WebInspector::Load Times" class='lightview' onclick="pageTracker._trackPageview('/outgoing/file.ubrio.us/blog/wi-network.png?referer=');"><img src="http://file.ubrio.us/blog/wi-network-thumb.png" /></a></p>
<p class='wp-caption-text'>Web Inspector</p>
</div>
<p>I recently downloaded YSlow a week or so ago and I&#8217;ve been messing around with it to see how I can optimize my dev projects. While I&#8217;m not overly impressed with YSlow&#8217;s scoring &#8212; its damn near impossible to get that score above a D/C, and I think its geared more towards higher end websites than general websites &#8212; the WebInspector provides the same functionality&#8230;  with less cockiness (see what I mean after the article).</p>
<p>It will show the loading times, or loading sizes for each element on the page which can help you visualize where your bottlenecks are. It also provides helpful little notes on compressing your CSS and JS code.</p>
<h3>Script Debugging</h3>
<p>Ahhh. The meat and cheese of website debugging. Pesky JavaScript errors. Positioned under the Debug menu, the &#8220;Show JavaScript Console&#8221; option will soon become your best friend. I really have no clue why this is not included by default on Safari, it has to be one of the most useful features&#8230; then again, I&#8217;m a developer. <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Final Notes</h3>
<div class='wp-caption alignleft'>
<a href="http://file.ubrio.us/blog/yslow-score.png" rel="gallery[fbs]" title="ySlow Score"  class='lightview' onclick="pageTracker._trackPageview('/outgoing/file.ubrio.us/blog/yslow-score.png?referer=');"><img src="http://file.ubrio.us/blog/yslow-score-thumb.png" /></a></p>
<p class='wp-caption-text'>YSlow Score</p>
</div>
<p>Naturally Safari and FireFox will remain very different browsers and each will retain their strengths / weaknesses. Maybe I&#8217;m crazy, but I prefer to develop with Safari as my browser. I&#8217;m not really sure how this happened, but, meh, it works.</p>
<p>I&#8217;m not suggesting Safari is better, or even comparing it to FireFox for that matter &#8212; I just really think WebInspector offers a lot <del>more than I realized in the past</del> and is fairly unknown.</p>
<p>Since I&#8217;m doing general websites and not global, massive-traffic commercial sites things like CDN (<a href="http://developer.yahoo.com/performance/rules.html#cdn" onclick="pageTracker._trackPageview('/outgoing/developer.yahoo.com/performance/rules.html_cdn?referer=');">Content Delivery Network</a>) aren&#8217;t relative to me.  Also, <a href="http://developer.yahoo.com/performance/rules.html#etags" onclick="pageTracker._trackPageview('/outgoing/developer.yahoo.com/performance/rules.html_etags?referer=');">ETags</a> are a bit of a pain in the ass to implement for small sites. These 2 F&#8217;s can severely drag down your score which, while meaningless, is a bit of a bummer. (I know the Expires Headers can be important, but this shot was taken from a site on my development server, and not production so thats not implemented.)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/web/firebug-safari-yslow/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Best Bash Prompt</title>
		<link>http://blog.ubrio.us/nix/best-bash-prompt/</link>
		<comments>http://blog.ubrio.us/nix/best-bash-prompt/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 05:25:20 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Nix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[ps1]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/osx/bash-prompt-madness/</guid>
		<description><![CDATA[Okay &#8212; so after that last post I decided it was time for a change. I&#8217;ve had the same bash prompt for years and was starting to get tired of it. Over the past 30 or so minutes I&#8217;ve been hating life learning way more than I wanted to about PS1, colors and embedded IF [...]]]></description>
			<content:encoded><![CDATA[<p>Okay &#8212; so after that last post I decided it was time for a change. I&#8217;ve had the same bash prompt for years and was starting to get tired of it. Over the past 30 or so minutes I&#8217;ve been <del>hating life</del> learning way more than I wanted to about PS1, colors and embedded IF statements.</p>
<p>And yes, this needs it own post simply for the fact that this is an insane prompt. Heres what it is/can do:</p>
<ol>
<li>Automatically shortens itself if the path is longer than 18 charachters<br/><small>This is what I&#8217;ve always wanted since I usually name my folders after the website URL &#8212; and I <em>HATE</em> 2 line prompts.</small></li>
<li>Changes to red if the last command didn&#8217;t have a return code of 0</li>
<li>Includes your bash history # for easy <a href="http://linux.deadgod.net/2007/01/01/Special_Bash_Variables_I" onclick="pageTracker._trackPageview('/outgoing/linux.deadgod.net/2007/01/01/Special_Bash_Variables_I?referer=');">history command repeating</a></li>
<li>Is pretty neat and trim</li>
</ol>
<h5>Why is this rad?</h5>
<div class='wp-caption alignleft'>
<img src="http://file.ubrio.us/misc/best_bash_prompt_ever.png" /></p>
<p class='wp-caption-text'>Prompt Madness!</p>
</div>
<p>I&#8217;ll let this image explain what it does and how it looks&#8230;</p>
<p><br clear='left' /></p>
<p>I&#8217;m tossing up a text file here -> <a href="http://file.ubrio.us/misc/best_bash_prompt_ever.txt" onclick="pageTracker._trackPageview('/outgoing/file.ubrio.us/misc/best_bash_prompt_ever.txt?referer=');">best_bash_prompt_ever.txt</a> &#8212; since the escaping will probably be messed up.</p>
<pre>
export PROMPT_COMMAND='PS1="\[\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007"'
</pre>
<div class='help'>The second half (from &#8220;echo -ne&#8230;&#8221; on) is for the Terminal&#8217;s title.</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/nix/best-bash-prompt/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>OSX Terminal Niceties for Remote Servers</title>
		<link>http://blog.ubrio.us/nix/osx-terminal-niceties-for-remote-servers/</link>
		<comments>http://blog.ubrio.us/nix/osx-terminal-niceties-for-remote-servers/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 20:46:56 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Nix]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[nano]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/osx/osx-terminal-niceties-for-remote-servers/</guid>
		<description><![CDATA[I have absolutely no idea what to title this as &#8212; and frankly, its more for me than anyone else. I need a place to store this before I forget and go racking my brain 2 years from now on how to do this.
If you think you&#8217;re interested &#8212; this post is about the following:

How [...]]]></description>
			<content:encoded><![CDATA[<p>I have absolutely no idea what to title this as &#8212; and frankly, its more for me than anyone else. I need a place to store this before I forget and go racking my brain 2 years from now on how to do this.</p>
<h5>If you think you&#8217;re interested &#8212; this post is about the following:</h5>
<ol>
<li>How to get your current user/directory in the title of terminal (iTerm.app for this post &#8212; same applies for Terminal.app though)</li>
<li>How to make the backspace/delete keys work properly in nano/pico on local and remote servers</li>
<li>Update your current user/path in the title when you SSH into a remote machine</li>
<li>And how to setup password-less SSH, just because its on topic</li>
</ol>
<h3>.bashrc modifications</h3>
<p>Making Terminal.app&#8217;s title update to the current user &#038; path for both local and remote servers while letting the backspace and delete key work properly &#8212; all in one solution! <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class='tip'>Get yourself a nifty shell prompt over here -><a href="http://blog.ubrio.us/osx/best-bash-prompt/">Bash Prompt Madness</a></div>
<h5>Add the following lines to both your local &#038; remote .bashrc</h5>
<pre class="brush: ruby;">
# this is what updates your Terminal's title -- you can of course modify this
# but im not explaining how -- google it
export PROMPT_COMMAND='echo -ne &quot;\\033]0;${USER}:${PWD}\\007&quot;'

# this will make OSXs backspace &amp; delete keys work properly
# in nano &amp; pico
export TERM=xterm
stty erase ^H

# fancy prompt you say?
# again -- google for more info on this
export PS1=&quot;\\[\\033[0;34m\\][\\!]\[\\033[0;32m\\][\\u.\\h: \\w]\[\\033[0;32m\\]\\$\\[\\033[0m\\] &quot;

#gives you something like:
# [0][rob.hades: ~]$ echo 'hello world!'
</pre>
<h5>Now lets bind our servers for SSH so we don&#8217;t need passwords</h5>
<p>Passwords are annoying &#8212; especially when you are using <a href="http://en.wikipedia.org/wiki/Secure_copy" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Secure_copy?referer=');">scp</a> and <a href="http://en.wikipedia.org/wiki/Rsync" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Rsync?referer=');">rsync</a> a lot.</p>
<p>Here is a very simple way to drop those passwords and have SSH do all the work.</p>
<h6>In your terminal app (Locally)</h6>
<p>Make your .ssh directory<br />
<code><span>$></span>mkdir -p ~/.ssh &#038;&#038; cd ~/.ssh</code></p>
<p>Generate yourself some keys<br />
<code><span>~/.ssh $></span>ssh-keygen -t dsa -f ~/.ssh/id_dsa</code></p>
<p>Copy your public key to your remote server (Make sure the remote server has a ~/.ssh directory as well!)<br />
<code><span>~/.ssh $></span>scp id_dsa.pub {user}@{remoteserver}:.ssh</code></p>
<h6>In the remote computer</h6>
<p>Add that public key to your authorized_keys file for SSH<br />
<code><span>$></span>cd .ssh &#038;&#038; cat id_dsa.pub >> authorized_keys2</code></p>
<p>Cleanup those files and make sure the authorized_keys file is set to the right perms.<br />
<code><span>~/.ssh $></span>chmod 640 authorized_keys2 &#038;&#038; rm id_dsa.pub</code></p>
<p>That should make your life a bit more convenient <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/nix/osx-terminal-niceties-for-remote-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prepend files in OS X using the Command Line</title>
		<link>http://blog.ubrio.us/code/prepend-files-in-os-x-using-the-command-line/</link>
		<comments>http://blog.ubrio.us/code/prepend-files-in-os-x-using-the-command-line/#comments</comments>
		<pubDate>Mon, 12 Nov 2007 05:16:46 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Nix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/osx/prepend-files-in-os-x-using-the-command-line/</guid>
		<description><![CDATA[This is a neat little &#8220;trick&#8221; to prepend something simple to the beginning of a file. Linux is funny in the way that you can easily append to a file by using echo "append me to the file" >> FILE but theres no real simple way to prepend. Most snippets I&#8217;ve seen use a tmp [...]]]></description>
			<content:encoded><![CDATA[<p>This is a neat little &#8220;trick&#8221; to prepend something simple to the beginning of a file. Linux is funny in the way that you can easily append to a file by using <code>echo "append me to the file" >> FILE</code> but theres no real simple way to prepend. Most snippets I&#8217;ve seen use a tmp file but thats silly when OS X gives you some amazing programs. </p>
<p>Using <code>pbcopy</code> and <code>pbpaste</code> can save your life sometimes and are probably one programs I miss the most when using Linux. Anyway, heres just a simple &#8220;1 liner&#8221; for prepending.</p>
<p><code class='prettyprint'>cat FILE | pbcopy &#038;&#038; echo "Prepend Text" > FILE &#038;&#038; pbpaste >> FILE</code></p>
<p>Pretty simple, but it can be useful at times &#8212; like when you have a script that would be better off with a shebang line than being run by hand and you&#8217;re too lazy to open an editor.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/code/prepend-files-in-os-x-using-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making find and tar play nicely</title>
		<link>http://blog.ubrio.us/nix/making-find-and-tar-play-nicely/</link>
		<comments>http://blog.ubrio.us/nix/making-find-and-tar-play-nicely/#comments</comments>
		<pubDate>Thu, 27 Sep 2007 21:45:35 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Because I'll Forget]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Nix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[tar]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/because-ill-forget/because-ill-forget-1023/</guid>
		<description><![CDATA[Because I&#8217;ll forget #1023
Problem
Use Linux&#8217;s &#8220;find&#8221; command to hunt recursively through the current directory tree and find all matching files. While this is simple enough, I&#8217;m an idiot and tend to delete important files when drinking working too much &#8212; which we all know sucks. It would be nice to have it take all found [...]]]></description>
			<content:encoded><![CDATA[<h3>Because I&#8217;ll forget #1023</h3>
<p><strong>Problem</strong></p>
<p>Use Linux&#8217;s &#8220;find&#8221; command to hunt recursively through the current directory tree and find all matching files. While this is simple enough, I&#8217;m an idiot and tend to delete important files when <del>drinking</del> working too much &#8212; which we all know sucks. It would be nice to have it take all found files, tar them up and move it to the trash.</p>
<p><strong>Solution</strong></p>
<p>The evil, but oh-so-useful <code>xargs</code> command is your saving grace. While I hate using xargs its damn useful. If you take the output of find and pipe it into <code>tar</code> then pipe THAT into <code>rm</code> you get the job done. </p>
<p><strong>Example</strong></p>
<p>This is just a simple hack I&#8217;ve put together which seems to work and is relatively simple. (done as a bash function)</p>
<pre class='prettyprint'>
frm(){
	find . -name "$1" | xargs tar rvf "$1.tar" | xargs rm -rfv &#038;&#038; mv $1.tar ~/.trash
}
</pre>
<p>I just needed this because I had to wipe all <code>./.svn</code> directories so i just typed <code>frm .svn</code> and it created a .svn.tar and moved that to ~/.trash. Good stuff <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/nix/making-find-and-tar-play-nicely/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP5 With GD Support on OS X</title>
		<link>http://blog.ubrio.us/php/php5-with-gd-support-on-os-x/</link>
		<comments>http://blog.ubrio.us/php/php5-with-gd-support-on-os-x/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 02:39:15 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Because I'll Forget]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[gd]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/because-ill-forget/php5-with-gd-support-on-os-x/</guid>
		<description><![CDATA[Because I&#8217;ll Forget #15901:
Firstly, let me just say that compiling PHP has never been this difficult before. It shouldn&#8217;t be difficult at all actually. So heres the basic run down: I need SOAP, GD, SimpleXML and a few other miscellaneous extensions to make all my dev apps work properly &#8212; this went smoothly on the [...]]]></description>
			<content:encoded><![CDATA[<h3>Because I&#8217;ll Forget #15901:</h3>
<p>Firstly, let me just say that compiling PHP has never been this difficult before. It shouldn&#8217;t be difficult at all actually. So heres the basic run down: I need SOAP, GD, SimpleXML and a few other miscellaneous extensions to make all my dev apps work properly &#8212; this went smoothly on the ppc laptop, and I (stupidly) assumed that the Intel would be even easier. My first couple attempts were splattered with GD errors driving me to the brink of insanity as I scrambled up all the pre-requisites. Finally, I had all dependencies met and the configure script STILL would not quit barfing on me. I gave up and finally just installed PHP without GD support (naturally ruining the one project I&#8217;m working on currently). I gave up, until I felt feisty enough to give it another shot.</p>
<p>The configure script was choking on a linking error (<strong>GD build test failed. Please check the config.log for details.</strong>) and kept telling me to hunt config.log for some answers. It turns out that ./configure was attempting to link with shell variables that were empty. </p>
<p>Looks something like &#8220;<code>-L: directory name missing</code>&#8220;.</p>
<p><strong>The solution</strong></p>
<p>Hacking my way through the configure file you get to the culprit. </p>
<p><code class='prettyprint'>LIBS=" -L$GD_LIB $GD_SHARED_LIBADD  $LIBS"</code></p>
<p>Turns out that <code>echo $GD_LIB</code> is blank and being a major pain in the ass. To fix this, just edit the line to look more like: <code>LIBS=" $GD_SHARED_LIBADD  $LIBS"</code>. After that, try a <code>make clean</code>, <code>rm config.cache</code> and try to compile again.  Hopefully this will save you a couple hours of hating life.</p>
<p><strong>Resources:</strong></p>
<ul>
<li><a href="http://www.phpmac.com/articles.php?view=3" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.phpmac.com/articles.php?view=3&amp;referer=');">http://www.phpmac.com/articles.php?view=3</a> &#8212; good instructions for getting those GD dependencies.</li>
<li><a href="http://www.phpmac.com/articles.php?view=159" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.phpmac.com/articles.php?view=159&amp;referer=');">http://www.phpmac.com/articles.php?view=159</a> &#8212; more insight from the same site</li>
<li><a href="http://www.afp548.com/article.php?story=20041104230209410" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.afp548.com/article.php?story=20041104230209410&amp;referer=');">http://www.afp548.com/article.php?story=20041104230209410</a> &#8212; more about GD dependencies, and a little more insight into problems</li>
<li><a href="http://www.thescripts.com/forum/thread670263.html" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.thescripts.com/forum/thread670263.html?referer=');">http://www.thescripts.com/forum/thread670263.html</a> &#8212; explains the final solution in more depth</li>
</ul>
<p><strong>My Configure Script</strong><br />
<small>It might be beefed up in the future, but I&#8217;m just relieved to have it compiled &#038; working right now &#8212; I&#8217;m exhausted</small></p>
<pre class='prettyprint'>
./configure --prefix=/usr/local/php5 \
 --mandir=/usr/share/man \
 --infodir=/usr/share/info \
 --sysconfdir=/etc \
 --enable-cli \
 --enable-soap \
 --with-ldap=/usr \
 --with-xml \
 --with-libxml-dir=/usr/local \
 --with-zlib \
 --with-zlib-dir=/usr \
 --with-openssl \
 --enable-exif \
 --enable-ftp \
 --enable-mbstring \
 --enable-mbregex \
 --enable-dbx \
 --enable-sockets \
 --with-curl=/usr \
 --with-mysql=/usr/local/mysql \
 --with-mysqli=/usr/local/mysql/bin/mysql_config \
 --with-apxs \
 --with-gd \
 --with-jpeg-dir=/usr \
 --with-png-dir=/usr \
 --with-freetype-dir=/usr \
 --with-xpm-dir=/usr
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/php/php5-with-gd-support-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create icon sets in OS X</title>
		<link>http://blog.ubrio.us/osx/how-to-create-icon-sets-in-os-x/</link>
		<comments>http://blog.ubrio.us/osx/how-to-create-icon-sets-in-os-x/#comments</comments>
		<pubDate>Wed, 15 Aug 2007 00:54:35 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Because I'll Forget]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[icons]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/because-ill-forget/how-to-create-icon-sets-in-os-x/</guid>
		<description><![CDATA[Because I&#8217;ll Forget #1023:
Problem
I know how to _USE_ icon sets and set my icons*. My issue is that I want to take a folder of, say, *.PNG files and make the icon reflect the contents. I did some digging, and the solution is pretty simple &#8212; AND elegant.
Solution
There is a relatively unknown program, at least [...]]]></description>
			<content:encoded><![CDATA[<h3>Because I&#8217;ll Forget #1023:</h3>
<p><strong>Problem</strong><br />
I know how to _USE_ icon sets and set my icons*. My issue is that I want to take a folder of, say, *.PNG files and make the icon reflect the contents. I did some digging, and the solution is pretty simple &#8212; AND elegant.</p>
<p><strong>Solution</strong><br />
There is a relatively unknown program, at least it was to me, called &#8220;sips.&#8221; To take the generic PNG icon and replace it with a small thumbnail of the actual image you simply run <code>sips -i {image.ext}</code> from the command line. Beautiful!</p>
<p><strong>Example</strong></p>
<ol>
<li>Open a shell</li>
<li>cd {folder full of icons here}</li>
<li><code>find . -name "*.{ext}" -exec sips -i '{}' \;</code></li>
<li>Wait&#8230;</li>
<li>Start at the top of this page with how to change icons</li>
</ol>
<p><strong>Resources</strong></p>
<ul>
<li><a href="http://forums.macosxhints.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/forums.macosxhints.com/?referer=');">http://forums.macosxhints.com/</a></li>
</ul>
<hr noshade/>
<small>*opt-cmd-i anything, select source, copy icon, select desc, paste</small></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/osx/how-to-create-icon-sets-in-os-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

