Skip to content

Instantly share code, notes, and snippets.

@macmartine
Created May 20, 2013 18:15
Show Gist options
  • Save macmartine/5614125 to your computer and use it in GitHub Desktop.
Save macmartine/5614125 to your computer and use it in GitHub Desktop.
Deletes all of a users' gists
#!/usr/bin/env ruby
require 'json'
# Remove all gists from a user
# Must be run repeatedly, as one request returns a maximum of 30 results
# Feel free to alter this to keep making requests until there are no more gists,
# but for my purposes this was sufficient
username = "username"
password = "password"
value = `curl --user \"#{username}:#{password}\" https://api.github.com/users/#{username}/gists`
JSON.parse(value).each do |i|
puts i['url']
`curl --user "#{username}:#{password}" -X DELETE #{i['url']}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment