Skip to content

Instantly share code, notes, and snippets.

@davidbau
davidbau / runningstats.py
Last active December 10, 2025 00:17
Running stats objects for pytorch: mean, variance, covariance, second-moment, quantiles, topk, and combinations.
'''
To use a runningstats object,
1. Create the the desired stat object, e.g., `m = Mean()`
2. Feed it batches via the add method, e.g., `m.add(batch)`
3. Repeat step 2 any number of times.
4. Read out the statistic of interest, e.g., `m.mean()`
Built-in runningstats objects include:
@douglasmiranda
douglasmiranda / pdf-to-svg.md
Last active November 20, 2025 13:53
About PDF to SVG converters

Update in 2024

In 2024 I'm actually having a good time using mupdf.

About my experience with mupdf:

It's written in C, but you can use it in many ways. Command line, python lib (pymupdf), js, and others.

I still coundn't find issues that I had with other tools and weird broken PDFs, so I'd say pretty good.