Skip to content

Instantly share code, notes, and snippets.

View DorianZheng's full-sized avatar
🎯
Focusing

dorianzheng DorianZheng

🎯
Focusing
View GitHub Profile
@DorianZheng
DorianZheng / fuse_example.py
Created January 30, 2026 06:50
Fuse in Boxlite demo2
#!/usr/bin/env python3
"""Run a custom FUSE filesystem inside a BoxLite VM."""
import asyncio
from pathlib import Path
import boxlite
HERE = Path(__file__).parent
@DorianZheng
DorianZheng / fuse_in_boxlite.py
Created January 30, 2026 05:06
Fuse in BoxLite demo
#!/usr/bin/env python3 # Shebang for direct execution
import asyncio # Async runtime for SimpleBox
import boxlite # BoxLite Python SDK
import textwrap # Embed the guest-side FUSE script as a string
# Minimal FUSE filesystem served inside the box (as a multi-line string)
FUSE_SCRIPT = textwrap.dedent(r"""
#!/usr/bin/env python3 # Guest-side shebang
import os, sys, time, stat # Stdlib imports inside guest
from mfusepy import FUSE, Operations # FUSE bindings inside guest
@DorianZheng
DorianZheng / latency.txt
Created October 23, 2020 03:26 — forked from eshelman/latency.txt
HPC-oriented Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference/hit 1.5 ns 4 cycles
Floating-point add/mult/FMA operation 1.5 ns 4 cycles
L2 cache reference/hit 5 ns 12 ~ 17 cycles
Branch mispredict 6 ns 15 ~ 20 cycles
L3 cache hit (unshared cache line) 16 ns 42 cycles
L3 cache hit (shared line in another core) 25 ns 65 cycles
Mutex lock/unlock 25 ns
L3 cache hit (modified in another core) 29 ns 75 cycles