Skip to content

Instantly share code, notes, and snippets.

@predominant
Created May 8, 2010 00:10
Show Gist options
  • Save predominant/394169 to your computer and use it in GitHub Desktop.
Save predominant/394169 to your computer and use it in GitHub Desktop.
#!/opt/local/bin/php
<?php
// Get a git log
$log = trim(`git shortlog -s -n -e`);
$log = explode("\n", $log);
// Clean and make a new directory for images.
`rm -rf gource-gravatars`;
mkdir('gource-gravatars');
chdir('gource-gravatars');
foreach ($log as $line) {
preg_match('/^\s*[0-9]+\s([^\<]+)\s\<([^\>]+)\>$/i', $line, $matches);
$user = array('name' => $matches[1], 'email' => md5($matches[2]));
$url = '"http://www.gravatar.com/avatar/' . $user['email'] . '?s=100"';
$name = '"' . utf8_encode($user['name']) . '.jpg"';
//echo "wget {$url} -O {$name}\n";
echo ".";
`wget {$url} -o {$name}`;
}
echo "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment