sant0sk1 (owner)

Revisions

gist: 116313 Download_button fork
public
Public Clone URL: git://gist.github.com/116313.git
Embed All Files: show embed
dummy_file_generator.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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