Skip to content

Instantly share code, notes, and snippets.

@grissiom
Created May 1, 2012 06:53
Show Gist options
  • Save grissiom/2565746 to your computer and use it in GitHub Desktop.
Save grissiom/2565746 to your computer and use it in GitHub Desktop.
python darkart
# get the source file path in a robust way
# from http://stackoverflow.com/a/6098238/297347
# with a little cleanup
import inspect
script_patch = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
# convert a binary stream into hex format
# Note: hex will take integer as argument
print ''.join(['%02x' % i for in in stream])
# thus, convert 0x1234 to 1234 can be
print int(''.join(['%02x' % i for i in hex_num]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment