Created
December 31, 2011 08:43
-
-
Save ainame/1543416 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'active_support/time' | |
| unless ARGV[0] | |
| puts 'usage: ruby twilog.rb SCREEN_NAME YEAR' | |
| exit(1) | |
| end | |
| screen_name = ARGV[0] | |
| year = ARGV[1] || Date.today.year | |
| `mkdir -p twilog/#{screen_name}` | |
| date = Date.new(year) | |
| Date::DATE_FORMATS[:twilog] = "%y%m%d" | |
| 365.times do |i| | |
| format = date.since(i.days).to_date.to_s(:twilog) | |
| `curl -o twilog/#{screen_name}/#{format}.html http://twilog.org/#{screen_name}/date-#{format}` | |
| sleep 1 | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment