Skip to content

Instantly share code, notes, and snippets.

@theory
Last active August 11, 2017 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save theory/8677613 to your computer and use it in GitHub Desktop.
Save theory/8677613 to your computer and use it in GitHub Desktop.
use v5.12;
use warnings;
use utf8;
my $uname = 'theory';
my ($curr_month, $curr_year) = (gmtime)[4,5];
$curr_year += 1900;
$curr_month += 1;
my %projects;
for my $year (2012..$curr_year) {
for my $month (1..12) {
last if $year == $curr_year && $month > $curr_month;
my $from = sprintf '%4d-%02d-01', $year, $month;
my $to = sprintf '%4d-%02d-01', $month == 12 ? ($year + 1, 1) : ($year, $month + 1);
my $res = `curl 'https://github.com/$uname?tab=contributions&from=$from&to=$to' | grep 'class="title"'`;
while ($res =~ /href="([^"?]+)/g) {
my (undef, $user, $repo) = split m{/} => $1;
$projects{"$user/$repo"}++;
}
}
}
say "$projects{$_}: $_" for sort keys %projects;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment