Skip to content

Instantly share code, notes, and snippets.

@futoase
Created February 13, 2018 16:10
Show Gist options
  • Save futoase/bf912c65fbe2a90ae459f5819bbc563c to your computer and use it in GitHub Desktop.
Save futoase/bf912c65fbe2a90ae459f5819bbc563c to your computer and use it in GitHub Desktop.
digital ocean destroy
require 'openssl'
require 'droplet_kit'
CLIENT_COUNT = 20
digest = OpenSSL::Digest.new("sha256")
# get digital ocean token from
# https://www.digitalocean.com/community/tutorials/how-to-use-the-digitalocean-api-v2
# export DIGITAL_OCEAN_TOKEN=XXXXXXXXXXXXXX
client = DropletKit::Client.new(access_token: ENV['DIGITAL_OCEAN_TOKEN'])
my_ssh_keys = client.ssh_keys.all.collect { |key| key.fingerprint }
client.droplets.all().each do |droplet|
p droplet.id
client.droplets.delete(id: droplet.id)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment