Skip to content

Instantly share code, notes, and snippets.

@clausecker
clausecker / README.md
Last active July 17, 2025 09:43
prepare()-ing for execution

UNIX famously uses fork+exec to create processes, a simple API that is nevertheless quite tricky to use correctly and that comes with a bunch of problems. The alternative, spawn, as used by VMS, Windows NT and recently POSIX, fixes many of these issues but it overly complex and makes it hard to add new features.

prepare() is a proposed API to simplify process creation. When calling prepare(), the current thread enters “preparation state.” That means, a nascent process is created and the current thread is moved to the context of this process, but without changing memory maps (this is similar to how vfork() works). Inside the nascent process, you can configure the environment as desired and then call prep_execve() to execute a new program. On success, prep_execve() leaves preparation state, moving the current thread back to the parent's process context and returns (!) the pid of the now grownup child. You can also use prep_exit() to abort the child without executing a new process, it similarly returns the pid

import { ReadonlySignal, computed, effect, signal } from "@preact/signals-core";
export class AsyncState<T> {
constructor() {}
get value(): T | null {
return null;
}
get requireValue(): T {
object YAML:
apiVersion:
apps/v1
kind:
Deployment
metadata:
name:
"my-app"
namespace:
"my-app"
@rochacbruno
rochacbruno / helix_config.toml
Created September 20, 2023 10:49
Helix file picker
### requires the script lf-pick on path
### Requires lf installed https://github.com/gokcehan/lf
### lf has the keybindings: <space> select file, lowercase `l` accept selection
### or use arrow right to open the file
### This allows selecting multiple files with space and then hit `l` to open
# touch ~/.local/bin/lf-pick
# chmod +x ~/.local/bin/lf-pick
# function lfp(){
# local TEMP=$(mktemp)
# lf -selection-path=$TEMP
@PatrickLang
PatrickLang / README.md
Last active June 11, 2025 21:26
Cleaning up Alsa + Pipewire for Focusrite Scarlett series

These are just some notes on how I'm trying to clean up Linux support a bit to make the Focusrite Scarlett 18i8 (gen2) and 2i4 a bit easier to use.

Getting UCM profiles

Currently having issues getting a clean test run on upstream project. See failing history

@kcxt
kcxt / qcom_sound_notes.md
Last active July 17, 2025 01:42
Qualcomm sound architecture notes

Qcom (sdm845) audio

db410c notes

From 96boards docsdragonboard/dragonboard410c/guides/enable-ls-i2s.md.html

  • Primary MI2S - Supports only playback
  • Secondary MI2S - Supports only playback
  • Tertiary MI2S - Supports only capture
@ilyakurdyukov
ilyakurdyukov / faster_lzma_decoder_x86.patch
Last active June 18, 2023 17:04
Faster LZMA decoder for x86 CPUs (patch for XZ Utils).
From 387fd25f57f41009fc317f7922e957de9f370ff2 Mon Sep 17 00:00:00 2001
From: Ilya Kurdyukov <[email protected]>
Date: Tue, 14 Dec 2021 21:54:32 +0700
Subject: [PATCH] faster lzma_decoder for x86
Notice: Uses inline assembly with CMOV instruction.
Another change that removes the comparison with in_size can give a few
percent speedup for architectures with a small number of registers.
---
@christianparpart
christianparpart / terminal-synchronized-output.md
Last active July 3, 2025 13:46
Terminal Spec: Synchronized Output

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

When rendering the screen of the terminal, the Emulator usually iterates through each visible grid cell and renders its current state. With applications updating the screen a at higher frequency this can cause tearing.

This mode attempts to mitigate that.

@yjlcoder
yjlcoder / bbb_download.py
Created April 4, 2021 19:39
Download Big Buck Bunny Lossless 1080P Video
#! /usr/bin/env python3
"""
This script is to download Big Buck Bunny lossless 1080P version
The video is 1920x1080 24 FPS as a sequence of PNG files.
Video Source: https://media.xiph.org/BBB/BBB-1080-png/
Author: Yang Liu
Date: 2021-04-04
@sindresorhus
sindresorhus / esm-package.md
Last active July 22, 2025 20:59
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.