This commit is contained in:
JMARyA 2024-08-25 14:59:10 +02:00
commit 4c28520ee9
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
4 changed files with 44 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/repo

18
README.md Normal file
View file

@ -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
```

1
scripts/loc.sh Normal file
View file

@ -0,0 +1 @@
tokei -C|choose 2|tail -n2|head -n1

24
util/over_time_vis.py Normal file
View file

@ -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()