Skip to content

Instantly share code, notes, and snippets.

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}:`)
snitches.each do |snitch|
if snitch["name"] =~ regexp
puts "Deleting #{snitch["token"]} #{snitch["name"]}..."
system("curl -X DELETE -u #{api_key}:{snitch["href"]}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment