Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python3
# (c) Martin von Gagern 2014
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@gagern
gagern / mx4488948.txt
Last active July 16, 2022 14:08
Assigning card suits to 𝔽₃ℙ²
https://math.stackexchange.com/a/4493218/35416
For each of the 52 incidences (columns), this table
shows the line coordinates, point coordinates, and
352 different suite assignments. The first 8 of
these have a 13-fold symmetry, the others don't.
0000000000000000111111111111111111112222222222222222
0000111111112222000000001111111122220000111111112222
1111000011111111000011110000111111111111000011111111
This file has been truncated, but you can view the full file.
https://math.stackexchange.com/q/4141558/35416
0 = (-d + R)*a^2
+ (-2*L)*a
+ (-d + R)
or
0 = (-c + L)*a^2
+ (-c - L)
https://math.stackexchange.com/a/4134048/35416
0 = (4*h^2 - 8*h*R + 4*R^2)*N^4
+ (-4*b^2*h - 4*e^2*h + 4*f^2*h - 12*h^3 + 4*b^2*R + 4*e^2*R - 4*f^2*R + 36*h^2*R - 40*h*R^2 + 16*R^3)*N^3
+ (b^4 + 2*b^2*e^2 + e^4 + 2*b^2*f^2 - 2*e^2*f^2 + f^4 + 16*b*e*f*h + 10*b^2*h^2 + 14*e^2*h^2 - 10*f^2*h^2 + 13*h^4 - 16*b*e*f*R - 20*b^2*h*R - 28*e^2*h*R + 20*f^2*h*R - 52*h^3*R + 8*b^2*R^2 + 16*e^2*R^2 - 12*f^2*R^2 + 88*h^2*R^2 - 72*h*R^3 + 24*R^4)*N^2
+ (-8*b*e^3*f - 2*b^4*h - 6*e^4*h - 4*b^2*f^2*h - 2*f^4*h - 24*b*e*f*h^2 - 8*b^2*h^3 - 12*e^2*h^3 + 8*f^2*h^3 - 6*h^5 + 2*b^4*R + 6*e^4*R + 4*b^2*f^2*R + 2*f^4*R + 48*b*e*f*h*R + 24*b^2*h^2*R + 36*e^2*h^2*R - 24*f^2*h^2*R + 30*h^4*R - 24*b*e*f*R^2 - 20*b^2*h*R^2 - 44*e^2*h*R^2 + 28*f^2*h*R^2 - 68*h^3*R^2 + 4*b^2*R^3 + 20*e^2*R^3 - 12*f^2*R^3 + 84*h^2*R^3 - 56*h*R^4 + 16*R^5)*N
+ (b^4*e^2 - 2*b^2*e^4 + e^6 + 2*b^2*e^2*f^2 + 2*e^4*f^2 + e^2*f^4 + 8*b*e^3*f*h + b^4*h^2 + 3*e^4*h^2 + 2*b^2*f^2*h^2 + f^4*h^2 + 8*b*e*f*h^3 + 2*b^2*h^4 + 3*e^2*h^4 - 2*f^2*h^4 + h^6 - 8*b*e^3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gagern
gagern / CodeList.html
Created June 22, 2020 12:27
Hoedown code list issue
<p>Original problem:</p>
<ol>
<li><p>First item.</p></li>
<li><pre><code>Some code.
More code.
</code></pre>
<p>There is code here.</p></li>
</ol>
@gagern
gagern / switches.py
Last active June 2, 2020 10:16
Spinning switches
#!/usr/bin/python3
# https://github.com/shainer/spinning-switches citing a problem from
# “So you think you've got problems?” by Alex Bellos.
# This is optimizing for minimum number of operations in the worst case.
def allrot(x):
return [((x << i) | (x >> (4 - i))) & 0b1111 for i in range(4)]
def normal(x):
@gagern
gagern / gist:8256742
Created January 4, 2014 15:55
Dump GPG packet data, public key in particular
import sys
import subprocess
import io
class PacketReader(object):
packetTagNames = {
0: 'Reserved - a packet tag MUST NOT have this value',
1: 'Public-Key Encrypted Session Key Packet',
2: 'Signature Packet',
This file has been truncated, but you can view the full file.
dpkg-buildpackage -us -uc -ui -i -b
dpkg-buildpackage: info: source package sagemath
dpkg-buildpackage: info: source version 8.8-1~mvg1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Martin von Gagern <Martin.vGagern@gmx.net>
dpkg-source -i --before-build .
dpkg-buildpackage: info: host architecture amd64
dpkg-source: info: using options from sagemath/debian/source/options: --tar-ignore=debian/ccache --extend-diff-ignore=^(sage/m4/sage_spkg_configures.m4)
debian/rules clean
dh clean --with=python2,sphinxdoc
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleIdentifier</key>
<string>net.von-gagern.UsbWorkaround</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>