Skip to content

Instantly share code, notes, and snippets.

@jerodsanto
Created May 22, 2009 19:24
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 jerodsanto/116313 to your computer and use it in GitHub Desktop.
Save jerodsanto/116313 to your computer and use it in GitHub Desktop.
print 'Enter file size (MB): '
the_size = gets.chomp
fail "bad file size" unless the_size =~ /^\d+$/
file_size = 0
string = "abcdefghijklmnopqrstuvwxyz123456"
File.open(the_size + 'MB', 'w') do |f|
while file_size < the_size.to_i * 1048576 # bytes in 1MB
f.print string
file_size += string.size
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment