Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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