Skip to content

Instantly share code, notes, and snippets.

@thesabbir
Created May 10, 2016 05:49
Show Gist options
  • Save thesabbir/23e5d85a0fb7d454b0fbeeae9f2343fd to your computer and use it in GitHub Desktop.
Save thesabbir/23e5d85a0fb7d454b0fbeeae9f2343fd to your computer and use it in GitHub Desktop.
Script to find out full github contributions
use v5.12;
use warnings;
use utf8;
my $uname = 'thesabbir';
my %projects;
for my $year (2014..2016) {
for my $month (1..12) {
last if $year == 2016 && $month > 1;
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