Skip to content

Instantly share code, notes, and snippets.

@sethrh
Created February 19, 2020 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sethrh/cace03bece234e5c359f65d3021e1347 to your computer and use it in GitHub Desktop.
Save sethrh/cace03bece234e5c359f65d3021e1347 to your computer and use it in GitHub Desktop.
a = 55
b = 99
print(a)
print(a & b, hex(a & b), bin(a & b))
print(a | b, hex(a | b), bin(a | b))
print(a ^ b, hex(a ^ b), bin(a ^ b))
a = 'abcdefgh'[:2]
x = 0x7F7F
def curse(chars):
"""Convert the input characters (length 2) to hex
"""
a, b = chars
a = ord(a)
b = ord(b)
# shift a left by two bytes, OR with b
return (a << 8) | (b & 0xFF)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment