-
-
Save Lacoste/2f0d24ecfe5867607625a388b6a30ec0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
import sys | |
import idna | |
def main(): | |
for line in sys.stdin: | |
line = line.rstrip() | |
if not line: | |
continue | |
if line.startswith(('!', '//')): | |
continue | |
if line.startswith('*.'): | |
line = line[len('*.'):] | |
print idna.encode(line.decode('utf-8')) | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
import sys | |
def _key(line): | |
split = line.split('.') | |
split.reverse() | |
return split | |
def main(): | |
sys.stdout.writelines(sorted(set(sys.stdin), key=_key)) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment