Skip to content

Instantly share code, notes, and snippets.


Daniel Buckmaster crabmusket

View GitHub Profile
crabmusket /
Last active Jun 23, 2022
Headless rendering with THREE.js

Headless THREE

Created with

Make sure you install headless-gl's dependencies, then run with XVFB like so:

crabmusket /
Created May 6, 2020
Python simple HTTP server
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(("", 8080))
while True:


Use this snippet to parse, modify and render environment files.

import { EnvFile } from "";

let content = `
crabmusket /
Last active Aug 12, 2019
Deno micro modules index page

Deno micro modules

Each of these modules is a single file consisting of no more than a page or two of code, which provide some useful 'generic' feature. These modules could be copied as-is into any TypeScript project, but they're designed to work with Deno. Deno's URL loading makes it very easy to import them.

crabmusket /
Last active Aug 12, 2019
Async semaphore utility class for Deno


An asynchronous semaphore utility class meant to work with Deno. You can use it to implement rate-limiting and other concurrency patterns.

Usage example:

import { Semaphore } from "";
crabmusket / json.ts
Last active Oct 1, 2019
JSON utilities for Deno
View json.ts
/** For the spec of the JSON type, see */
export type JsonValue = JsonObject | JsonArray | number | string | boolean | null;
/** JSON objects can have any string key. */
export interface JsonObject {[key: string]: JsonValue};
/** For the explanation of this type, see */
export interface JsonArray extends Array<JsonValue> {};
/** Narrow the type of a JsonValue to check if it's an object. */
crabmusket /
Last active Aug 7, 2019
String title case function for Deno


Usage example:

import { titleCase } from "";

console.log(titleCase("deno is AWESOME"));
console.log(titleCase("words-can contain_punctuation"));
console.log(titleCase(" spacing is preserved"));
crabmusket / Dockerfile
Last active Aug 9, 2019
Build Deno in a Docker container
View Dockerfile
FROM ubuntu:16.04
RUN apt-get update && apt-get install \
build-essential \
clang-3.8 \
curl \
git \
libxml2 \
python-dev \
crabmusket /
Last active May 9, 2019
PHP throwables example

PHP exceptions and errors

In PHP, Exceptions can be caught:

try {
    throw new \DomainException('input out of bounds');
} catch (\Exception $e) {
    echo "got exception\n";
} finally {
crabmusket / index.html
Created Mar 19, 2019 — forked from arrayjam/index.html
Australia Postcode Decoder
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
text, label {
font-family: sans-serif;
label {
position: absolute;
text-align: center;