Skip to content

Instantly share code, notes, and snippets.

@jgonera
Created January 17, 2013 01:48
Show Gist options
  • Save jgonera/b5a97d4dc34f5fc56304 to your computer and use it in GitHub Desktop.
Save jgonera/b5a97d4dc34f5fc56304 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby -w
require 'open-uri'
require 'yaml'
RE = /(?<lang>.*)(?<site>wik.*) (?<ver>.*) \*/
$sites = { 'all' => {} }
def add_ver(site, ver)
$sites[site] ||= {}
$sites[site][ver] ||= 0
$sites[site][ver] += 1
end
open('http://noc.wikimedia.org/conf/wikiversions.dat') do |versions|
versions.each_line do |line|
entry = RE.match line.encode('UTF-8')
add_ver entry['site'], entry['ver']
add_ver 'all', entry['ver']
end
end
puts $sites.to_yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment