Skip to content

Instantly share code, notes, and snippets.

View mattdesl's full-sized avatar
👋

Matt DesLauriers mattdesl

👋
View GitHub Profile
@mattdesl
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

Ingredients:

  • 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]

Ingredients:

  • 4-6 Chicken thighs
  • Soy sauce
  • Mirin
  • Smoked chilli flakes
  • Garlic powder
  • Ginger powder
import {
IrohNode,
PublicKey,
NodeAddr,
Query,
SortBy,
SortDirection,
pathToKey,
AuthorId,
keyToPath,
@mattdesl
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
mattdesl / README.md
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
mattdesl / model.py
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', [
'latents',
'step',
'steps',
@mattdesl
mattdesl / verify.circom
Last active August 15, 2023 22:30
verify list of indices are a valid permutation in circom zk circuit
pragma circom 2.1.5;
include "circomlib/circuits/comparators.circom";
/*
Verifies a permutation is valid and includes all indices once and only once.
Examples:
[ 0 1 2 3 ] == OK
[ 1 2 0 3 ] == OK
[ 0 2 0 3 ] == NOT OK
function fractalNoise(x, y, frequency, octaves, persistence = 0.5, lacunarity = 2) {
let total = 0;
let amplitude = 1;
let maxValue = 0; // Used for normalizing result to 0.0 - 1.0
for (let i = 0; i < octaves; i++) {
total += noise2D(x * frequency, y * frequency) * amplitude;
maxValue += amplitude;
amplitude *= persistence;
frequency *= lacunarity;