Skip to content

Instantly share code, notes, and snippets.

@asmeurer
asmeurer / Array API Tests Example JSON Report
Last active September 7, 2022 19:15
Array API Tests Example JSON Report
Example JSON reports for the array API tests (see https://github.com/data-apis/array-api-tests/pull/131).
from typing import List, TypeVar
from docutils import nodes
from docutils.nodes import Element
from sphinx import addnodes
from sphinx.application import Sphinx
from sphinx.environment.adapters.toctree import TocTree
import sphinx.environment.collectors.toctree as toctree_collector
from sphinx.transforms import SphinxContentsFilter
@asmeurer
asmeurer / WGAC AA pygments styles
Last active June 3, 2022 02:55
WGAC AA pygments styles
# Making WCAG AA compliant pygments themes with better color contrast
The WCAG AA standard requires colors to have at least 4.5 contrast ratio
against their background. Most pygments styles do not follow this, but with
some (usually small) modifications, they can.
This process is a little hacky, but it works. It would be better to convert
this whole process into a single Python script/library, but I got the themes I
care about. If anyone else wants to do that, please do so. Here are the steps
I used
@asmeurer
asmeurer / svg2pdf.bash
Last active August 18, 2023 12:02 — forked from s417-lama/svg2pdf.bash
Reliable way to convert an SVG file to a PDF file using headless Chrome
#!/bin/bash
#
# Convert an SVG file to a PDF file by using headless Chrome.
#
if [ $# -ne 2 ]; then
echo "Usage: ./svg2pdf.bash input.svg output.pdf" 1>&2
exit 1
fi
conda-forge/noarch::absl-py-0.15.0-pyhd8ed1ab_0
conda-forge/noarch::alabaster-0.7.12-py_0
conda-forge/osx-64::appnope-0.1.2-py39h6e9494a_1
conda-forge/noarch::attrs-21.2.0-pyhd8ed1ab_0
conda-forge/osx-64::awkward1-0.4.5-py39he45765d_0
conda-forge/noarch::babel-2.9.1-pyh44b312d_0
conda-forge/noarch::backcall-0.2.0-pyh9f0ad1d_0
conda-forge/noarch::backports-1.0-py_2
conda-forge/noarch::backports.functools_lru_cache-1.6.4-pyhd8ed1ab_0
conda-forge/noarch::beautifulsoup4-4.10.0-pyha770c72_0
conda-forge/noarch::absl-py-0.15.0-pyhd8ed1ab_0
conda-forge/noarch::alabaster-0.7.12-py_0
conda-forge/osx-64::appnope-0.1.2-py39h6e9494a_1
conda-forge/noarch::attrs-21.2.0-pyhd8ed1ab_0
conda-forge/osx-64::awkward1-0.4.5-py39he45765d_0
conda-forge/noarch::babel-2.9.1-pyh44b312d_0
conda-forge/noarch::backcall-0.2.0-pyh9f0ad1d_0
conda-forge/noarch::backports-1.0-py_2
conda-forge/noarch::backports.functools_lru_cache-1.6.4-pyhd8ed1ab_0
conda-forge/noarch::beautifulsoup4-4.10.0-pyha770c72_0
Running from numpy source directory.
Cythonizing sources
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_philox.pyx
Processing numpy/random/_bounded_integers.pyx.in
Processing numpy/random/_sfc64.pyx
Processing numpy/random/_mt19937.pyx
Processing numpy/random/bit_generator.pyx
Processing numpy/random/mtrand.pyx
Processing numpy/random/_generator.pyx
Running from numpy source directory.
Cythonizing sources
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_philox.pyx
Processing numpy/random/_bounded_integers.pyx.in
Processing numpy/random/_sfc64.pyx
Processing numpy/random/_mt19937.pyx
Processing numpy/random/bit_generator.pyx
Processing numpy/random/mtrand.pyx
Processing numpy/random/_generator.pyx
Running from numpy source directory.
Cythonizing sources
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_philox.pyx
Processing numpy/random/_bounded_integers.pyx.in
Processing numpy/random/_sfc64.pyx
Processing numpy/random/_mt19937.pyx
Processing numpy/random/bit_generator.pyx
Processing numpy/random/mtrand.pyx
Processing numpy/random/_generator.pyx
# packages in environment at /Users/aaronmeurer/anaconda3:
#
# Name Version Build Channel
abseil-cpp 20210324.0 he49afe7_0 conda-forge
absl-py 0.13.0 pyhd8ed1ab_0 conda-forge
aiobotocore 1.3.1 pyhd8ed1ab_0 conda-forge
aiohttp 3.7.4 py38h96a0964_0 conda-forge
aioitertools 0.7.1 pyhd8ed1ab_0 conda-forge
alabaster 0.7.12 py_0 conda-forge
antlr 4.8 0 conda-forge