Skip to content

Instantly share code, notes, and snippets.

@lbe
lbe / pool_bench_test.go
Created November 28, 2025 05:06
Go benchmark that compares several pooling strategies
// Pool Benchmarks (Standalone Gist)
//
// This single-file Go benchmark compares several pooling strategies:
// - Interface sync.Pool with pointer indirection (e.g., *[]byte, *bytes.Buffer)
// - Generic value slice pool (SlicePool[T])
// - Generic pointer pool (PtrPool[T])
// - Minimal ResettablePool (calls Reset() on Put)
//
// Usage:
//
@sean-
sean- / claude_code_recovery.py
Created September 26, 2025 19:47
Emergency recovery tool for Claude Code session files
#!/usr/bin/env python3
"""claude_code_recovery.py - Emergency recovery tool for Claude Code session files
Copyright (c) 2025 Sean Chittenden
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
sdb-sde are 64G zvols on a striped zpool of 8 mirrors
fio was created by:
lvcreate -L 240G -i4 -I64 -n fio TestVolGroup
guest command:
doas cpuset -c -l 16-31 -n ft:1 -- grub-bhyve -S -m /chyves/storage/guests/ubi0/device.map -r hd0,msdos1 -c /dev/nmdm52A -M 32G chy-ubi0; doas cpuset -c -l 16-31 -n ft:1 -- bhyve -A -H -P -S -c 16 -U ec30b988-f5aa-11e7-a76c-ac1f6b0a8cd2 -m 32G -s 0,hostbridge -s
4,ahci-hd,/dev/zvol/storage/chyves/guests/ubi0/disk0 -s 5,virtio-net,tap52 -s 6,kvirtio-net,mtu=1500,queues=4,intf=cc0,mac=00:07:43:3d:92:d1 -s 7,ahci-hd,/dev/zvol/storage/chyves/guests/ubi0/disk1 -s 8,ahci-hd,/dev/zvol/storage/chyves/guests/ubi0/disk2 -s 9,ahci-hd,/dev/zvol/storage/chyves/guests/ubi0/disk3 -s 10,ahci-hd,/dev/zvol/storage/chyves/guests/ubi0/disk4 -l com1,/dev/nmdm52A -s 31,lpc chy-ubi0
ARC MAX 8G (in use 8G)
package locktest
import (
"sync"
"testing"
)
var l sync.Mutex
func dLock() {
@ericclemmons
ericclemmons / example.md
Last active October 13, 2025 15:16
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
@zg
zg / freebsd-qemu-xhyve-mac-os-x-virtual-machine.md
Last active August 12, 2025 06:56
Create FreeBSD virtual machine using qemu. Run the VM using xhyve.

TL;DR

  • Create 10GB FreeBSD image using QEMU.
  • Run the VM using xhyve.
  • Mount host directory.
  • Resize the image.

Requisites

@tsuna
tsuna / README.md
Created March 27, 2016 04:17
SSL/TLS certificate rotation with gRPC (hack/demo/POC)

gRPC SSL/TLS cert rotation

Generate a couple key pairs:

openssl req -x509 -newkey rsa:2048 -keyout key1.pem -out cert1.pem -days 42 -nodes
openssl req -x509 -newkey rsa:2048 -keyout key2.pem -out cert2.pem -days 42 -nodes
ln -s key1.pem key.pem
ln -s cert1.pem cert.pem
@justincampbell
justincampbell / upvote_gifs.md
Last active March 17, 2016 18:47
Upvote gifs

@bixu
bixu / circonus_httptrap_push.sh
Created January 28, 2016 17:07
Send a key:value pair to a Circonus HTTPTrap endpoint
#!/bin/bash
# Note that the -k flag here means we are ignoring cert warnings.
# If security matters you should use the Circonus cert provided
# here: http://login.circonus.com/pki/ca.crt
KEY=$1
VALUE=$2
ENDPOINT_URL=$3