mirror of
https://github.com/romanz/amodem.git
synced 2026-02-07 18:08:03 +08:00
18 lines
408 B
Python
Executable File
18 lines
408 B
Python
Executable File
#!/usr/bin/env python
|
|
import sys
|
|
import binascii
|
|
|
|
lines = sys.stdin.read().strip().split('\n')
|
|
for line in lines:
|
|
head, tail = line.split(' ', 1)
|
|
bars = ''
|
|
try:
|
|
data = binascii.unhexlify(head)
|
|
data = map(ord, data)
|
|
bars = ['\033[48;5;%dm%02x\033[m' % (x, x) for x in data]
|
|
head = ''.join(bars)
|
|
except TypeError:
|
|
pass
|
|
|
|
print('%s %s' % (head, tail))
|