Skip to content

Instantly share code, notes, and snippets.

@brettcannon
Created July 11, 2014 17:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettcannon/82c4fe68bac30f4ed653 to your computer and use it in GitHub Desktop.
Save brettcannon/82c4fe68bac30f4ed653 to your computer and use it in GitHub Desktop.
import io
import sys
def read_file(path, data):
with io.open(path) as file:
for domain in file.readlines():
data.add(domain.strip().lower())
def write_file(data, path='whitelist.txt'):
with io.open(path, 'w') as file:
file.write('\n'.join(sorted(data)))
if __name__ == '__main__':
domains = set()
for path in sys.argv[1:]:
read_file(path, domains)
write_file(domains)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment