Last active
December 19, 2015 06:59
-
-
Save kyledrake/5915757 to your computer and use it in GitHub Desktop.
Using Ruby to fuck up a file system
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```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