Last active
September 19, 2020 06:40
-
-
Save pha3l/21ef19b85c750ad8315b4ec58b727d55 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
import boto3 | |
chardict = { | |
"A": [0b01100000, 0b00000000, 0b00011100, 0b00000000, 0b00010011, 0b00000000, 0b00010000, 0b11000000, 0b00010011, | |
0b00000000, 0b00011100, 0b00000000, 0b01100000, 0b00000000], | |
"B": [0b01111111, 0b11000000, 0b01000100, 0b01000000, 0b01000100, 0b01000000, 0b01000100, 0b01000000, 0b00111011, | |
0b10000000], | |
"C": [0b00111111, 0b10000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, | |
0b01000000, 0b00100000, 0b10000000], | |
"D": [0b01111111, 0b11000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, 0b00100000, | |
0b10000000, 0b00011111, 0b00000000], | |
"E": [0b01111111, 0b11000000, 0b01000100, 0b01000000, 0b01000100, 0b01000000, 0b01000100, 0b01000000, 0b01000000, | |
0b01000000], | |
"F": [0b01111111, 0b11000000, 0b00000100, 0b01000000, 0b00000100, 0b01000000, 0b00000100, 0b01000000, 0b00000000, | |
0b01000000], | |
"G": [0b00111111, 0b10000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, 0b01000100, 0b01000000, 0b00100100, | |
0b01000000, 0b01111100, 0b10000000], | |
"H": [0b01111111, 0b11000000, 0b00000100, 0b00000000, 0b00000100, 0b00000000, 0b00000100, 0b00000000, 0b00000100, | |
0b00000000, 0b01111111, 0b11000000], | |
"I": [0b01111111, 0b11000000], | |
"J": [0b00110000, 0b00000000, 0b01000000, 0b00000000, 0b01000000, 0b00000000, 0b00111111, 0b11000000], | |
"K": [0b01111111, 0b11000000, 0b00000110, 0b00000000, 0b00001001, 0b00000000, 0b00010000, 0b10000000, 0b00100000, | |
0b01000000, 0b01000000, 0b00000000], | |
"L": [0b01111111, 0b11000000, 0b01000000, 0b00000000, 0b01000000, 0b00000000, 0b01000000, 0b00000000, 0b01000000, | |
0b00000000], | |
"M": [0b01111111, 0b11000000, 0b00000011, 0b00000000, 0b00001100, 0b00000000, 0b00110000, 0b00000000, 0b00001100, | |
0b00000000, 0b00000011, 0b00000000, 0b01111111, 0b11000000], | |
"N": [0b01111111, 0b11000000, 0b00000001, 0b10000000, 0b00000110, 0b00000000, 0b00001000, 0b00000000, 0b00110000, | |
0b00000000, 0b01111111, 0b11000000], | |
"O": [0b00111111, 0b10000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, | |
0b01000000, 0b00111111, 0b10000000], | |
"P": [0b01111111, 0b11000000, 0b00000100, 0b01000000, 0b00000100, 0b01000000, 0b00000100, 0b01000000, 0b00000100, | |
0b01000000, 0b00000011, 0b10000000], | |
"Q": [0b00111111, 0b10000000, 0b01000000, 0b01000000, 0b01000000, 0b01000000, 0b01010000, 0b01000000, 0b01100000, | |
0b01000000, 0b10111111, 0b10000000], | |
"R": [0b01111111, 0b11000000, 0b00000100, 0b01000000, 0b00000100, 0b01000000, 0b00000100, 0b01000000, 0b00000100, | |
0b01000000, 0b01111011, 0b10000000], | |
"S": [0b00100011, 0b10000000, 0b01000100, 0b01000000, 0b01000100, 0b01000000, 0b01000100, 0b01000000, 0b00111000, | |
0b10000000], | |
"T": [0b00000000, 0b01000000, 0b00000000, 0b01000000, 0b01111111, 0b11000000, 0b00000000, 0b01000000, 0b00000000, | |
0b01000000], | |
"U": [0b00111111, 0b11000000, 0b01000000, 0b00000000, 0b01000000, 0b00000000, 0b01000000, 0b00000000, 0b01000000, | |
0b00000000, 0b00111111, 0b11000000], | |
"V": [0b00000000, 0b11000000, 0b00000111, 0b00000000, 0b00011000, 0b00000000, 0b01100000, 0b00000000, 0b00011000, | |
0b00000000, 0b00000111, 0b00000000, 0b00000000, 0b11000000], | |
"W": [0b00000000, 0b11000000, 0b00000111, 0b00000000, 0b00011000, 0b00000000, 0b01100000, 0b00000000, 0b00011000, | |
0b00000000, 0b00000111, 0b00000000, 0b00011000, 0b00000000, 0b01100000, 0b00000000, 0b00011000, 0b00000000, | |
0b00000111, 0b00000000, 0b00000000, 0b11000000], | |
"X": [0b01100000, 0b11000000, 0b00010001, 0b00000000, 0b00001010, 0b00000000, 0b00000100, 0b00000000, 0b00001010, | |
0b00000000, 0b00010001, 0b00000000, 0b01100000, 0b11000000], | |
"Y": [0b00000000, 0b11000000, 0b00000001, 0b00000000, 0b00000010, 0b00000000, 0b01111100, 0b00000000, 0b00000010, | |
0b00000000, 0b00000001, 0b00000000, 0b00000000, 0b11000000], | |
"Z": [0b01100000, 0b01000000, 0b01010000, 0b01000000, 0b01001000, 0b01000000, 0b01000100, 0b01000000, 0b01000010, | |
0b01000000, 0b01000001, 0b01000000, 0b01000000, 0b11000000], | |
} | |
def make_binary_representation(text, space_frames=4): | |
frames = [] | |
for c in text: | |
if c == ' ': | |
for i in range(0, space_frames): | |
frames.append("{0:08b}".format(0)) | |
else: | |
for frame in list(map(lambda x: "{0:08b}".format(x), chardict.get(c))): | |
frames.append(frame) | |
return frames | |
def main(): | |
print(make_binary_representation("HELLO")) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment