Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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