Skip to content

Instantly share code, notes, and snippets.

View patrick-kidger's full-sized avatar

Patrick Kidger patrick-kidger

View GitHub Profile
import Distributed
foo_quote = quote
function foo(name::String)::String
id = Distributed.myid()
return "Hello $name from $id"
end
end
function run(num_procs::Integer)::Array{String}
"""A 1-dimensional example of adaptive mesh refinement in JAX. In this case, a simple
implementation of quadrature.
Static shapes don't mean you can't do this. Heap allocation is *not* necessary!
Not extensively tested; any bugs leave a comment below.
"""
import functools as ft
from collections.abc import Callable
@patrick-kidger
patrick-kidger / matplotlib-emoji-font.md
Created June 25, 2025 11:29
Matplotlib: using custom fonts (including emojis in colour), from a `.ttf` file

Matplotlib: using custom fonts (including emojis in colour), from a .ttf file

This is ridiculously difficult. This note is an attempt to record my findings.

There is no perfect solution (that I'm aware of), so the following demonstrates different trade-offs. I am writing this on MacOS, which I note as font behaviour can be OS-specific in subtle ways.

In this example I'm using the Twitter Color Emoji font as our external font.

Black and white, per-character