Skip to content

Instantly share code, notes, and snippets.

Avatar

Aaron Meurer asmeurer

View GitHub Profile
View cospi257
>>> from sympy.functions.elementary.trigonometric import _cospi257
>>> expr = _cospi257()
>>> expr
sqrt(sqrt(2)*sqrt(-sqrt(-2*sqrt((-sqrt(257)/8 - sqrt(-4*sqrt(257) + (-sqrt(257)/4 - 1/4 + sqrt(64 + (-sqrt(257)/2 - 1/2)**2)/2)**2 + 16 + 4*sqrt(64 + (-sqrt(257)/2 - 1/2)**2))/2 - 1/8 + sqrt(64 + (-sqrt(257)/2 - 1/2)**2)/4)**2 + 2*sqrt(-4*sqrt(257) + (-sqrt(257)/4 - 1/4 + sqrt(64 + (-sqrt(257)/2 - 1/2)**2)/2)**2 + 16 + 4*sqrt(64 + (-sqrt(257)/2 - 1/2)**2)) + 4 + 2*sqrt(-4*sqrt(257) - 4*sqrt(64 + (-sqrt(257)/2 - 1/2)**2) + 16 + (-sqrt(64 + (-sqrt(257)/2 - 1/2)**2)/2 - sqrt(257)/4 - 1/4)**2) + 2*sqrt((-1/2 + sqrt(257)/2)**2 + 64) + 4*sqrt(-4*sqrt((-1/2 + sqrt(257)/2)**2 + 64) + (-sqrt((-1/2 + sqrt(257)/2)**2 + 64)/2 - 1/4 + sqrt(257)/4)**2 + 16 + 4*sqrt(257)) + 2*sqrt(257)) - sqrt(16 + 4*sqrt((-1/2 + sqrt(257)/2)**2 + 64) + 4*sqrt(257) + (-1/4 + sqrt(257)/4 + sqrt((-1/2 + sqrt(257)/2)**2 + 64)/2)**2) - 2*sqrt(-2*sqrt(257) - 2*sqrt(16 + 4*sqrt((-1/2 + sqrt(257)/2)**2 + 64) + 4*sqrt(257) + (-1/4 + sqrt(257)/4 + sqrt
@asmeurer
asmeurer / Array API Tests Example JSON Report
Last active Sep 7, 2022
Array API Tests Example JSON Report
View 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).
View sphinx-toctree-signature.py
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 Jun 3, 2022
WGAC AA pygments styles
View 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 May 17, 2022 — forked from s417-lama/svg2pdf.bash
Reliable way to convert an SVG file to a PDF file using headless Chrome
View svg2pdf.bash
#!/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
View conda list -c
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
View conda list -c
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
View NumPy build log (system clang)
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
View NumPy build log
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
View gist:40754d1a4429449e1d558e003caa1860
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