-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
51 lines (42 loc) · 3.03 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import os
import numpy as np
from rich import print
import datetime
from git import Repo
from pathlib import Path
MULTIPLIER = 20
PIXEL_MATRIX = [
[1.0, 0.7, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.7, 1.0, 0.7, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.7, 1.0, 0.7, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.7, 1.0, 0.7, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.7, 1.0, 0.7, 0.4, 0.0],
[0.7, 1.0, 0.7, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.7, 1.0, 0.7, 1.0, 0.7, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.7, 1.0, 0.7, 1.0, 0.7, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.7, 1.0, 0.7, 1.0, 0.7, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.7, 1.0, 0.7, 1.0, 0.7, 0.4],
[0.4, 0.7, 1.0, 0.7, 0.4, 0.0, 0.0, 0.0, 0.4, 0.7, 1.0, 0.7, 0.4, 0.7, 1.0, 0.7, 0.4, 0.0, 0.0, 0.0, 0.4, 0.7, 1.0, 0.7, 0.4, 0.7, 1.0, 0.7, 0.4, 0.0, 0.0, 0.0, 0.4, 0.7, 1.0, 0.7, 0.4, 0.7, 1.0, 0.7, 0.4, 0.0, 0.0, 0.0, 0.4, 0.7, 1.0, 0.7, 0.4, 0.7, 1.0, 0.7],
[0.0, 0.4, 0.7, 1.0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
]
def fake_commits(
commit_amount=1,
commit_date=datetime.datetime(2024, 1, 7, tzinfo=datetime.timezone.utc),
):
repo = Repo(".")
mock_file = Path("commit_mocker.txt")
for i in range(commit_amount):
print(f"Mock commit {i} on {commit_date}")
mock_file.write_text(f"Mock commit {i} on {commit_date}")
repo.index.add(["commit_mocker.txt"])
repo.index.add(["commit_mocker.txt"])
os.system(f"git commit -m 'Mock commit {i}' --date='{commit_date}' --quiet")
def main():
initial_pixel_matrix = np.array(PIXEL_MATRIX)
pixel_matrix = initial_pixel_matrix.transpose()
commit_date = datetime.datetime(2024, 1, 7)
for column in pixel_matrix:
for pixel in column:
commit_amount = int(pixel * MULTIPLIER)
print(f"Commit: {commit_amount}, Date: {commit_date}")
fake_commits(commit_amount, commit_date)
commit_date += datetime.timedelta(days=1)
print()
if __name__ == "__main__":
main()
# how to execute command line in the terminal from the python code: