Skip to content

Instantly share code, notes, and snippets.

@0xKD
Created February 4, 2015 13:58
Show Gist options
  • Save 0xKD/86e51f4bb43277f73eba to your computer and use it in GitHub Desktop.
Save 0xKD/86e51f4bb43277f73eba to your computer and use it in GitHub Desktop.
from __future__ import print_function
p, q = 0x6f095e5b39, 0x7377497f7b
def g(num):
return ((p if num < 5 else q) % (16 ** (10 - (num % 5) * 2 or 2))) // \
(16 ** ((10 - (num % 5) * 2 or 2) - 2))
def r(number):
b, m = [2 ** x for x in range(6, -1, -1)], [g(int(x)) for x in number]
r = ''.join(' _ ' if y else ' ' for y in (b[0] & x for x in m))
print(r, '\n' + '\n'.join(''.join([''.join(
(z[1] if z[0] else ' ' for z in x)) for x in
(zip([b[3 * i + j] & x for j in range(1, 4)], '|_|') for x in m)
]) for i in range(2)) + '\n')
r("0123456789")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment