Skip to content

Instantly share code, notes, and snippets.

@nathanfarlow
Created April 6, 2022 23:37
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 nathanfarlow/d492e331c41d22a49878deeec66b1dec to your computer and use it in GitHub Desktop.
Save nathanfarlow/d492e331c41d22a49878deeec66b1dec to your computer and use it in GitHub Desktop.
# python3 swaperator.py
# Make sure to use CPython!
import ctypes as c
r = lambda x: c.c_size_t.from_address(x).value
n = r((t := r(id(int) + 96)) + 16)
c.c_size_t.from_address(t).value = n
a = 5
b = 10
print(a + b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment