Skip to content

Instantly share code, notes, and snippets.

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 kragniz/3969878 to your computer and use it in GitHub Desktop.
Save kragniz/3969878 to your computer and use it in GitHub Desktop.
Thing eric shouldn't see
s='1120111011101120711011201110211011303120511011201110211011102150311011201110115021101110311011303120713021101130313011201150311011202150111031301120212021203110112011106110111011102110113011202110111011101120113011201110111011202120111021402110113021202120211051703130112011301140113031606120211031101110211041401110112041203110112011103110212021101130311011202110111021303120312031202130211011201110111021304130211021103110413041201120111041201110711021103110415011402120511011103110311011301130212041101110411011102120114041203140112021201110211011303130111011101150111031'
l='0'+str(int(''.join([int(s[2*i])*s[2*i+1] for i in range(len(s)/2)]),base=2))
print ''.join(map(lambda x:chr(int(x)),[(l)[i:i+3] for i in range(0,len(l),3)]))
@rabbidrabbit
Copy link

Eric will probably see

@eric-wieser
Copy link

Here's the one liner you were after:

letters = ''.join(chr(int(''.join(word))) for word in zip(*(iter('0%d' % int(''.join(int(a) * b for a, b in zip(s[0::2], s[1::2])), base=2)),) * 3))

None of that is intentionally obfuscated,,,

@eric-wieser
Copy link

Or in readable form:

letters = ''.join(
    chr(int(''.join(word)))
    for word in zip(*(iter(
        '0%d' % int(''.join(int(a) * b
        for a, b in zip(x[0::2], x[1::2])), base=2)
    ),) * 3)
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment