sant0sk1 (owner)

Revisions

gist: 100568 Download_button fork
public
Public Clone URL: git://gist.github.com/100568.git
Embed All Files: show embed
dummy_file_generator.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env ruby
 
print 'Enter file size (MB): '
the_size = gets.chomp
 
unless the_size =~ /^\d+$/
  puts "Error: bad file size"
  exit
end
 
puts the_size + 'MB file coming right up!'
 
# Generate the file
file_size = 0
string = "abcdefghijklmnopqrstuvwxyz123456"
 
f = File.new(the_size + 'MB', 'w')
 
while file_size < the_size.to_i * 1048576 # bytes in 1MB
  f.print string
  file_size += string.size
end
 
f.close