Skip to content

Instantly share code, notes, and snippets.

View phi-gamma's full-sized avatar
💤
Does nothing unless polled.

Philipp Gesang phi-gamma

💤
Does nothing unless polled.
View GitHub Profile
@zbroyar
zbroyar / gist:1432555
Created December 5, 2011 06:28
OCaml CURL GET, POST, PUT, DELETE examples
(* ocamlfind ocamlopt -o exmpl -package curl -linkpkg exmpl.ml *)
open Printf
let _ = Curl.global_init Curl.CURLINIT_GLOBALALL
(*
*************************************************************************
** Aux. functions
*************************************************************************
*)
@Jach
Jach / number_hack.py
Created September 10, 2011 11:44
Overrides the Python integer five to be equal to four with ctypes magic
import sys
import ctypes
pyint_p = ctypes.POINTER(ctypes.c_byte*sys.getsizeof(5))
five = ctypes.cast(id(5), pyint_p)
print(2 + 2 == 5) # False
five.contents[five.contents[:].index(5)] = 4
print(2 + 2 == 5) # True (must be sufficiently large values of 2 there...)