Skip to content

Instantly share code, notes, and snippets.

@jkramer
Created October 27, 2009 12:03
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 jkramer/219517 to your computer and use it in GitHub Desktop.
Save jkramer/219517 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use Chart::Pie;
use IO::File;
my $pie = Chart::Pie->new(640, 480);
my $score;
my $io = new IO::File($ENV{HISTFILE});
for($io->getlines) {
/^:\s*\d*:\d*;(\w+)/ or next;
++$score->{$1};
}
my $top = {
map { $_ => $score->{$_} }
(sort { $score->{$b} <=> $score->{$a} } keys %$score)[0 .. 9]
};
$pie->add_dataset(keys %$top);
$pie->add_dataset(values %$top);
$pie->png("history.png");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment