Skip to content

Instantly share code, notes, and snippets.

@thoroc
thoroc / PATCHWORK.md
Last active December 21, 2025 23:29
PatchworkOS Is a From-Scratch OS That Follows 'Everything Is a File' More Strictly than UNIX: An Overview of Sockets, Spawning Processes, and Notes (Signals)

PatchworkOS strictly follows the "everything is a file" philosophy in a way inspired by Plan9, this can often result in unorthodox APIs that seem overcomplicated at first, but the goal is to provide a simple, consistent and most importantly composable interface for all kernel subsystems, more on this later.

Included below are some examples to familiarize yourself with the concept. We, of course, cannot cover everything, so the concepts presented here are the ones believed to provide the greatest insight into the philosophy.

Sockets

The first example is sockets, specifically how to create and use local seqpacket sockets.

To create a local seqpacket socket, you open the /net/local/seqpacket file. This is equivalent to calling socket(AF_LOCAL, SOCK_SEQPACKET, 0) in POSIX systems. The opened file can be read to return the "ID" of the newly created socket which is a string that uniquely identifies the socket, more on this later.

#!/usr/bin/env bun
import { promises as fs } from 'node:fs';
import path from 'node:path';
import process from 'node:process';
const chromeExtensionIds = [
'bpgaffohfacaamplbbojgbiicfgedmoi', 'cdgonefipacceedbkflolomdegncceid',
'cihbmmokhmieaidfgamioabhhkggnehm', 'eagiakjmjnblliacokhcalebgnhellfi',
'eaokmbopbenbmgegkmoiogmpejlaikea', 'gipnpcencdgljnaecpekokmpgnhgpela',
'gnhgdhlkojnlgljamagoigaabdmfhfeg', 'hlcjkaoneihodfmonjnlnnfpdcopgfjk',
@thoroc
thoroc / README.md
Last active December 23, 2025 14:34
Awesome list of awesome project for local agentic workflow

Awesome list of awesome project for local agentic workflow

List of projects that are somewhat related to opencode.

Model list

Running local models

@thoroc
thoroc / opencode-model-checker.sh
Last active November 21, 2025 11:54
Check which models is currently set across all the Opencode related files on the system
#!/usr/bin/env bash
set -euo pipefail
shopt -s nullglob
# opencode-model-check.sh - Check currently used model in OpenCode logs
#
# Requirements:
# REQUIRED:
# - jq: JSON processor (https://jqlang.github.io/jq/)
# - grep: Text search utility (standard on all Unix systems)
@thoroc
thoroc / CONFIGURATION.md
Created November 6, 2025 21:41
OpenCode config - shamelessly lifted from the Discord server
@thoroc
thoroc / opencode_command_commit.md
Created September 12, 2025 14:51
OpenCode extras
description
Stage and commit changes with conventional commit message

You are tasked with staging and committing changes in a repository using conventional commit message format.

First, detect the version control system: !if [ -d ".git" ]; then echo "git"; elif [ -d ".jj" ]; then echo "jujutsu"; else echo "none"; fi

If git is detected:

#!/bin/bash
DIRNAME=${1:-.}
cd "$DIRNAME"
FILES=$(mktemp)
PACKAGES=$(mktemp)
export NUMCONCURRENT=8
function findCmd {
@thoroc
thoroc / migrate-from-homebrew.sh
Created July 18, 2025 23:07
Script to help migration from Homebrew to Mise.dev
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
LOGFILE="$(date '+%Y%m%d-%H%M%S')-migrate-from-homebrew.log"
@thoroc
thoroc / README.md
Last active May 30, 2025 04:49
Docker in Incus is Awesome - The “Get my” application (Aug 2024)

Deploying the “Get my” Application with Incus OCI Containers

Overview

This guide explains how to deploy the Get my application using Incus with the new OCI container support introduced in Incus 6.3.
Get my is a lightweight web application for managing shared family task and shopping lists, created by Brian (Open Source Advocate).

For users new to Incus, refer to the introductory tutorial:

@thoroc
thoroc / README.md
Last active May 28, 2025 07:40
Self-Hosted DNS Server - Installing AdGuard Home + Unbound

Self-Hosted DNS Server - Installing AdGuard Home + Unbound

Introduction

This guide shows you how to set up a self-hosted local and secure DNS server using:

  • AdGuard Home as main DNS server with ad filter and control panel.
  • Unbound as a recursive DNS resolver, directly querying the internet root servers.
  • Docker Compose for simple and efficient orchestration.
  • Features and Benefits