hello!

sterling

I'm Sterling, a software engineer from CA.
Get in touch! I love to talk shop.

[email protected] github.com/demille

Projects

A z-machine (interpreter) for Infocom-era text adventure games like Zork. Runs in the browser or terminal. Features live mapping, undo/redo support, and narration/dictation via web speech APIs.

Rust WebAssembly React D3
cargo install encrusted
encrusted screenshot
North of House - 0/1
ZORK I: The Great Underground Empire Copyright (c) 1981, 1982, 1983 Infocom, Inc. All rights reserved. ZORK is a registered trademark of Infocom, Inc. Revision 88 / Serial number 840726 West of House You are standing in an open field west of a white house, with a boarded front door. There is a small mailbox here. > go north North of House You are facing the north side of a white house. There is no door here, and all the windows are boarded up. To the north a narrow path winds through the trees. >

dnssd.js

Github

Dependency-less Bonjour/Avahi service discovery for JavaScript. Compliant with RFC 6762 & RFC 6763.

JS
npm install dnssd
dnssd-js browse -v
•Query.js [16:36:06:362] Sending query (id#1) •NetworkIn… [16:36:05:995] INADDR_ANY (IPv4) -> 224.0.0.251:5353 --> QUERY └─┬ Questions [1] └── _printer._tcp.local. PTR QM •NetworkIn… [16:36:06:165] 192.168.0.113:5353 -> INADDR_ANY <-- ANSWER ├─┬ Answer RRs [1] │ └── EPSON 2650._printer._tcp.local. PTR 4500 (flush) └─┬ Additional RRs [4] ├── Printer.local. A 120 192.168.0.113 (flush) ├── Printer.local. AAAA 120 fe80::9eae::1234 (flush) ├── EPSON 2650._printer._tcp.local. SRV 120 Printer.local. 515 (flush) └── EPSON 2650._printer._tcp.local. TXT 4500 {"txtvers":"1"… (flush) •Browser.js [16:36:05:941] Found new service: "EPSON 2650._printer._tcp.local."|   

wasm-ffi

Github / Demo

A foreign function interface library for WebAssembly that adds support for additional types like strings, structs, and arrays. Inspired by node-ffi, but built for WebAssembly.

WebAssembly JS
npm install wasm-ffi
index.js
import { Wrapper, Struct } from 'wasm-ffi';
const Point = new Struct({ x: 'u32', y: 'u32' });
const library = new Wrapper({
get_point: [Point],
sum: ['number', ['array']]
compare: ['boolean', ['string', 'string']],
});
library.fetch('main.wasm').then(() => {
const pt = library.get_point();
library.sum(new Uint16Array([1, 2, 3])) === 6;
library.compare('this', 'that') === false;
});
main.c
struct Point {
uint32_t x;
uint32_t y;
};
export struct Point *get_point() {
struct Point *pt = malloc(sizeof(struct Point));
pt->x = 111;
pt->y = 222;
return p;
}
export uint16_t sum(const uint16_t arr[]) {
uint16_t i;
uint16_t total = 0;
for (i = 0; i < 3; ++i) {
total += arr[i];
}
return total;
}
export bool compare(char *a, char *b) {
return (strcmp(a, b) == 0);
}
main.rs
#[repr(C)]
pub struct Point {
x: u32,
y: u32,
}
#[no_mangle]
pub fn get_point() -> *mut Point {
Box::into_raw(Box::new(Point {
x: 111,
y: 222,
}))
}
#[no_mangle]
pub fn sum(ptr: *const u16) -> u32 {
assert!(!ptr.is_null());
let slice = unsafe {
std::slice::from_raw_parts(ptr, 3)
};
slice.iter().sum()
}
#[no_mangle]
pub fn compare(a: *const c_char, b: *const c_char) -> bool {
assert!(!a.is_null());
assert!(!b.is_null());
let str_a = unsafe { CStr::from_ptr(a) };
let str_b = unsafe { CStr::from_ptr(b) };
str_a == str_b
}
main.ts
class Point {
x: u32;
y: u32;
constructor(x: u32, y: u32) {
this.x = x;
this.y = y;
}
}
export function get_point(): Point {
return new Point(111, 222);
}
export function sum(arr: u16[]): u16 {
let result: u16 = 0;
for (let i = 0; i < arr.length; i++) {
result += arr[i];
}
return result;
}
export function compare(a: string, b: string): boolean {
return a == b;
}

A service that lets users create webhooks for incoming or forwarded email. Processed emails are sent as JSON to a registered URL, where they can be handled as normal requests.

Python Django
emailhook.xyz screenshot
emailhook.xyz screenshot

usbmux

Github

Library to communicate with iOS devices through a wired USB connection. Device access is brokered by the usbmux daemon that comes bundled with iTunes (or libimobiledevice).

JS
npm install usbmux [-g]

A syntax highlighting tool (like pygmentize) that uses Sublime Text grammars and themes for more detailed highlighting. Aims to generate HTML that looks like your text editor.

Rust HTML
cargo install paint
$ paint replace plain.html -o highlighted.html

ghast

An open implementation of the JavaScript Chrome Sender API

JS Chromecast

url-cast-reciever

Custom chromecast receiver to display webpages without tab casting

html

wasm-glue

Minimal shim to enable Rust println!'s and panic's in WebAssembly

Rust WebAssembly

bookmark

A command line directory bookmarking tool

JS Bash Cmd