Skip to content

Instantly share code, notes, and snippets.

Make WSL2 faster by removing /mnt/c in the PATH variable

Turning off appendWindowsPath (the feature that adds /mnt/c paths to $PATH) can make WSL faster.

For Ubuntu on WSL

For most distros, it can be done by editing /etc/wsl.conf. These instructions were taken from https://gist.github.com/ilbunilcho/4280bd55a10cefef75e74986b6bff936

$ sudo vi /etc/wsl.conf
@rstacruz
rstacruz / edit.ts
Last active June 19, 2026 11:40
pi /edit extension for editing Markdown plans
// Adds `/edit` to pi.
//
// Useful for plans: pi writes the Markdown, then you refine it in your editor.
//
// How it works:
// - remembers the last `.md` file written via the `write` tool
// - suggests `/edit` after writing a Markdown file
// - opens that file in `$EDITOR`
//
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";

Opinion: Ruby's pessimistic operator

Today I realised that Ruby's >= is more useful than ~>.

Rubygems’s pessimistic operator ~>, also known as “twiddle-wakka”, allows developers to specify flexible gem version ranges.

This... Is equivalent to...
gem 'i18n', '~> 2.3.5' gem 'i18n', ‘>= 2.3.5’, '< 2.4.0'
gem 'i18n', '~&gt; 2.3' gem 'i18n', ‘&gt;= 2.3.0’, ‘&lt; 3’

Opencode plugin development guide

Generated with LLM assistance on 2 Nov 2025 with minimal human verification.

Overview

Opencode plugins extend the functionality of the Opencode AI assistant by allowing you to add custom tools, authentication providers, event handlers, and hooks into the core system. This guide covers how to create, configure, and distribute plugins.

Source files:

@rstacruz
rstacruz / index.md
Last active May 27, 2026 15:23
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@rstacruz
rstacruz / 1778192131877-misty-pixel.md
Last active May 7, 2026 22:27
NixOS config: Extract modules/gaming.nix plan

Extract modules/gaming.nix from shared config in alphanaut and misamino

Context

Both hosts/alphanaut/configuration.nix and hosts/misamino/configuration.nix contain ~40 lines of identical gaming-related configuration (gamemode, steam, sunshine, udev/uinput rules, 32-bit graphics). Extracting this into a shared module eliminates duplication and makes the gaming stack reusable.

Minimal host is unaffected — it has no gaming configuration.

Files

@rstacruz
rstacruz / inspected-properties.md
Created May 2, 2026 02:00
Property inspection notes
@rstacruz
rstacruz / README.md
Last active April 7, 2026 13:17
Setting up Babel and TypeScript

Install Babel 7 and TypeScript

yarn add --dev \
  @babel/core \
  @babel/cli \
  @babel/preset-env \
  @babel/preset-typescript \
  typescript
@rstacruz
rstacruz / shell.nix
Created January 15, 2026 03:45
NixOS config for LLM-API-Key-Proxy
# NixOS config for LLM-API-Key-Proxy
# https://gist.github.com/rstacruz/3a7e9b4a2cabdd9c21947eeb3e191f2c
# https://github.com/Mirrowel/LLM-API-Key-Proxy
#
# First start:
# git clone https://github.com/Mirrowel/LLM-API-Key-Proxy.git
# cd LLM-API-Key-Proxy
# # ...then copy this shell.nix in
# nix shell --run "pip install -r requirements.txt"
#
@rstacruz
rstacruz / README.md
Last active January 2, 2026 06:19
Setting up Jest with ESM

Setting up Jest with ESM

Here are some different ways on how to set up Jest to support ESM. This applies for Jest v25, Node v13, and Babel v7.

Method A: Native Node.js support

Node v14 and Jest v26 support ESM natively with the --experimental-vm-modules flag.

Install cross-env: