Skip to content

Instantly share code, notes, and snippets.

@TheSkorm
Created January 12, 2018 03:20
Show Gist options
  • Save TheSkorm/ec1abe2e4bb1101ea99dade5e30344e3 to your computer and use it in GitHub Desktop.
Save TheSkorm/ec1abe2e4bb1101ea99dade5e30344e3 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding: utf-8 -*-
CODE = { "10" : u"▌", "01": u"▐", "11": u"█", "00": u" "}
CHARS = {'0':'1010001110111010',
'1':'1110100010101110',
'2':'1011100010101110',
'3':'1110111000101010',
'4':'1010001110101110',
'5':'1110100011101010',
'6':'1011100011101010',
'7':'1010001011101110',
'8':'1110100010111010',
'9':'1011100010111010',
'A':'1110101000101110',
'B':'1011101000101110',
'C':'1110111010001010',
'D':'1010111000101110',
'E':'1110101110001010',
'F':'1011101110001010',
'G':'1010100011101110',
'H':'1110101000111010',
'I':'1011101000111010',
'J':'1010111000111010',
'K':'1110101010001110',
'L':'1011101010001110',
'M':'1110111010100010',
'N':'1010111010001110',
'O':'1110101110100010',
'P':'1011101110100010',
'Q':'1010101110001110',
'R':'1110101011100010',
'S':'1011101011100010',
'T':'1010111011100010',
'U':'1110001010101110',
'V':'1000111010101110',
'W':'1110001110101010',
'X':'1000101110101110',
'Y':'1110001011101010',
'Z':'1000111011101010',
'-':'1000101011101110',
'.':'1110001010111010',
' ':'1000111010111010',
'$':'1000100010001010',
'/':'1000100010100010',
'+':'1000101000100010',
'%':'1010001000100010',
'*':'1000101110111010'
}
text = "MWHEELER"
output = "0000" + CHARS["*"]
for letter in text:
output += CHARS[letter]
output += CHARS["*"]
print(output)
barcode = u""
for x in range(0,len(output),2):
barcode += CODE[output[x:x+2]]
print ""
print ""
print barcode
print barcode
print barcode
print barcode
print barcode
print ""
print ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment