Skip to content

Instantly share code, notes, and snippets.

@nm004
Last active September 23, 2023 17:43
Show Gist options
  • Save nm004/a3eb150f24254ce850bb27cf76fdc9f2 to your computer and use it in GitHub Desktop.
Save nm004/a3eb150f24254ce850bb27cf76fdc9f2 to your computer and use it in GitHub Desktop.
#
# strtohex - Read hex values in string representaion from command line and write them
# in byte representation out to stdout
#
# This software is in the public domain
#
import os, sys
os.write(1, b''.join( bytes.fromhex(s) for s in sys.argv[1:] ))
# or only on unix
# os.writev(1, [ bytes.fromhex(s) for s in sys.argv[1:] ])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment