Skip to content

Instantly share code, notes, and snippets.

View mattdesl's full-sized avatar

Matt DesLauriers mattdesl

View GitHub Profile
mattdesl / example.js
Created May 22, 2024 08:24
quickly create a linear gradient in software in JS
const worker = new Worker(new URL("./gradient.js", import.meta.url), {
type: "module",
// image options
width: 128,
height: 256,
channels: 4,
depth: 8
mattdesl / Home.tsx
Created April 25, 2024 16:52
wallet signature mechanism for Meridian book verification
import { ConnectButton } from '@rainbow-me/rainbowkit';
import type { NextPage } from 'next';
import { useSignMessage } from 'wagmi'
import Image from 'next/image';
import { verifyMessage } from 'ethers/lib/utils'
import { useAccount, useConnect, useDisconnect } from 'wagmi'
import { createMessage } from '../tools/sign';
import Head from 'next/head';
import styles from '../styles/Home.module.css';
mattdesl / PointCheck.sol
Last active April 16, 2024 09:25
Verification of bn254 points aka alt_bn128
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12 <0.9.0;
contract PointCheck {
struct G1Point {
uint256 x;
uint256 y;
event BroadcastSecKey(address indexed sender, uint256 secKey);

Gluten-Free Buckwheat Sablé Cookies


  • 100g buckwheat flour
  • 50g white sugar
  • 50g salted butter
  • Pinch of salt, to taste
  • Big pinch of cinnamon, to taste (note: Cassia type cinnamon, or what you’d find in a Swedish grocery store)
  • Big pinch of cardamom powder, to taste

Easy Soy-Glazed Chicken Recipe[^1]


  • 4-6 Chicken thighs
  • Soy sauce
  • Mirin
  • Smoked chilli flakes
  • Garlic powder
  • Ginger powder
import {
mattdesl / 02.js
Created January 2, 2024 17:11
MIT license, messy genuary2024 code... "no palettes"
import canvasSketch from "canvas-sketch";
import { degToRad, linspace, radToDeg } from "canvas-sketch-util/math";
import { Lch, contrastRatio } from "../util/color";
import polyBool from "poly-bool";
import * as random from "canvas-sketch-util/random";
import { angleLerp } from "../util/angle";
export const settings = {
suffix: random.getSeed(),
animate: true,
mattdesl /
Created November 13, 2023 17:29
hachure notes

Notes on hachure

Some notes on archiving and accessing the media and metadata around digital editions of hachure. These tokens were released through verse but can be retrieved through decentralized storage systems.

See Token Data for a listing of media & data associated with each edition.

Saving High-Res PNG and SVG

In the browser, with the artwork in focus, you can hit the keystroke Cmd + S or Ctrl + S. This will auto-download two files: a 2048x2048px PNG, and an SVG of the paths that could be used for pen plotting. It's recommended to use Chrome for downloading; some browsers might only let one download through.

* Conserve aspect ratio of the original region. Useful when shrinking/enlarging
* images to fit into a certain area.
* @param {Number} srcWidth width of source image
* @param {Number} srcHeight height of source image
* @param {Number} maxWidth maximum available width
* @param {Number} maxHeight maximum available height
* @return {Object} { width, height }
mattdesl /
Created November 2, 2023 20:29
fork of latent consistency model with a couple small perf tweaks
import os
import torch
import time
from diffusers import DiffusionPipeline, AutoencoderTiny
from collections import namedtuple
PredictionResult = namedtuple('PredictionResult', [