Skip to content

Instantly share code, notes, and snippets.

@YtvwlD
Last active February 16, 2017 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YtvwlD/44952299f8616515c31b882a5252c653 to your computer and use it in GitHub Desktop.
Save YtvwlD/44952299f8616515c31b882a5252c653 to your computer and use it in GitHub Desktop.
big repo
This file isn't important.
#!/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