Created
December 3, 2018 18:21
-
-
Save tonigi/020b98ad99f01854ac22caf235d9d338 to your computer and use it in GitHub Desktop.
Replacement for xxd
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
#!/usr/bin/env python3 | |
# Replaces xxd -i for systems without it (e.g. conda). Only stdin. | |
import sys | |
import textwrap | |
data=sys.stdin.buffer.read() | |
#xdata=", ".join([hex(x) for x in data]) | |
xdata=", ".join([f'0x{y:02x}' for y in data]) | |
print(textwrap.fill(xdata,75)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment