Skip to content

Instantly share code, notes, and snippets.

@alurm
alurm / README.md
Last active June 17, 2026 04:37
A generic dynamic array in C that stores no capacity and needs no struct

A generic dynamic array in C that stores no capacity and needs no struct

The following header shows a way to make a generic dynamic array in C with an array of two pointers:

  • one pointer (accessible as vec_ptr[vec]) points to the data;
  • the other pointer (accessible as vec_len[vec]) encodes the length of the array in the pointer. Thus, (size_t)vec_len[vec] returns the len as size_t.

So, int *vec[2] = { 0 }; is an empty dynamic array of ints. struct person *people[2] = { 0 }; is an empty dynamic array of people.

The vec_push(vec, value) macro pushes a value at the end of a dynamic array. It returns true if pushing succeeded, and false otherwise. Note that the dynamic array is not automatically freed on failure.

@tklauser
tklauser / netconv.go
Created June 24, 2022 21:12
net/netip <-> net conversion helpers
// Package netconv provides utilities to convert between types in packages net
// and netip.
package netconv
import (
"net"
"net/netip"
)
// PrefixToIPNet returns p as a *net.IPNet.
@zingaburga
zingaburga / sve2.md
Last active May 11, 2026 05:41
ARM’s Scalable Vector Extensions: A Critical Look at SVE2 For Integer Workloads

ARM’s Scalable Vector Extensions: A Critical Look at SVE2 For Integer Workloads

Scalable Vector Extensions (SVE) is ARM’s latest SIMD extension to their instruction set, which was announced back in 2016. A follow-up SVE2 extension was announced in 2019, designed to incorporate all functionality from ARM’s current primary SIMD extension, NEON (aka ASIMD).

Despite being announced 5 years ago, there is currently no generally available CPU which supports any form of SVE (which excludes the [Fugaku supercomputer](https://www.fujitsu.com/global/about/innovation/

@jj1bdx
jj1bdx / quic-restrictions.md
Last active February 16, 2024 09:34
Do not enable QUIC on 1280-byte MTU IPv6 networks

Do not enable QUIC on 1280-byte MTU IPv6 networks

Synopsis

  • QUIC requires transmission of at least 1350 bytes of UDP packets on IPv6 (and 1370 bytes on IPv4).
  • On Chrome/Chromium (and Vivaldi), if sending 1350-byte UDP packet fails on IPv6, fallback to HTTP/2 over TCP immediately occurs.

Implementation details on Chrome/Chromium (60.0.3112.55 on Vivaldi)

See the explanation in Japanese for the further details on the current implementation. Note well that this differs from the latest version of QUIC Internet-Draft: see draft-ietf-quic-transport-01 Section 8. Quote:

@acolyer
acolyer / service-checklist.md
Last active May 26, 2026 20:51
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?