Skip to content

Instantly share code, notes, and snippets.

@tophyr
Last active April 27, 2016 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tophyr/6c82eb68c7c59e6e8ab6e9ff27e191dc to your computer and use it in GitHub Desktop.
Save tophyr/6c82eb68c7c59e6e8ab6e9ff27e191dc to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require "json"
user = <INSERT USERNAME>
pass = <INSERT PASSWORD>
page = 1
begin
resp = `curl -u #{user}:#{pass} -s "https://api.github.com/users/cyanogenmod/repos?per_page=100&page=#{page}"`
repos = JSON.load(resp)
page += 1
repos.each { |repo|
begin
resp = `curl -u #{user}:#{pass} -s "https://api.github.com/repos/cyanogenmod/#{repo["name"]}/forks" --data-binary '{"organization":"apocryphone"}'`
puts JSON.load(resp)["full_name"]
rescue
puts "failed to fork #{repo["name"]}"
end
}
end until repos.length == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment