EC2 ssh sftp fuse on OSX made easy 1
I’m deploying a cluster of servers on Amazon EC2 in my job, It’s a really cool technology. I’m setting up the servers to use puppet as an administration tool, but haven’t gotten very far in that yet. I am still at the configure the image stage.
One thing that really bugged me is this. I manage the AMI instance and the EBS volumes using the Elastifox plugin for firefox. There are command line tools too, but a gui is way easier here. One of the cool features in the gui is when you right click on an AMI instance and hit “Connect to Public DNS Name”, elasticfox will open a terminal and ssh to that server automaticly.
I then would copy the new for-this-session-only AMI dns name, Open my SFTP client and paste it in, set up the public key and connect. This last step sucks, It takes 30 seconds minimum every time, 10-20 times a day. I modified the script provided with elastifox, to work with the great google project MacFUSE which mounts SFTP Volumes just like drives in OSX finder. Now I right click on an instance, it opens SSH and mounts the drive for drag and drop ease.
Here’s what I did.
This site provided alot of help for me
Install the Elasticfox Firefox plugin. Read the Documentation
Click the Tools button in Elasticfox.
Enter your data in the blue highlighted area.

#add this code
-e 'on run argv' -e 'tell app "System Events" to set termOn to (exists process "Terminal")' -e 'set cmd to "mkdir /Volumes/" & item 3 of argv & ";sshfs -C " & item 2 of argv & "@" & item 3 of argv & ":/ /Volumes/" & item 3 of argv & " -oIdentityFile=" & item 1 of argv & ",reconnect,noappledouble,ping_diskarb,follow_symlinks,noreadahead,volname=" & item 1 of argv & ";ssh -L10000:localhost:10000 -L3307:localhost:3306 -i " & item 1 of argv & " " & item 2 of argv & "@" & item 3 of argv & ";"' -e 'if (termOn) then' -e 'tell app "Terminal" to do script cmd' -e 'else' -e 'tell app "Terminal" to do script cmd in front window' -e 'end if' -e 'tell app "Terminal" to activate' -e 'end run' ${key} ${user} ${host}
Install MacFuse
Once MacFuse is installed make a symbolic link in the terminal, the following code may not be pointed at the correct file, so double check it.
sudo ln /Applications/sshfs.app/Contents/Resources/sshfs-static-10.5 /usr/local/bin/sshfs
sudo ln /Applications/sshfs.app/Contents/Resources/sshnodelay.so /usr/local/lib/
Thats it! Right click on an ami, and ssh will open and Finder will mount the instance, via ssh.
If you need to set up tunnels ( for mysql admin and such ) modify the command and add the ssh tunnel “-L3307:127.0.0.1:3306” between “ssh -i”. Then use your admin tool and connect up to localhost:3307
If Volumes dont show up, on desktop: check show connected servers on desktop in the Finder Preferences.

Search all craigslist telecommute jobs 2
I recently got a new job, it’s pretty cool.
While I was looking for work, I wrote this script. It searches all the craigslist cities in the USA, for telecommute gigs, then saves the result to one handy html page that you can link from.
If you want other countries, just add the 2 character iso country code to the script.
#! /usr/bin/env ruby
require 'rss'
require 'yaml'
require 'cgi'
# Allows open to access remote files
require 'open-uri'
# available iso codes are
# iso_codes = %w{AB AA AF SQ AM AR HY AS AY AZ BA EU BN DZ BH BI BR BG MY BE KM CA ZH CO HR CS DA NL EN EO ET FO FJ FI FR FY GD GL KA DE EL KL GN GU HA IW HI HU IS IN IA IE IK GA IT JA JW KN KS KK RW KY RN KO KU LO LA LV LN LT MK MG MS ML MT MI MR MO MN NA NE NO OC OR OM PS FA PL PT PA QU RM RO RU SM SG SA SR SH ST TN SN SD SI SS SK SL SO ES SU SW SV TL TG TA TT TE TH BO TI TO TS TR TK TW UK UR UZ VI VO CY WO XH JI YO ZU}
########## change these parameters
@iso_codes = %w{ us }
query = ARGV.join(" ")
##################################
def look_for_job(query)
iso_codes = @iso_codes
city_list = []
# This gets a list of the current craigslist cities for the iso country code
iso_codes.each do |iso|
cities = open("http://geo.craigslist.org/iso/#{iso}").read()
reg = cities.scan(/http:\/\/.*?\//)
#delete these links from the geo pages
del = %w{http://www.w3.org/ http://www.craigslist.org/ http://www.craigslist.org/ http://en.wikipedia.org/ http://forums.craigslist.org/}
res = reg - del
city_list += res
end
# this gets the jobs then writes an html file out linking them
jobs = {}
query = CGI::escape(query)
# Turned threading off, it was overwhelming craigslist and they throttled the results
# threads = []
city_list.each do |city|
# threads << Thread.new(city_ea) do |city|
# What feed are we parsing?
rss_feed = "#{city}search/jjj?query=#{query}&addOne=telecommuting&format=rss"
# Variable for storing feed content
rss_content = ""
# Read the feed into rss_content
begin
open(rss_feed) do |f|
rss_content = f.read
end
puts rss_feed
# Parse the feed, dumping its contents to rss
rss = RSS::Parser.parse(rss_content, false)
# Output the feed title and website URL
if rss.items.length > 0
jobs[city] = rss.items
end
rescue Exception => e
end
# end
end
# threads.each {|thr| thr.join }
@outstuff = File.open('jobs.html','w+')
jobs.keys.sort.each do |city|
jobs[city].sort!{|a,b| a.title<=>b.title}
jobs[city].each{ |e| @outstuff.write("#{city}--<a href='#{e.link}'>#{e.title}</a><br />\n") }
end
@outstuff.close
puts "done"
end
if ARGV.length == 0
puts "\n\nUSAGE: craigslist_rss_query.rb your job keywords\n
the result is saved as jobs.html in the same directory\n\n"
else
look_for_job(query)
end
It goes to 11, the new apple audio update.
I’ve been having trouble with my new macbook pro, specifically the audio sounds fuzzy ( there was lots of back ground static ) at low volumes. The audio quality was also way below the last MacBook I had. Apple just updated the airport extreme card, and my audio problems went away.
There is still static at low volumes, the strange thing about it is that the static is constant loudness, no matter what volume the macbook is set to. On my ipod shuffle ( the best ipod for sound quality ), the static is only noticeable at extreme volumes when there is silence in the song.
The random r2 d2 like beeps are still there, but much muted.

The only strangeness with the audio change is the volume levels, It is LOUD now, go to a concert and hear a deaf rock-star play loud. I have to watch the volume settings or my ears will blow when I get mail. I can’t wait to test out some of my more power hungry headphones, maybe they will work with the laptop without a preamp now.
Death
I just found out that an ex-coworker of mine died, suicide. Christopher Mark Leighton-Brooder, I was looking him up to chat about some web stuff, dead. Weird. He worked at Dow Jones when I worked there, less than a year ago, and left all of a sudden, don’t know why, I’m guessing it wasn’t voluntary. Stress wreaks havoc a person. It’s too late to send condolences, It happened in May, he was a really nice guy and will be missed.

Command prompt here on OSX
One of the things i miss from the Windows powertoys collection while in osx, is the command prompt here app. In windows once this tool was installed, right click from a directory, and the shell opens, you in that directory.
I found a solution for osx. It’s a chunk -o- applescript http://jo.irisson.free.fr/?p=59. Download the file, and drag it into the Finders top button bar.
When you press it, a terminal window will open and cd you to your finders window.
If you want to open finder from terminal, type: open .
Error Type Unpickleable Error Plone
I’m doing some Plone work for Honda for the last few days. I wrote the site but haven’t touched Plone for a few years. It’s like re-learning it all over again, and time learning isn’t billable, DOH!!!
I beat my self up over this error today:
# obscure plone error
Error Type
UnpickleableError
Error Value
Cannot pickle objects
I was trying to get the request to persist across a few pages by adding it to the session, I was ALSO adding a database result set to the request.
You can add simple python structures to the session but not objects, like database result sets.
I changed the order of a few lines of code and all was happy.
dollars per dumptruck == $6,770,646
I’ve been following the latest round of Wall Street failures, and how the CEO level guys get reprimanded then handed HUGE bonuses.
This brings me to my favorite calculation for these guys, I made it up a while back under a particulary egregious case.
Dollars per Dumptruck == $6,770,646
Figured out:
Volume of Standard Dumptruck = 10 cubic yards
Cubic inches per Cubic yard (36 ^3) = 46,656
Volume of US Dollar
2.61 inches wide X 6.14 inches long X 0.0043 inches thick = 0.06890922 cubic inches
## TOTAL
((36^3) / .06890922) * 10 = $6,770,646 per dumptruck
Now you know
Fix your broken t-zones on the iPhone
Tzones $5.99 iphone plan fix backround
My $5.99 dataplan stopped working.
I jailbroke my iphone with ziphone, and have version 1.13 installed.
I used the T-zones hack 1.14 via the installer application which ziphone uses. This hack installs a proxy file which your phone needs to use the internet via the $5.99 plan.
Tmobile changed the subnet of their wap services with the 3g rollout. So you will have to change them too.
The proxy.pac file, installed by the T-zones hack, doesn’t take the recent changes into account. You need to fix that file.
Instructions
### login
Turn your phones wifi on.
Once you are connected to the wifi point,
click the right arrow for your access point on the wifi screen
(Settings:wifi:right arrow).
Note the IP address
Go to your Settings:General:Auto Lock; change to never
( until you are done with ssh )
ssh into your phone, using putty on windows, or ssh in terminal on osx.
the command to ssh is:
Open up terminal in OSX (Applications:Utilities:Terminal)
ssh root@<your iphones ip address>
password=alpine
### edit the proxy.pac file
nano /private/var/preferences/proxy.pac
change 10.0.0.0 to 25.0.0.0
save (ctrl + x)
### cleanup
logout (ctrl + d)
restart the phone
Done.
Computer Choline
I upgraded the the new powerbook with more ram; 4gb of CAS4 ram replaced the stock 2gb of CAS5 ram. It took the same time to boot, but seems more responsive when restarting apps. I upgraded because it was cheap, and every so often, a few times a month 2gigs wasn’t enough and the whole system came grinding to a halt. I took the old ram and upgraded Marijo’s Macbook, going from 1 to 2 gigs, she noticed a dramatic speed increase. The funny thing is her computer boots in 27 seconds, using Tiger. While mine ( faster, more ram, more video mem ) takess 47 seconds to boot. Maybe a memory check is part of the boot sequence? Who knows, either way I still recommend the upgrade.
mod_rails AKA passenger 1
I just had to redeploy a rails site I wrote for Ameriprise to a different server. Originally I used Mongrel, then Mongrel Cluster, behind modproxybalancer, It was deployed on Ubuntu 7.10.
The new server is Ubuntu 8.04. Since it was a different version of Ubuntu, I couldn’t just tar up the /etc/apache2 directory, I had to redeploy. I had some maintenance issues with the old Mongrel cluster setup, specifically when other people screw with the server and mess up Mongrel. I heard about passenger or ”mod_rails” and thought I’d give it a try.
It was a breeze to set up. And worked as advertised, rails apps deploy as easily as a php app. Just point the virtualhost DocumentRoot to the /app/public and you are done.
It’s as fast as Mongrel and WAY WAY easier to use. I think this will be THE lynch pin that will really let the rails get big.
People don’t give enough credence to easy setup. I’ve worked with server apps that take WEEKS to get set up, and even then, you don’t really know if it’s done correctly. Difficult to setup, simply means difficult to setup, not better. I can battle with a server for 2 weeks and get some pride that I did it, or set it up easily and play with my child, and get pride in that.
Thankfully Rails in general isn’t that difficult. I’ve been coding rails since version 0.7 or so, there have been alot of different server configs to learn, each better than the last in some way. My take on the whole evolution of rails deployments is this: Even if performance is slightly LOWER, I will choose ease of use any day, mod_rails is that choice.