Skip to content

Instantly share code, notes, and snippets.


Eric Wolf typetetris

  • Germany
View GitHub Profile
typetetris /
Created Jul 17, 2022 — forked from moyix/
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
typetetris /
Created Apr 6, 2022 — forked from shamil/
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
typetetris / flake.nix
Created Mar 16, 2022
nix mold example, just run `nix develop`
View flake.nix
inputs = {
flake-utils.url = "github:numtide/flake-utils";
rust-evdev = {
url = "github:ndesh26/evdev-rs";
flake = false;
outputs = { self, nixpkgs, flake-utils, rust-evdev }:
flake-utils.lib.eachDefaultSystem (system:
typetetris / fork() is evil; vfork() is goodness; afork() would be better; clone() is stupid

I recently happened upon an implementation of popen() (different API, same idea) using clone(2), and so I opened an issue requesting use of vfork(2) or posix_spawn() for portability. It turns out that on Linux there's an important advantage to using clone(2). I think I should capture the things I wrote there in a better place. A gist, a blog, whatever.

So here goes.

Long ago, I, like many Unix fans, thought that fork(2) and the fork-exec process spawning model were the greatest thing, and the Windows sucked for only having [exec*()](

pub trait Filter {
type Input: Copy;
type Output;
fn process(&mut self, sample: Self::Input) -> Self::Output;
#[derive(Copy, Clone)]
pub struct Nil<X>(pub X);
#[derive(Copy, Clone)]
View flake.nix
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-21.05";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
pkgs = import nixpkgs {
inherit system;
config = {
typetetris / latency.txt
Created Jul 6, 2021 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
View gist:37a14f68be5d05ceb7981c7b74f277e7
Updating dependencies
Resolving dependencies...
1: fact: nixops-with-plugins is 0.1.0
1: derived: nixops-with-plugins
1: fact: nixops-with-plugins depends on nixops (2.0.0 git rev master)
1: fact: nixops-with-plugins depends on nixops-aws (1.0 git branch master)
1: fact: nixops-with-plugins depends on nixopsvbox (1.7 git branch master)
1: fact: nixops-with-plugins depends on nixops-virtd (1.0 git branch master)
1: fact: nixops-with-plugins depends on nixops-digitalocean (2.0 git branch master)
1: fact: nixops-with-plugins depends on nixops-gcp (1.0 git branch master)
View ssh-keys
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPrSldp7lyqflHxk52ep3YuV9c9i0RhoTHyStlWwrVQT"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB0DLlw7rKNdJr0G9EeCSS2+wWjrCub2eaD7mpNJ8NHt typetetris@typetetris-Precision-7530"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDJZQ9Y0l4Yq6gyreFDcdh6zsFo8eMK3FKPifojbP45iiGlQlCEAZXcxy3di5hllABtd5k4Q7R1b1gmvC1nBYaIETm9Goyx3hGLv6KP8X21zIwQAOydA5eYchv8G4LfLAKuNQ8yxCHZl NbDn3BJCMRh6ohjANLsig7VXjH+ikouVsySPh+2xROf/2mfMIacsfGYUceCsUaYeiV4O6N5iHPLlK/wL/BZfTOigQfioI97gvIEIiGGg+4tIVJxwPD2VFQF8PQfuZjPFs+GUilEUSP9IO16adxKLqlHwOHpn9hnGPJjeLcOude5Cids8zoE+f0JuU8NQ szvuNepVGtBBHw260Bvav2KjahXtzFg2Oe9rrV5v67WBv7gfWFWr4v/B8a/peX0hgJvwgjZ7RJK9R7cIqkIJvqmlNGOt8S4zBGMxUq9dAsoA/QZSvLAlyVUqaMoouqXwd7tr4mgkfU3zUky0nFLEFJUbGh3BXGxq33WEhtZ6evgWv/80dr9tTaNYx6rO IEQ7abtU2oehHeRw7NNCH6AAvNwUe04okAgxr2tvzti8HCN9L9T1A2k4hxNfqSWVu5IZS2F5Wi9GH3rDPpM2gHqLtc07e2lWg93BJ+kSefipSFr2i0IbA+t/iET95v1FwLZ3gxvxwP0kk4lsP5pPBKiM0fo2SmnaxFw11FnXQ== openpgp:0x39D365 64"