-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
52 lines (39 loc) · 1.34 KB
/
main.py
File metadata and controls
52 lines (39 loc) · 1.34 KB
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
49
50
51
52
import datetime, os, random
from letter_patterns import letter_patterns
#!!!!!!!!! WARNING !!!!!!!!
#!!!!!!!!! the first day of your chosen year must be Wednesday at the latest !!!!!!!!
year = 2017
start_date = datetime.date(year, 1, 1)
def calculate_commit_dates(text):
text = text.upper()
commit_dates = []
for i, char in enumerate(text):
if char in letter_patterns:
pattern = letter_patterns[char]
for row in range(5):
for col in range(5):
if pattern[row][col] == "#":
week_offset = i * 6 + col # We leave 1 column space between letters
day_offset = row
commit_date = start_date + datetime.timedelta(weeks=week_offset, days=day_offset)
commit_dates.append(commit_date)
return sorted(commit_dates)
# YOUR TEXT HERE
text = "NS.CPP"
# YOUR TEXT HERE
dates = calculate_commit_dates(text)
f = open("dates.txt", "w")
for date in dates:
print(date)
f.write(str(date)+'\n')
f.close()
j = open('dates.txt','r')
for date in j:
a=0
d = str(a) + 'days ago'
with open('test.txt' , 'a') as file:
file.write(d+'\n')
os.system('git add test.txt')
os.system('git commit -m 1 --date=" '+date+'"')
a+=1
os.system('git push -u origin main -f')