Skip to content

Instantly share code, notes, and snippets.

@brianhempel
Created November 10, 2014 15:32
Show Gist options
  • Save brianhempel/fafc0cb888358c1e09c8 to your computer and use it in GitHub Desktop.
Save brianhempel/fafc0cb888358c1e09c8 to your computer and use it in GitHub Desktop.
How to delete all snitches matching a regular expression.
require "json"
api_key = "your api key here"
regexp = /Project X/
snitches = JSON.parse(`curl -u #{api_key}: https://api.deadmanssnitch.com/v1/snitches`)
snitches.each do |snitch|
if snitch["name"] =~ regexp
puts "Deleting #{snitch["token"]} #{snitch["name"]}..."
system("curl -X DELETE -u #{api_key}: https://api.deadmanssnitch.com/#{snitch["href"]}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment