-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.py
More file actions
53 lines (41 loc) · 1.55 KB
/
dev.py
File metadata and controls
53 lines (41 loc) · 1.55 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
53
import os
import random
from datetime import datetime, timedelta
total_day = 458 # Total days back
repo_link = "https://github.com/PwnKit/commit_generator.git"
now = datetime.now()
ctr = 1
pointer = 0
# Initialize commit file
f = open("commit.txt", "w")
f.close()
# Set up Git configurations
os.system("git config user.name 'YourUsername'")
os.system("git config user.email 'youremail@example.com'")
os.system("git init")
while pointer < total_day:
# Calculate the date for this iteration
current_day = now - timedelta(days=pointer)
# Randomly decide whether to make commits or skip the day
skip_day = random.choice([True, False]) # Randomly choose to skip or not
if skip_day:
print(f"Skipping day {current_day.strftime('%Y-%m-%d')} with no commits.")
pointer += 1
continue
# Random commit frequency per day (between 1 and 10 commits per day)
commit_frequency = random.randint(1, 10)
for _ in range(commit_frequency):
# Prepare the commit date and message
formatdate = current_day.strftime("%Y-%m-%d")
with open("commit.txt", "a+") as f:
f.write(f"Commit {ctr}: {formatdate}\n")
# Git commit actions
os.system("git add .")
os.system(f"git commit --date=\"{formatdate} 12:15:10\" -m \"Commit {ctr}\"")
print(f"Commit {ctr}: {formatdate}")
ctr += 1
pointer += 1
# Push to remote repository
os.system(f"git remote add origin {repo_link}")
os.system("git branch -M main")
os.system("git push -u origin main -f")