Skip to content

Instantly share code, notes, and snippets.

@arwankhoiruddin
Created September 23, 2017 10:39
Show Gist options
  • Save arwankhoiruddin/fdc4c1c3e14e1399cc73fb779cfea282 to your computer and use it in GitHub Desktop.
Save arwankhoiruddin/fdc4c1c3e14e1399cc73fb779cfea282 to your computer and use it in GitHub Desktop.
import random
import sys
#this is to create file with certain amount of size
sizeWanted = int(sys.argv[1]) # in kilobytes
sizeWanted = sizeWanted*1024 # convert from byte into kilobyte
wordCreated = ''
fileName = sys.argv[2]
tmp = -1
for i in range(sizeWanted):
pct = (100 * i) / sizeWanted
if tmp != pct:
print "percentage of the file created: " + str(pct)
tmp = pct
wordCreated = wordCreated + chr(98)
f = open(fileName, 'w')
f.write(wordCreated)
f.close()
#print wordCreated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment