Last active
February 16, 2017 15:06
-
-
Save YtvwlD/44952299f8616515c31b882a5252c653 to your computer and use it in GitHub Desktop.
big repo
This file contains hidden or 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
This file isn't important. |
This file contains hidden or 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
#!/usr/bin/env python3 | |
import sys | |
import git | |
import os | |
import string | |
import random | |
repo = git.Repo(".") | |
def init(): | |
print("Creating a random file.", end="", flush=True) | |
urandom = open("/dev/urandom", "rb") | |
save = open("random.file", "wb") | |
count = 0 | |
while count < 20 * 1024 * 1024 : # 20 MiB | |
save.write(urandom.read(1)) | |
count += 1 | |
if not count % (1024 * 1024): | |
print(".", end="", flush=True) | |
repo.git.add("random.file") | |
repo.git.commit(m="Created a random file.") | |
print("finished.", flush=True) | |
def add_folder(): | |
dirname = random_filename() | |
os.mkdir(dirname) | |
for i in range(50): # how many | |
os.link("random.file", os.path.join(dirname, random_filename()+".file")) | |
repo.git.add(dirname) | |
def random_filename(): | |
name = "" | |
for i in range(20): #length | |
name += random.choice(string.ascii_letters) | |
return name | |
if "init" in sys.argv: | |
init() | |
if "add" in sys.argv: | |
how_many = int(sys.argv[-1]) | |
print("Creating and committing directories.", end="", flush=True) | |
for i in range(how_many): | |
add_folder() | |
print(".", end="", flush=True) | |
repo.git.commit(m="Created {} directories.".format(how_many)) | |
print("finished.", flush=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment