Skip to content

Instantly share code, notes, and snippets.

@progrium
progrium / script.js
Last active April 27, 2025 00:44
original "paper prototype" demo script / spec for wanix 0.3 imagining how basic primitives would be used to bootstrap a terminal+vm using only filesystem operations
const w = new Wanix()
Object.getPrototypeOf(w)
// {readFile: ƒ, writeFile: ƒ, readDir: ƒ, exists: ƒ}
await w.readDir(".")
// ['dom/', 'fsys/', 'proc/', 'term/', 'vm/']
await w.readDir("fsys")
// ['ctl', 'new/']
await w.readDir("fsys/new")
@progrium
progrium / fsys.md
Last active January 6, 2025 00:20
go filesystem api design walkthrough

io package

Core interfaces

type Reader interface {
	Read(p []byte) (n int, err error)
}

type Writer interface {
	Write(p []byte) (n int, err error)
@progrium
progrium / vscode86.md
Created June 24, 2024 19:44
vscode integrated with v86, a dev environment entirely in the browser
#!/bin/sh
apptron app indicator - ./icon.png <<MENU |
Timers
5 seconds
10 seconds
30 seconds
Say Hello
---
Quit
MENU
@progrium
progrium / datetimeformat.js
Last active December 29, 2024 18:02
Intl.DateTimeFormat is kinda nutty with custom format strings, this makes it sane
function dateTimeFormat(timestamp, locale, str, ...opts) {
const d = new Date(timestamp);
return str.replace(/{(\d+)}/g, function(match, number) {
return typeof opts[number] != 'undefined'
? new Intl.DateTimeFormat(locale, opts[number]).format(d)
: match;
});
}
console.log(dateTimeFormat("2021-11-19T19:19:36.598071-06:00", "en", "{0} at {1}!", {dateStyle:"short"}, {timeStyle:"long"}))
// styling module provides a helper for building style
// and class attributes for elements.
type Styling = string | Object | Style | (() => boolean);
type ConditionedStyle = [string, () => boolean];
export function from(...styling: Styling[]): Style {
return Style.from(...styling);
}
@progrium
progrium / cli.go
Created September 2, 2021 01:13
350 line reimplementation of cobra, simplified and with no dependencies
package cli
import (
"bytes"
"context"
"flag"
"fmt"
"os"
"reflect"
"strings"
@progrium
progrium / server.go
Created August 25, 2021 15:59
simple qtalk rpc server example
// server.go
package main
import (
"fmt"
"log"
"net"
"strings"
"github.com/progrium/qtalk-go/codec"
@progrium
progrium / client.go
Last active August 25, 2021 15:58
simple qtalk rpc example client
// client.go
package main
import (
"context"
"log"
"github.com/progrium/qtalk-go/codec"
"github.com/progrium/qtalk-go/fn"
"github.com/progrium/qtalk-go/talk"
package main
import (
"fmt"
"github.com/.../fds"
"github.com/.../fds/dict"
"github.com/.../fds/list"
"github.com/.../fds/tree"
)