Ruby script to send PragPub magazine to Kindle
For the first snippet there is no much room for improvement, but you can use File.write:

begin
  content = open(url).read
  File.write(filepath, content)
rescue OpenURI::HTTPError =&gt; e
  abort "Unable to download #{url}: #{e.to_s}"
end


For the options parsing part, I'd definitely recommend something better than optparse, for example https://github.com/jashmenn/trollop/