Skip to content

Instantly share code, notes, and snippets.

@ascheink
Last active December 13, 2015 20:08

Revisions

  1. Andrei Scheinkman revised this gist Feb 16, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gitmo-splash.rb
    Original file line number Diff line number Diff line change
    @@ -17,4 +17,4 @@

    puts "Combining images"
    system "convert -define jpeg:size=200x200 0*.jpg -thumbnail 60x60^ -gravity center -extent 60x60 square.jpg"
    system "montage -bordercolor red -geometry 60x60+0+0 -tile 15x10 square*.jpg splash.jpg"
    system "montage -geometry 60x60+0+0 -tile 15x10 square*.jpg splash.jpg"
  2. Andrei Scheinkman created this gist Feb 16, 2013.
    20 changes: 20 additions & 0 deletions gitmo-splash.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    require 'nokogiri'
    require 'httparty'

    puts "Scraping ids of detainees in custody"
    ids = []
    (1..10).each do |n|
    response = HTTParty.get "http://projects.nytimes.com/guantanamo/detainees/held?page=#{n}"
    page = Nokogiri::HTML(response)
    ids += page.css('#detaineesTable a').map { |link| $1 if /detainees\/(\d+)/ =~ link['href'] }.compact
    end

    puts "Grabbing WikiLeaks photos"
    ids.each do |id|
    url = "http://projects.nytimes.com/guantanamo/images/faces/#{"%06d" % id}.jpg"
    system "wget -q #{url}" if HTTParty.get(url).code == 200
    end

    puts "Combining images"
    system "convert -define jpeg:size=200x200 0*.jpg -thumbnail 60x60^ -gravity center -extent 60x60 square.jpg"
    system "montage -bordercolor red -geometry 60x60+0+0 -tile 15x10 square*.jpg splash.jpg"