Skip to content

Instantly share code, notes, and snippets.

@dpk
Created October 16, 2016 13:55
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 dpk/671709a23ca60de6b4fe1ec4e21f38b6 to your computer and use it in GitHub Desktop.
Save dpk/671709a23ca60de6b4fe1ec4e21f38b6 to your computer and use it in GitHub Desktop.
from itertools import islice
def possibilities(hostname):
hostname = hostname.lower().strip('.')
yield hostname
labels = hostname.split('.')
for suffix_i in range(1, len(labels)):
yield '*.' + '.'.join(labels[suffix_i:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment