Created
November 10, 2014 15:32
-
-
Save brianhempel/fafc0cb888358c1e09c8 to your computer and use it in GitHub Desktop.
How to delete all snitches matching a regular expression.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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