Skip to content

Instantly share code, notes, and snippets.

View jepler's full-sized avatar

Jeff Epler jepler

View GitHub Profile
# USB Set 1 X(Set 1) Set 2 X(Set 2) Set 3 X(Set 3) keycap
1 53 29 39 0e 29 0e 29 ` ~
2 30 2 41 16 2 16 2 1 !
3 31 3 3f 1e 3 1e 3 2 @
4 32 4 3d 26 4 26 4 3 #
5 33 5 3b 25 5 25 5 4 $
6 34 6 3c 2e 6 2e 6 5 % E
7 35 7 58 36 7 36 7 6 ^
8 36 8 64 3d 8 3d 8 7 &
9 37 9 44 3e 9 3e 9 8 *
from dataclasses import dataclass
import sympy
@dataclass
class ModifiableEquation:
"""Track the state of a system as one value is modified
The object is created with a sympy equality equation and the
diff --git a/coverage/sqldata.py b/coverage/sqldata.py
index 5e3d6790..2b5dae1f 100644
--- a/coverage/sqldata.py
+++ b/coverage/sqldata.py
@@ -126,15 +126,17 @@ class NumbitsUnionAgg:
"""SQLite aggregate function for computing union of numbits."""
def __init__(self) -> None:
- self.result = b""
+ self.result = 0
import math
N = 23442210895296466551510681543619831978102581799736611246976521590191893224135789025070678051976867349306593332331728775086731364111282889875974451560408740146015934986990476214270640086817425581538170373870259313066583768903697048280641467367411589939100414611356011513397978038218669709747247868727724676001584905770525234976669382895464232871732123454572174833964467804115311936850586791492844973560905229429892438926204188174490543755080972621652831650930277431113028745929593171025639518249955921255776393078247519734666509055776152948501360345202224227559964438653352949732541506721438058592990053089448078211591
sqrt_n = math.isqrt(N)
for p in range(sqrt_n - 10, sqrt_n):
if N % p == 0:
q = N // p
print(p)
# m68k-micropython window creation demo
import eventmgr
import mactypes
import qd
import uctypes
import windowmgr
def let(dst, src):
memoryview(dst)[:] = memoryview(src)[:]
import array
import time
import math
import audiosdl
import synthio
sine = array.array('h',
(int(math.sin(i * 2 * math.pi / 1024) * 32000) for i in range(1024)))
print(min(sine), max(sine))
import array
import time
import math
import audiosdl
import synthio
sine = array.array('h',
(int(math.sin(i * 2 * math.pi / 1024) * 32000) for i in range(1024)))
print(min(sine), max(sine))
import array
import time
import math
import audiosdl
import synthio
sine = array.array('h',
(int(math.sin(i * 2 * math.pi / 1024) * 32000) for i in range(1024)))
print(min(sine), max(sine))
OW = 249;
OH = OW;
pin_dx = 41;
pin_dy = 55;
screw_dy = 45;
screw_dx = 56;
aperture = 128 - 24;
import time
import subprocess
import contextlib
@contextlib.contextmanager
def TerminatingPopen(*args, **kw):
p = subprocess.Popen(*args, **kw)
try:
yield p
finally: