Skip to content

Instantly share code, notes, and snippets.

View dirvine's full-sized avatar

David Irvine dirvine

View GitHub Profile
@dirvine
dirvine / urls.txt
Created September 11, 2020 10:32 — forked from jgamblin/urls.txt
Top 1000 Domains
google.com
youtube.com
facebook.com
baidu.com
yahoo.com
amazon.com
wikipedia.org
google.co.in
twitter.com
qq.com
@dirvine
dirvine / rust-python-cffi.md
Created September 1, 2016 23:25 — forked from seanjensengrey/rust-python-cffi.md
Calling Rust from Python/PyPy using CFFI (C Foreign Function Interface)

This is a small demo of how to create a library in Rust and call it from Python (both CPython and PyPy) using the CFFI instead of ctypes.

Based on http://harkablog.com/calling-rust-from-c-and-python.html (dead) which used ctypes

CFFI is nice because:

  • Reads C declarations (parses headers)
  • Works in both CPython and PyPy (included with PyPy)
  • Lower call overhead than ctypes