Skip to content

Instantly share code, notes, and snippets.

@arianvp
arianvp / SSH_MACOS_SECURE_ENCLAVES.md
Last active May 6, 2026 10:52
Native Secure Enclaved backed ssh keys on MacOS

Native Secure Enclave backed ssh keys on MacOS

It turns out that MacOS Tahoe can generate and use secure-enclave backed SSH keys! This replaces projects like https://github.com/maxgoedjen/secretive

There is a shared library /usr/lib/ssh-keychain.dylib that traditionally has been used to add smartcard support to ssh by implementing PKCS11Provider interface. However since recently it also implements SecurityKeyProivder which supports loading keys directly from the secure enclave! SecurityKeyProvider is what is normally used to talk to FIDO2 devices (e.g. libfido2 can be used to talk to your Yubikey). However you can now use it to talk to your Secure Enclave instead!

// https://github.com/facebook/folly/blob/1c8bc50e88804e2a7361a57cd9b551dd10f6c5fd/folly/memcpy.S
export fn memcpy(maybe_dest: ?[*]u8, maybe_src: ?[*]const u8, len: usize) callconv(.C) ?[*]u8 {
if (len == 0) {
@branchHint(.unlikely);
return maybe_dest;
}
const dest = maybe_dest.?;
const src = maybe_src.?;
@karlseguin
karlseguin / test_runner.zig
Last active April 20, 2026 13:50
Custom Zig Test Runner, better ouput, timing display, and support for special "tests:beforeAll" and "tests:afterAll" tests
// This is for the Zig 0.16.
// See https://gist.github.com/karlseguin/c6bea5b35e4e8d26af6f81c22cb5d76b/eb15512d6ae49663fa9df6c7a9725b20dab43edd
// for a version that workson Zig 0.15.2.
// See https://gist.github.com/karlseguin/c6bea5b35e4e8d26af6f81c22cb5d76b/1f317ebc9cd09bc50fd5591d09c34255e15d1d85
// for a version that workson Zig 0.14.1.
// in your build.zig, you can specify a custom test runner:
// const tests = b.addTest(.{
@marler8997
marler8997 / ZigScript.md
Last active September 2, 2024 18:58
ZigScript

Since people seem to enjoy making scripting languages so much (not meant to be a "dig", I like this)...here's a scripting language I'd be very interested in.

ZigScript

"A companion scripting language meant for Zig developers."

Zig is my language of choice, but I still reach for Python when I want to make something fast or "short lived". However, Python has downsides, it's hard to build the interpreter for it (especially a static executable), its packaging system is a mess and it's got some interesting syntax choices that would feel foreign to a native Zig developer, but overall I think the core of the language is brilliant. I imagine ZigScript as Python but in a "Zig Style" syntax with the problems fixed. Here are some features that come to mind:

@kassane
kassane / std_log.md
Last active February 9, 2026 23:10 — forked from leecannon/std_log.md
Quick overview of Zig's `std.log`

A simple overview of Zig's std.log for Zig v0.12.0 or higher

Logging functionality that supports:

  • If a log message should be printed is determined at comptime, meaning zero overhead for unprinted messages (so just leave the code peppered with debug logs, but when it makes sense scope them; so downstream users can filter them out)
  • Scoped log messages
  • Different log levels per scope
  • Overrideable log output (write to file, database, etc.)
  • All the standard std.fmt formatting magic

Basic Usage:

@floooh
floooh / zig_test_debugging_vscode.md
Last active December 20, 2025 18:50
How to debug Zig tests in VSCode

Tested on macOS:

  1. Install the CodeLLDB VSCode extension. Unlike the debugger in the C/C++ extension, this allows to set breakpoints inside Zig "test" blocks (in the MS C/C++ extension debugger, breakpoints inside test blocks will be disabled once the debugger starts for unknown reasons.
  2. When compiling the test, tell it to also emit a binary: zig test -femit-bin=zig-out/bin/my-test src/bla.zig, otherwise there will be no executable to debug.
  3. The compiled test executable expects the path to the Zig executable as first command line argument, the launch.json file needs to be setup accordingly (note the args item):
@christianparpart
christianparpart / terminal-synchronized-output.md
Last active March 19, 2026 21:10
Terminal Spec: Synchronized Output

This page has moved!

Please see here: contour-terminal/vt-extensions

Synchronized Output

Synchronized output is merely implementing the feature as inspired by iTerm2 synchronized output, except that it's not using the rare DCS but rather the well known SM ? and RM ?. iTerm2 has now also adopted to use the new syntax instead of using DCS.

Semantics

@ctsrc
ctsrc / README.md
Last active April 19, 2026 01:41 — forked from niw/README.en.md
Guide: Run FreeBSD 13.1-RELEASE for ARM64 in QEMU on Apple Silicon Mac (MacBook Pro M1, etc) with HVF acceleration (Hypervisor.framework)
@eenblam
eenblam / linux_reading_list.md
Last active April 10, 2026 11:28
Linux Networking Reading List

Linux Networking Reading List

Currently in no particular order. Most of these are kind of ancient.

Where's all the modern documentation? So much of what I've turned up searching is other folks complaining about having few options beyond reading source code.

The OREILLY books, while dated, seem to be some of the best available. Note that these can be read with a 7-day trial. Do this! At least get through the introduction section and first chapter of each to see if it's what you're after.

https://www.netfilter.org/

@adrusi
adrusi / generator.zig
Last active March 10, 2024 15:09
Generators in Zig 0.6.0
const std = @import("std");
const debug = std.debug;
const builtin = @import("builtin");
const TypeInfo = builtin.TypeInfo;
const TypeId = builtin.TypeId;
/// Iterator based on async functions. Equivalent to generators in Python,
/// Javascript, etc.
///