Skip to content

Instantly share code, notes, and snippets.

@bessarabov
Last active March 27, 2024 07:46
Show Gist options
  • Save bessarabov/674ea13c77fc8128f24b5e3f53b7f094 to your computer and use it in GitHub Desktop.
Save bessarabov/674ea13c77fc8128f24b5e3f53b7f094 to your computer and use it in GitHub Desktop.
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --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); }'
@azl397985856
Copy link

I got an error with:

zsh: no matches found: {} = ; }{  = max values %h; foreach (0..23) { {tree=ls -R | grep :$ | sed -e s/:$// -e s/[^-][^/]*//--/g -e s/^/
zsh: no matches found: /} = 0 if not exists {tree=ls -R | grep :$ | sed -e s/:$// -e s/[^-][^/]*//--/g -e s/^/
zsh: no matches found: /} } foreach (sort { <=>  } keys %h) { say sprintf "%02d - %4d %s", tree=ls -R | grep :$ | sed -e s/:$// -e s/[^-][^/]*//--/g -e s/^/
zsh: no matches found: /, {tree=ls -R | grep :$ | sed -e s/:$// -e s/[^-][^/]*//--/g -e s/^/
zsh: no matches found: /}, "*"x ({tree=ls -R | grep :$ | sed -e s/:$// -e s/[^-][^/]*//--/g -e s/^/
zsh: no such file or directory: /} /  * 50); }

am I wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment