Skip to content

Instantly share code, notes, and snippets.

View hughrawlinson's full-sized avatar

Hugh Rawlinson hughrawlinson

View GitHub Profile
export class MediaRecorderWithStorage {
#mediaRecorder: MediaRecorder;
#blobs: Blob[] = [];
#blobOptions?: BlobPropertyBag;
constructor(
stream: MediaStream,
mediaRecorderOptions: MediaRecorderOptions,
blobOptions?: BlobPropertyBag
) {
{
"name": "Dactyl Manuform (5x6)",
"vendorId": "0x444D",
"productId": "0x3538",
"matrix": {"rows": 12, "cols": 6},
"layouts": {
"keymap": [
[{"x":3},"0,3",{"x":9.25},"6,2"],
[{"y":-0.875,"x":2},"0,2",{"x":1},"0,4",{"x":7.25},"6,1",{"x":1},"6,3"],
[{"y":-0.875,"x":5},"0,5",{"x":5.25},"6,0"],
@hughrawlinson
hughrawlinson / add_dates.mjs
Last active June 16, 2022 12:07
Add dates to Wagtail release notes
/*
* version-date-mapping.json is generated with the following shell command (requires ripgrep and jq):
*
* cat CHANGELOG.txt | rg '(?P<v>\d\.(\d)?\d(\.\d\d?)?)( LTS)? \((?P<d>\d\d\.\d\d\.\d\d\d\d)\)' \
* -r '{"version":"$v", "date":"$d"}' --only-matching | jq --slurp . > version-date-mapping.json
*/
import { readFile, writeFile } from 'fs/promises';
const months = [
/*
If like me you find the EMFCamp stream audio to be too quiet to hear,
FIRST TURN YOUR VOLUME TO ZERO. NOT MUTE. ZERO.
Then run this snippet, and slowly turn the volume back up to a comfortable level.
WARNING: If you don't turn your volume to ZERO and slowly turn up to a comfortable level,
you risk damaging your speakers, your hearing, and the hearing of those in earshot.
#!/usr/bin/env node
import { exec } from "child_process";
import { readFileSync } from "fs";
import { mkdtemp } from "fs/promises";
import path from "path";
import wav from "node-wav";
import os from "os";
import Meyda from "meyda";
const CONFIG = {
@hughrawlinson
hughrawlinson / run_chuck_with_lick
Created July 6, 2021 15:08
Run a ChucK file with LiCK
#!/bin/bash
file="tests.ck"
echo $file
if [ $1 ]
then
file="$1"
fi
echo $file
@hughrawlinson
hughrawlinson / questions.md
Last active February 5, 2020 00:56
Typescript Questions

Questions I have about Typescript

Keeping a public list of questions that come up about Typescript so that I can easily share them I guess? I don't know.

  1. If you're writing a library, and you depend on a library, and your API requires args that you pass into the deeper library, should you wrap that library's types, or expose them? Is it bad practice to expose them? If so, how do you wrap them without going all the way to the bottom of the type stack?
  2. Really no ints? I did some searching around and the argument seems to be "js doesn't have ints at runtime so typescript can't have them". But a) javascript absolutely has ints at runtime thanks to some interpreter optimisations (even though yes they're not mentioned in the spec), and b) javascript doesn't have other typescript types at runtime, and typescript still has them, so what's the difference there?
  3. Maybe this is a bad pattern, but if I have some function that takes a list of values of a particular enum, and returns an object with keys correspo
@hughrawlinson
hughrawlinson / bright.sh
Created May 20, 2019 10:27
I'm on Linux and this is how I change my backlight brightness now
echo 937 | sudo tee /sys/class/backlight/intel_backlight/brightness
@hughrawlinson
hughrawlinson / notes.md
Created April 19, 2019 00:10
Typescript Meetup notes, Boston (actually Cambridge) 2019-04-18

Typescript Meetup, Boston (actually Cambridge) 2019-04-18

Here are the [Boston Typescript Meetup 18/04] details.

Typescript is unsound, and that's ok.

Areas where Typescript is unsound:

  1. Refinement invalidation
@hughrawlinson
hughrawlinson / config.fish
Created January 18, 2019 03:28
Look what you made me do
function p
if test -e ./package-lock.json
npm $argv
else if test -e ./yarn.lock
yarn $argv
else
echo "You haven't used either npm or yarn in this project yet, or this isn't a node directory"
end
end