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
def convert_to_couples(row): | |
return [n // 2 for n in row] | |
def trim_couples(couples): | |
return [ | |
couples[i] for i in xrange(len(couples)) | |
if couples[i//2*2] != couples[i//2*2+1] | |
] | |
def reindex_by_appearance(sequence): |
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
MIT License | |
Copyright (c) 2020 rajat mehndiratta | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
# To get this to work: install names (`pip3 install --user -U names`) | |
import names | |
import random | |
# copied from https://pe.usps.com/text/pub28/28apc_002.htm | |
# hardcoded because requests + BeautifulSoup got too ugly and it's faster to | |
# just extract and prettify the words from the page manually | |
STREET_SUFFIXES = { | |
'Alley', 'Annex', 'Arcade', 'Avenue', 'Bayou', 'Beach', 'Bend', 'Bluff', | |
'Bluffs', 'Bottom', 'Boulevard', 'Branch', 'Bridge', 'Brook', 'Brooks', |
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
import argparse | |
import cProfile | |
import itertools | |
import random | |
import string | |
ALL_FUNCTION_NAMES=[ | |
'using_choice', 'using_sample', 'using_randint', 'using_randint_with_offset', 'using_randbits', | |
'using_randbits_ascii_lowercase', 'using_one_long_randbits' | |
] |