Skip to content

Instantly share code, notes, and snippets.

@buo
Created November 6, 2015 07:43
Show Gist options
  • Save buo/954b4b096650a595c853 to your computer and use it in GitHub Desktop.
Save buo/954b4b096650a595c853 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# encoding: utf-8
require 'net/http'
def available?(username)
uri = URI('https://github.com/signup_check/username')
res = Net::HTTP.post_form(uri, :value => username)
puts res.body
return false if res.body == 'Username is already taken'
return false if res.body == 'Username is a reserved word'
return false if res.body == 'Username is a reserved word and is already taken'
return true
end
def three
chars = 'abcdefghijklmnopqrstuvwxyz'.split('')
for i in 0..25
for j in 0..25
for k in 0..25
username = "#{chars[i]}#{chars[j]}#{chars[k]}"
puts username if available?(username)
end
end
end
end
three()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment