Skip to content

Instantly share code, notes, and snippets.

@PM2Ring
PM2Ring / tensegrity.py
Created August 30, 2024 15:17
Tensegrity twisted prism in 3D, using SageMath
# Tensegrity twisted prism. PM 2Ring 2024.08.31
def ball(radius, **kwargs):
var('u,v')
kw = dict(plot_points=40) | kwargs
return spherical_plot3d(radius, (u, 0, 2*pi), (v, 0, pi), **kw)
def axis_matrix(W):
a, b, c = W
if abs(c) == 1:
@PM2Ring
PM2Ring / BinaryOrbit.py
Created March 23, 2025 17:36
Plot binary orbits, with either body or the barycentre at the origin
""" Kepler binary orbit plot, using eccentric anomaly
Written by PM 2Ring 2023.10.05
"""
from functools import lru_cache
@lru_cache(int(3))
def kepler(ec, N):
""" Solve Kepler's equation for N equal timesteps """
out = []
@PM2Ring
PM2Ring / fonts.svg
Created May 19, 2025 08:11
Simple SVG font-family test
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PM2Ring
PM2Ring / GreekCrossanim.svg
Created May 23, 2025 18:25
Greek cross anim
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PM2Ring
PM2Ring / Liss2_5.svg
Created May 24, 2025 20:00
Lissajous SVG anim
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PM2Ring
PM2Ring / figure8.svg
Created August 10, 2025 18:26
Figure-8 orbit
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PM2Ring
PM2Ring / Penrose5.svg
Created October 3, 2025 06:05
Penrose tiling in SVG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PM2Ring
PM2Ring / chatjax.md
Last active December 20, 2025 19:35
New ChatJax bookmarklet

Here's my new version of the "Start Chatjax" bookmarklet.

javascript:(()=>{if(window.MathJax===undefined){const%20script=document.createElement("script");script.src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML";script.text='MathJax.Hub.Config({extensions:["tex2jax.js"],tex2jax:{inlineMath:[["$","$"],["\\\\\\\\\\\\(","\\\\\\\\\\\\)"]],displayMath:[["$$","$$"],["\\\\[","\\\\]"]],processEscapes:true},jax:["input/TeX","output/HTML-CSS"]});MathJax.Hub.Startup.onload();';document.head.append(script);(function%20doChatJax(){setTimeout(doChatJax,1000);MathJax.Hub.Queue(["Typeset",MathJax.Hub]);})();}else{MathJax.Hub.Queue(["Typeset",MathJax.Hub]);}})();

And here's the "Render Mathjax" bookmark. It's more efficient to use this version on static pages, like the Chat transcripts.

javascript:(()=>{if(window.MathJax===undefined){const%20script=document.createElement("script");script.src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?co