Skip to content

Instantly share code, notes, and snippets.

@jamonholmgren
jamonholmgren / set-up-homebrew-standard-user.md
Created April 12, 2026 17:48
Set up homebrew without root on a standard user account.

Set up homebrew on a Standard User account

Per: https://x.com/jamonholmgren/status/2043385696535331324

mkdir -p "$HOME/homebrew"
git clone https://github.com/Homebrew/brew "$HOME/homebrew/.linuxbrew/Homebrew"
mkdir -p "$HOME/homebrew/bin"
ln -s "$HOME/homebrew/.linuxbrew/Homebrew/bin/brew" "$HOME/homebrew/bin/brew"
# Homebrew (per-user)
@daniel-farina
daniel-farina / opencode-gemma4-ollama-macos.md
Last active April 25, 2026 07:19
Running OpenCode with Gemma 4 26B on macOS via llama.cpp - fixing tool calling

Running OpenCode with Gemma 4 26B on macOS (via llama.cpp)

As of April 2026, Gemma 4 tool calling is broken in Ollama v0.20.0 (ollama/ollama#15241) - the tool call parser fails and streaming drops tool calls entirely. OpenCode also has issues with local OpenAI-compatible providers (anomalyco/opencode#20669, #20719).

This guide documents a working setup using:

  • llama.cpp (built from source with PR #21326 template fix + PR #21343 tokenizer fix) instead of Ollama
  • OpenCode built from source with PR #16531 tool-call compatibility layer

Tested on macOS Apple Silicon (M1 Max, 32GB) on April 2, 2026.

@rednafi
rednafi / worklog.md
Last active August 20, 2024 07:14
Generate a simple worklog.

What

The following script will generate a simple markdown worklog in the format listed below. It correctly handles the partial weeks at the beginning and the end of the year.

# Worklog

## Week 1 [2025-01-01 - 2025-01-03]
@trvswgnr
trvswgnr / run-concurrent-async.ts
Created July 17, 2023 09:34
generic concurrent execution
export async function runConcurrentAsync<T, A extends IterableIterator<unknown>>(tasks: Task<T>[], argsList: A[] = [], concurrency = 5): Promise<T[]> {
const semaphore = new Semaphore(concurrency);
const promises = tasks.map(async (task, index) => {
await semaphore.acquire();
try {
const args = argsList[index] || [];
return await task(...args);
} finally {
semaphore.release();
}
@irazasyed
irazasyed / outbound-email-with-cloudflare.md
Last active April 22, 2026 19:31
Using Gmail SMTP with Cloudflare Email Routing: A Step-by-Step Guide

Using Gmail SMTP with Cloudflare Email Routing: Step-by-Step Guide

Learn how to send emails through Gmail SMTP with Cloudflare Email Routing in this comprehensive guide.

Step 1: Enable 2-Factor Authentication

To proceed with this method, ensure that you have enabled two-factor authentication for your Google account. If you haven't done so already, you can follow the link to set it up → Enable 2FA in your Google account.

Step 2: Create an App Password for Mail

@hwayne
hwayne / script.py
Created March 13, 2023 19:59
Script that notifies me when a cubs game is happening
# This is running on an aws lambda instance with a CloudWatch trigger:
# Trigger is cron(0 17 * * ? *)
# CSV is from https://www.mlb.com/cubs/schedule/downloadable-schedule
import json
from urllib.request import urlopen, Request
from urllib.parse import urlencode
from os import getenv
from csv import DictReader
from datetime import datetime
import trio
async def main():
async with ws_connect("ws://127.0.0.1:8765") as websockets:
await websockets.send("Hello, world.")
message = await websockets.recv()
print(message)
trio.run(main)
@corlaez
corlaez / README.md
Last active March 23, 2026 03:23
Hexagonal Architecture and Modular Implementation

Hexagonal Architecture

Conceptualized by Alistair Cockburn. Also known as "Ports and Adapters".

In a nutshell:

Application Driver -> Primary Adapter -> Primary Port -> Use Case -> Secondary Port -> Secondary Adapter -> External System/Side Effect
@Kludex
Kludex / main.py
Last active April 17, 2024 01:55
Document each version on FastAPI
from fastapi import APIRouter, FastAPI
from utils import create_versioning_docs
app = FastAPI(docs_url=None, redoc_url=None)
v1_router = APIRouter(prefix="/v1")
v2_router = APIRouter(prefix="/v2")
@Kludex
Kludex / main.py
Last active May 16, 2025 06:21
Run Gunicorn with Uvicorn workers in code
""" Snippet that demonstrates how to use Gunicorn with Uvicorn workers in code.
Feel free to run:
- `python main.py` - to use uvicorn.
- `ENV=prod python main.py` - to use gunicorn with uvicorn workers.
Reference: https://docs.gunicorn.org/en/stable/custom.html
"""