Skip to content

Instantly share code, notes, and snippets.

@tomviner
Last active December 16, 2015 07:09
Show Gist options
  • Save tomviner/5396962 to your computer and use it in GitHub Desktop.
Save tomviner/5396962 to your computer and use it in GitHub Desktop.
Birthday decoding
import re
secret = """0b10010000b11000010b11100000b11100000b11110010b1000000b10000100b11010010b11100100b11101000b11010000b11001000b11000010b11110010b1000000b10101100b11010010b11011100b11001010b11100100b100001"""
binaries = re.findall(r'0b[01]+(?=0b|$)', secret)
ords = map(eval, binaries)
letters = map(chr, ords)
print ''.join(letters)
# Happy Birthday Viner!
# One-liner as a joke:
print ''.join(map(chr, map(eval, re.findall(r'0b[01]+(?=0b|$)', """0b10010000b11000010b11100000b11100000b11110010b1000000b10000100b11010010b11100100b11101000b11010000b11001000b11000010b11110010b1000000b10101100b11010010b11011100b11001010b11100100b100001"""))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment