Skip to content

Instantly share code, notes, and snippets.

@kyledrake
Last active December 19, 2015 06:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyledrake/5915757 to your computer and use it in GitHub Desktop.
Save kyledrake/5915757 to your computer and use it in GitHub Desktop.
Using Ruby to fuck up a file system
```ruby
require 'fileutils'
require 'securerandom'
2_000_000.times do |site|
site_name = SecureRandom.hex[0...20]
puts site_name
Dir.mkdir File.join('./', 'sites', site_name)
File.open(File.join('./', 'sites', site_name, 'index.html'), 'w') {|fp| fp.write('hi')}
end
```
root@doomsday:~# ruby test.rb >derp.out
test.rb:10:in `initialize': No space left on device - ./sites/10ca69a982ebefa55e4b/index.html (Errno::ENOSPC)
from test.rb:10:in `open'
from test.rb:10:in `block in <main>'
from test.rb:4:in `times'
from test.rb:4:in `<main>'
root@doomsday:~# ls -1 sites | wc -l
640291
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment