Skip to content

Instantly share code, notes, and snippets.

@amingilani
Created December 16, 2016 08:49
Show Gist options
  • Save amingilani/d9fba5492c9110fb50b92f1bacd1776b to your computer and use it in GitHub Desktop.
Save amingilani/d9fba5492c9110fb50b92f1bacd1776b to your computer and use it in GitHub Desktop.
gist to kill all your digital ocean droplets fast
require 'droplet_kit'
token = '' # paste your token here
client = DropletKit::Client.new(access_token: token)
# if your droplets are named john-1, john-2, john-3
# @param spelledlike [String] type 'john'
# @return [Array<String>] ids of the killed droplets
def killem(spelledlike)
client.droplets.all.select {|e| e.name.include? spelledlike}
.map(&:id).each {|e| client.droplets.delete(id: e)}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment