Skip to content

Instantly share code, notes, and snippets.

@gtrefs
Created September 2, 2015 11:45
Show Gist options
  • Save gtrefs/a30a6e4c5c1e9514b10c to your computer and use it in GitHub Desktop.
Save gtrefs/a30a6e4c5c1e9514b10c to your computer and use it in GitHub Desktop.
GitHub user name checker
import os
import requests
import sys
def read_list_of_java_annotations(path):
if os.path.isfile(path):
with open(path, "r") as f:
return map(lambda s: s.strip(), f.readlines())
else:
return []
def check_github_accounts(annotations):
session = requests.Session()
bound_annotations = []
for annotation in annotations:
print "Checking %s" % annotation
response = session.get("https://github.com/%s" % annotation)
if response.status_code == 404:
print "%s is not bound" % annotation
else:
print "%s is bound" % annotation
bound_annotations.append(annotation)
return bound_annotations
annotations = []
if len(sys.argv) > 1:
annotations = read_list_of_java_annotations(sys.argv[1])
bound_annotations = check_github_accounts(annotations)
unbound_annotations = [annotation for annotation in annotations if annotation not in bound_annotations]
print "total %s bound %s unbound %s" % (len(annotations), len(bound_annotations), len(unbound_annotations))
print "bound: "
print bound_annotations
print "unbound: "
print unbound_annotations
After
AfterReturning
AfterThrowing
AfterTransaction
Around
Aspect
Autowired
Before
BeforeTransaction
Component
Configurable
ContextConfiguration
Controller
DeclareParents
DirtiesContext
ExpectedException
IfProfileValue
InitBinder
ManagedAttribute
ManagedNotification
ManagedNotifications
ManagedOperation
ManagedOperationParameter
ManagedOperationParameters
ManagedResource
ModelAttribute
NotTransactional
Order
Pointcut
PostConstruct
PreDestroy
ProfileValueSourceConfiguration
Qualifier
Repeat
Repository
RequestMapping
RequestParam
Required
Resource
Rollback
RunWith
Scope
Service
SessionAttributes
TestExecutionListeners
Timed
Transactional
TransactionConfiguration
Deprecated
Documented
FunctionalInterface
Inherited
Override
Repeatable
Retention
SafeVarargs
SuppressWarnings
Target
RestController
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment