From 7b8ce27c76ec006d69411a8e2cd8568d7bed5af7 Mon Sep 17 00:00:00 2001 From: Morgan Wattiez Date: Mon, 22 Jul 2019 20:21:22 +0200 Subject: [PATCH] improve active_hours script --- active_hours.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/active_hours.sh b/active_hours.sh index 561d7b1..3f1785a 100755 --- a/active_hours.sh +++ b/active_hours.sh @@ -1 +1,4 @@ -git log --author="Morgan" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }' +git log --author="Morgan" \ + --format="%ad" \ + --date="format:%H" |\ + awk '{n=$1+0;if(H[n]++>max)max=H[n]}END{for(i=0;i<24;i++){printf"%02d -%5d ",i,H[i];for(n=0;n