Skip to content

Instantly share code, notes, and snippets.

@tommeier
Created September 14, 2012 05:37

Revisions

  1. tommeier revised this gist Sep 14, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gource_setup.sh
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,4 @@ $> cd git_directory
    git_directory$> #http://code.google.com/p/gource/wiki/GravatarExample
    git_directory$> vi avatar.perl
    git_directory$> perl avatar.perl
    git_directory$> gource -1280x720 -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -crf 1 -threads 0 -bf 0 gource.mp4 -user-image-dir .git/avatar/
    git_directory$> gource -1280x720 --user-image-dir .git/avatar/ -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -crf 1 -threads 0 -bf 0 gource.mp4
  2. tommeier revised this gist Sep 14, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gource_setup.sh
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,4 @@ $> cd git_directory
    git_directory$> #http://code.google.com/p/gource/wiki/GravatarExample
    git_directory$> vi avatar.perl
    git_directory$> perl avatar.perl
    git_directory$> gource -1280x720 -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -crf 1 -threads 0 -bf 0 gource.mp4 --user-image-dir .git/avatar/
    git_directory$> gource -1280x720 -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -crf 1 -threads 0 -bf 0 gource.mp4 -user-image-dir .git/avatar/
  3. tommeier created this gist Sep 14, 2012.
    48 changes: 48 additions & 0 deletions avatar.perl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    #!/usr/bin/perl
    #fetch Gravatars

    use strict;
    use warnings;

    use LWP::Simple;
    use Digest::MD5 qw(md5_hex);

    my $size = 90;
    my $output_dir = '.git/avatar';

    die("no .git/ directory found in current path\n") unless -d '.git';

    mkdir($output_dir) unless -d $output_dir;

    open(GITLOG, q/git log --pretty=format:"%ae|%an" |/) or die("failed to read git-log: $!\n");

    my %processed_authors;

    while(<GITLOG>) {
    chomp;
    my($email, $author) = split(/\|/, $_);

    next if $processed_authors{$author}++;

    my $author_image_file = $output_dir . '/' . $author . '.png';

    #skip images we have
    next if -e $author_image_file;

    #try and fetch image

    my $grav_url = "http://www.gravatar.com/avatar/".md5_hex(lc $email)."?d=404&size=".$size;

    warn "fetching image for '$author' $email ($grav_url)...\n";

    my $rc = getstore($grav_url, $author_image_file);

    sleep(1);

    if($rc != 200) {
    unlink($author_image_file);
    next;
    }
    }

    close GITLOG;
    7 changes: 7 additions & 0 deletions gource_setup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    $> brew install gource
    $> brew install ffmpeg
    $> cd git_directory
    git_directory$> #http://code.google.com/p/gource/wiki/GravatarExample
    git_directory$> vi avatar.perl
    git_directory$> perl avatar.perl
    git_directory$> gource -1280x720 -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -crf 1 -threads 0 -bf 0 gource.mp4 --user-image-dir .git/avatar/