Skip to content

Instantly share code, notes, and snippets.

@squarooticus
squarooticus / nftables_mdns.conf
Last active January 31, 2024 06:44
Use nftables to repeat mDNS/Bonjour packets across two different interfaces. Works for Google Cast/Chromecast groups!
table ip mangle {
chain prerouting {
type filter hook prerouting priority mangle; policy accept;
ip daddr 224.0.0.251 iif eth3 ip saddr set 192.168.2.1 dup to 224.0.0.251 device eth2 notrack
ip daddr 224.0.0.251 iif eth2 ip saddr set 192.168.3.1 dup to 224.0.0.251 device eth3 notrack
}
}
table ip6 mangle {
chain prerouting {
@GaelVaroquaux
GaelVaroquaux / 00README.rst
Last active December 13, 2024 15:53
Copy-less bindings of C-generated arrays with Cython

Cython example of exposing C-computed arrays in Python without data copies

The goal of this example is to show how an existing C codebase for numerical computing (here c_code.c) can be wrapped in Cython to be exposed in Python.

The meat of the example is that the data is allocated in C, but exposed in Python without a copy using the PyArray_SimpleNewFromData numpy