Created
May 31, 2020 08:38
-
-
Save SqrtMinusOne/6e7a5abb8e3c54bcc7b0e8bea04a6d6f to your computer and use it in GitHub Desktop.
Run gource for multiple repos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gource combined.log --filename-time 2.0 --seconds-per-day 10 --user-image-dir ~/.gravatars --auto-skip-seconds 1.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
#fetch Gravatars | |
use strict; | |
use warnings; | |
use LWP::Simple; | |
use Digest::MD5 qw(md5_hex); | |
my $size = 90; | |
my $output_dir = '.avatars'; | |
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
DIRS = ['backend', 'frontend', 'docs'] | |
for directory in DIRS: | |
os.system(f'gource --output-custom-log {directory}.log ./{directory}') | |
REPLACE = { | |
'Корытов Павел Валерьевич': 'SqrtMinusOne', | |
'Корытов Павел': 'SqrtMinusOne', | |
'Korytov Pavel': 'SqrtMinusOne', | |
} | |
for directory in DIRS: | |
os.system(f'sed -i -r "s#(.+)\\|#\\1|/{directory}#" {directory}.log') | |
for filename in DIRS: | |
for a, b in REPLACE.items(): | |
os.system(f'sed -i "s/{a}/{b}/g" {filename}.log') | |
os.system('cat ' + '.log '.join([*DIRS, '']) + ' | sort -n > combined.log') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment