Skip to content

Instantly share code, notes, and snippets.

@madig
madig / calories.ipynb
Last active April 13, 2024 14:06
Calorie counting
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Preamp: -4.3 dB
Filter: ON PK Fc 20 Hz Gain -2 dB Q 0.8
Filter: ON PK Fc 55 Hz Gain -4.2 dB Q 0.6
Filter: ON LSC Fc 105 Hz Gain 5.5 dB Q 0.71
Filter: ON PK Fc 210 Hz Gain -4.9 dB Q 0.6
Filter: ON PK Fc 800 Hz Gain 1.1 dB Q 1.5
Filter: ON PK Fc 2050 Hz Gain 1.3 dB Q 3
Filter: ON PK Fc 7400 Hz Gain -5.6 dB Q 4
Filter: ON PK Fc 8200 Hz Gain -3.6 dB Q 5
Filter: ON HSC Fc 11000 Hz Gain -5.0 dB Q 0.71
@madig
madig / EmbedGlyphMetadata.py
Created July 12, 2022 17:35
Embed glyph metadata in source file
# MenuTitle: Embed Glyph Metadata in Current Font
"""Embeds production name, category and sub category into each glyph of the
current font."""
for glyph in Glyphs.font.glyphs:
glyph.storeProductionName = True
glyph.storeSubCategory = True
glyph.storeCategory = True
@madig
madig / build.py
Last active September 20, 2020 08:09
Build file for Cascadia Code Variable
import argparse
import multiprocessing
import multiprocessing.pool
import os
import subprocess
from pathlib import Path
from typing import cast
import cffsubr.__main__
import fontmake.instantiator
@madig
madig / transform named tuple.py
Created April 29, 2020 09:56
transform named tuple
"""Affine 2D transformation matrix class.
The Transform class implements various transformation matrix operations,
both on the matrix itself, as well as on 2D coordinates.
Transform instances are effectively immutable: all methods that operate on the
transformation itself always return a new instance. This has as the
interesting side effect that Transform instances are hashable, ie. they can be
used as dictionary keys.
@madig
madig / pyproject.toml
Created April 13, 2020 13:42
Poetry transient extra dependency resolution bug
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["a b <a@b.com>"]
[tool.poetry.dependencies]
python = "^3.8"
ufolib2 = "^0.6"
poetry-resolver-bug-test = "*"
use norad::Ufo;
use std::thread;
// static SOURCE1: &str = "/home/nikolaus/Entwicklung/cantarell-fonts/src/Cantarell-Light.ufo";
// static SOURCE2: &str = "/home/nikolaus/Entwicklung/cantarell-fonts/src/Cantarell-Regular.ufo";
// static SOURCE3: &str = "/home/nikolaus/Entwicklung/cantarell-fonts/src/Cantarell-Bold.ufo";
static SOURCE1: &str = "/home/nikolaus/Entwicklung/noto-sans-interpolation/NotoSans-Light.ufo";
static SOURCE2: &str = "/home/nikolaus/Entwicklung/noto-sans-interpolation/NotoSans-Regular.ufo";
static SOURCE3: &str = "/home/nikolaus/Entwicklung/noto-sans-interpolation/NotoSans-Bold.ufo";
static META_CREATOR: &str = "org.linebender.norad";
@madig
madig / designspace_nextgen.py
Last active March 6, 2020 17:57
Sketch of a next-gen designspaceLib
import logging
import os
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
import fontTools.misc.plistlib
import fontTools.varLib.models
from fontTools.misc import etree as ElementTree
fn quoted_string_literal(&mut self, quote_char: u8) -> Result<Option<Event>, Error> {
let mut acc: Vec<u8> = Vec::new();
let mut cur_char = quote_char;
while {
match self.peeked_char {
// do not stop if the quote is escaped
Some(c) => c != quote_char || cur_char == b'\\',
None => false,
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Test Page</title>
<style type="text/css">
@import url('https://fonts.googleapis.com/css?family=Noto+Sans:bold&display=swap');
p {