stateDiagram
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// eslinted; send wakeonlan magic packet for mac address defined in m | |
// | |
const m = Buffer.from([0x9c, 0x6b, 0x00, 0x15, 0xbd, 0xc2]); | |
const p = Buffer.concat([Buffer.alloc(6,0xff),m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m]); | |
const sock = require('dgram').createSocket('udp4').on('listening', function() { | |
sock.setBroadcast(true); | |
sock.send(p, 0, p.length, 9, '255.255.255.255', function() { | |
sock.close(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
wget -O /tmp/all.txt https://t5k.org/primes/lists/all.txt 2> /dev/null | |
if [ ! -f t5k.org_primes_lists_all.txt ] | |
then | |
echo "initial download of largest primes list" | |
cp /tmp/all.txt t5k.org_primes_lists_all.txt | |
fi | |
if [ ! -f t5k.org_primes_lists_all.txt.old ] |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// x,y -> sqrtm1 [-> x,y] | |
// | |
// https://t5k.org/primes/lists/all.txt | |
// 2147 10^999999+308267*10^292000+1 1000000 CH10 2021 | |
// | |
// f=sqrtm1.smallest_known_1million_digit_prime | |
// | |
// either | |
// g++ $f.cc -lgmp -lgmpxx -O3 -o $f | |
// or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sympy import gcd, I | |
try: | |
import cypari2 | |
pari = cypari2.Pari() | |
gen_to_python = cypari2.convert.gen_to_python | |
except ImportError: | |
cypari2 = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pylint:disable=C0103, C0114, C0116, W0611 | |
from math import sqrt, floor, pi, e | |
from sympy import nextprime, isprime | |
def digits(n): | |
return len(str(n)) | |
phi = (sqrt(5) + 1) / 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\\ sq2(p) determines sum of squares for prime p = 1 (mod 4), implement "assert()" | |
\\ | |
\\ based on | |
\\ - https://pari.math.u-bordeaux.fr/Events/PARI2019b/talks/init.pdf | |
\\ - https://pari.math.u-bordeaux.fr/Events/PARI2019b/talks/prog.pdf | |
\\ - https://pari.math.u-bordeaux.fr/pub/pari/manuals/2.15.1/tutorial.pdf | |
\\ - https://skalatan.de/en/archive/pariguide/doc/Programming_under_GP.html | |
\\ - https://home.gwu.edu/~maxal/gpscripts/binomod.gp | |
\\ | |
assert(b, v, s) = { if(!(b), error(Str(v) Str(s))); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
pip install setuptools Cython gmpy2 | |
rm -rf /tmp/tst && mkdir /tmp/tst && cd /tmp/tst | |
wget -q https://gist.githubusercontent.com/Hermann-SW/061d33b47325bd15a4033b33d3f7c4c9/raw/9900616d98b6acdd50c436d9ae914a1c5d81f2b2/sq2_cg.py | |
mv sq2_cg.py sq2_cg.pyx | |
cat << EOF > setup.py | |
from setuptools import setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
sq2_sympy.py from here (plus time print() in "sq2()"): | |
https://github.com/sympy/sympy/issues/15358#issuecomment-1551635777 | |
2.5GHz i7-11850H | |
1998.6601960659027s a = sqrt(-1) (mod p) | |
2011.4160270690918s x, y = gcd(p, a + I).as_real_imag() | |
""" | |
from math import log10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pylint: disable=C0103 | |
# invalid-name | |
""" | |
determine sum of squares for 2467-digit prime | |
- minimized for pycg analysis | |
- original: https://github.com/Hermann-SW/RSA_numbers_factored/blob/main/python/sq2.py | |
- manually converted to Graphviz with splines=ortho | |
- shortened GraphvizFiddle Share link: https://stamm-wilbrandt.de/sq2_cg.py.gvf.html | |
""" | |
from time import time |