Skip to content

Instantly share code, notes, and snippets.

View urschrei's full-sized avatar

Stephan Hügel urschrei

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@skade
skade / maniac_mansion.rs
Last active December 12, 2017 19:32
Passing data between a reactor and a thread pool, back and forth. Playground link: https://play.rust-lang.org/?gist=25f9b0c87b1d5bd39d9fc6ffe0d1840a
extern crate tokio_core;
extern crate futures_cpupool;
extern crate futures;
use futures::future::lazy;
use std::sync::Arc;
// Make sure data is not copy
#[derive(Debug)]
struct Data {
@kuanb
kuanb / peartree.ipynb
Last active April 2, 2023 20:00
First stab at using Partridge as the basis for generating a NetworkX Graph of a GTFS feed (please note this is just a hacky sketch)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jakevdp
jakevdp / PythonLogo.ipynb
Last active April 7, 2024 18:40
Creating the Python Logo in Matplotlib
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active November 9, 2024 12:16
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Yamakaky
Yamakaky / rust-unmangle
Last active September 1, 2021 02:06
Script to unmangle Rust symbols
#!/usr/bin/sed -rf
# Unmangle Rust symbols
# See https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?id=cae15db74999edb96dd9f5bbd4d55849391dd92b
# Example, with [FlameGraph](https://github.com/brendangregg/FlameGraph):
# perf record -g target/debug/bin
# perf script | stackcollapse-perf | rust-unmangle | flamegraph > perf.svg
# Remove hash and address offset
s/::h[0-9a-f]{16}//g
s/\+0x[0-9a-f]+//g
@vasanthk
vasanthk / System Design.md
Last active November 14, 2024 11:31
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@seanjensengrey
seanjensengrey / rust-python-cffi.md
Last active April 3, 2024 11:55
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