the github repository here https://github.com/webprice/9autocommit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import random | |
import string | |
#generate random number, that will declare how many letters | |
#will be added to the text.txt file. Each time we change the text.txt file | |
#we can made a commit and push it to the reote repo | |
#which will be considered as a github contribution | |
x = random.randrange(10) | |
random_letter = random.choices(string.ascii_letters,k=x) | |
#function which actually adding those letters t the text.txt file | |
def random_letter_write(letters): | |
try: | |
streng = "" | |
for l in letters: | |
streng += l | |
time.sleep(1) | |
#opening the text.txt file, but if it doesn't exist, it will be created, | |
#this is why were using a+ attribute | |
with open("text.txt",'a+') as f: | |
f.write(streng) | |
time.sleep(1) | |
f.close() | |
return "all went good" | |
except: | |
return "all bad" | |
random_letter_write(random_letter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
#running the python script first | |
#it will generate letters, add those letters to the file text.txt | |
#file gonna change and git will see those changes | |
python3 rand_gen.py | |
#executing classic git commands | |
#and since we have added and bind ssh key to the VPS system | |
#we can automatically upload git changes to the remote repo | |
#without any logins or passwords | |
git add . | |
git commit -m "autogenerated by script" | |
git push --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment