From 7ad685aa6bd77d76115132280ce323d7fc5aeeb0 Mon Sep 17 00:00:00 2001 From: 0scar Date: Thu, 10 Jun 2021 10:05:06 +0200 Subject: Add scripts --- .local/bin/plot_commits | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 .local/bin/plot_commits (limited to '.local/bin/plot_commits') diff --git a/.local/bin/plot_commits b/.local/bin/plot_commits new file mode 100755 index 0000000..4e4d161 --- /dev/null +++ b/.local/bin/plot_commits @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -e + +[ -n "${1}" ] && cd $1 + +REPOSITORY=$(basename $(git rev-parse --show-toplevel)) + +COMMITS=$(commits_by_hour -v \ + | sed -E 's/^/[/;s/$/],/;s/ /,/;s/0([0-9]+)/\1/g' \ + | tr -d '\n' \ + | sed -E 's/^/x,y = zip(*[/;s/$/])/') + +python -c "from matplotlib import pyplot as plt;\ + import numpy as np;\ + $COMMITS;\ + ymax=int(np.ceil(max(y) + (max(y)/10)));\ + plt.grid(which='major',alpha=0.5,linestyle='--',axis='y');\ + plt.bar(x,y,align='edge',width=1.0,color='#6fd0ff',edgecolor='#07a');\ + plt.ylabel('Commits');\ + plt.xlabel('Time');\ + plt.title('Commits by the hour of the day, ${REPOSITORY}.git');\ + plt.xlim(0,24);\ + plt.ylim(0,ymax);\ + plt.xticks(np.arange(0,24));\ + plt.yticks(np.arange(0,ymax,max(1,int(np.ceil(ymax/15)))));\ + plt.show()" -- cgit v1.3