From 4c28520ee9ab081b0c541aa2559f0331609c6de7 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Sun, 25 Aug 2024 14:59:10 +0200 Subject: [PATCH] init --- .gitignore | 1 + README.md | 18 ++++++++++++++++++ scripts/loc.sh | 1 + util/over_time_vis.py | 24 ++++++++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 scripts/loc.sh create mode 100644 util/over_time_vis.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc33e4c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/repo \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..59a80e2 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# Giterator Presets + +Prebuild presets / examples for usage of [giterator](https://git.hydrar.de/jmarya/giterator). + +## Usage +Common scripts are in `./scripts` and utilities like visualization are in `./utils`. + +Usage: +```shell +# Run a script on a repo +giterator -s [SCRIPT] [REPO] + +# Run a script on a repo and visualize the results over time +giterator -j -s [SCRIPT] [REPO]|python3 ./util/over_time_vis.py + +# Example: Visualize LOC (Lines of Code) over time +giterator -j -s ./scripts/loc.sh [REPO]|python3 ./util/over_time_vis.py +``` diff --git a/scripts/loc.sh b/scripts/loc.sh new file mode 100644 index 0000000..efdeb12 --- /dev/null +++ b/scripts/loc.sh @@ -0,0 +1 @@ +tokei -C|choose 2|tail -n2|head -n1 \ No newline at end of file diff --git a/util/over_time_vis.py b/util/over_time_vis.py new file mode 100644 index 0000000..e9d6aa2 --- /dev/null +++ b/util/over_time_vis.py @@ -0,0 +1,24 @@ +import json +from datetime import datetime +import sys +import matplotlib.pyplot as plt + +data = json.loads(sys.stdin.read()) + +# Extracting datetime and stdout values +datetimes = [] +stdout_values = [] + +for entry in data: + datetimes.append( + datetime.strptime(entry['datetime'], "%Y-%m-%d %H:%M:%S %z")) + stdout_values.append(int(entry['stdout'])) + +# Plotting +plt.plot(datetimes, stdout_values, marker='o') +plt.xlabel('Datetime') +plt.ylabel('stdout') +plt.title('stdout over Time') +plt.xticks(rotation=45) +plt.tight_layout() +plt.show()