Skip to content

Instantly share code, notes, and snippets.

View wchargin's full-sized avatar

Willow Chargin wchargin

View GitHub Profile
@wchargin
wchargin / yg_edAeTruF.go
Created June 6, 2025 05:55
consts and transitivity in go
package main
import (
"fmt"
"math"
)
func main() {
f := math.SmallestNonzeroFloat64
fmt.Println(f == 5e-324)
panic: test timed out after 10m0s
running tests:
TestGORM (10m0s)
goroutine 43 [running]:
testing.(*M).startAlarm.func1()
/Users/wchargin/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:2373 +0x1dc
created by time.goFunc
/Users/wchargin/go/pkg/mod/golang.org/[email protected]/src/time/sleep.go:215 +0x44
@wchargin
wchargin / gormlock.go
Last active May 25, 2025 04:39
consistent repro for deadlock in Gorm prepared statements (repros at gorm v1.26.1)
package main
import (
"context"
"fmt"
"os"
"runtime/pprof"
"sync"
"time"
// Algebraic regular expression library.
package realg
import (
"fmt"
"regexp"
"strings"
)
type Expr struct {
@wchargin
wchargin / animate-in-lch.html
Created March 30, 2025 07:17
animate colors through a perceptual color space
<!DOCTYPE html>
<style>
@property --fac {
syntax: "<percentage>";
initial-value: 0%;
inherits: true;
}
html,
body {
height: 100%;
@wchargin
wchargin / Dockerfile
Last active February 25, 2025 16:12
protobuf.dart#952 reproducer #2
FROM dart:3.7.0-sdk
RUN apt-get update
RUN apt-get install -y protobuf-compiler libprotobuf-dev
RUN dart pub global activate protoc_plugin
@wchargin
wchargin / Dockerfile
Last active February 25, 2025 16:11
protobuf.dart#952 reproducer #1
FROM dart:3.7.0-sdk
RUN apt-get update
RUN apt-get install -y protobuf-compiler libprotobuf-dev
RUN dart pub global activate protoc_plugin
<!doctype html>
<style>
#form {
display: flex;
gap: 10px;
}
p {
margin: 0.5em 0;
}
<!doctype html>
<div id="root"></div>
<script type="module">
import React, { useEffect, useState } from "https://esm.sh/[email protected]";
import ReactDOM from "https://esm.sh/[email protected]";
import { animated, useSpring } from "https://esm.sh/@react-spring/[email protected]";
import { usePrevious } from "https://esm.sh/@uidotdev/[email protected]";
import * as turf from "@turf/turf"; // v7.0.0
const coords = (pointFeature) => pointFeature.geometry.coordinates;
const pointToLineDistanceOptions = { method: "geodesic" };
// ^ setting "planar" doesn't change things substantively
let maxError = -Infinity;
let argmaxError;
let nErrorOverOnePercent = 0;