Skip to content

Instantly share code, notes, and snippets.

@b-coimbra
Last active November 17, 2018 16:53
Show Gist options
  • Select an option

  • Save b-coimbra/b9a16a829ff31bcbadbed12a1c7dd448 to your computer and use it in GitHub Desktop.

Select an option

Save b-coimbra/b9a16a829ff31bcbadbed12a1c7dd448 to your computer and use it in GitHub Desktop.
deletes a compiled ruby program while executing itself
#!/usr/bin/env ruby
file = $0.split("/").last
filename = File.basename(file, File.extname(file))
3.times { |i| puts "Deleting itself in #{i+1}..."; sleep 0.5 }
exit if defined? Ocra
system "rm #{filename}.exe"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment