#!/usr/bin/env ruby
require 'open-uri'
open('http://whatismyip.com') do |f|
puts "Open failed: #{f.status.inspect}" unless f.status.first == "200"
#
WhatIsMyIP.com - 207.81.136.119
title = f.gets while title !~ /WhatIsMyIP\.com - (\d[\d.]+)
ip = $1.chomp
ENV['SHELL'] = '/bin/bash'
`echo -n "#{ip}" | pbcopy`
puts ip
end