Skip to content

Instantly share code, notes, and snippets.

View jepler's full-sized avatar

Jeff Epler jepler

View GitHub Profile
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:
--- fbmirror_scaled_tmp.py.orig 2025-02-10 09:27:49.407999983 -0600
+++ fbmirror_scaled_tmp.py 2025-02-10 15:21:41.577745068 -0600
@@ -47,11 +47,12 @@
@click.option("--x-offset", "xoffset", type=int, help="The x offset of top left corner of the region to mirror", default=0)
@click.option("--y-offset", "yoffset", type=int, help="The y offset of top left corner of the region to mirror", default=0)
@click.option("--scale", "scale", type=int, help="The scale factor to reduce the display down by.", default=3)
-@piomatter_click.standard_options
-def main(xoffset, yoffset, scale, width, height, serpentine, rotation, colorspace, pinout, n_planes, n_addr_lines):
+@piomatter_click.standard_options(colorspace=None)
+def main(xoffset, yoffset, scale, width, height, serpentine, rotation, pinout, n_planes, n_addr_lines):
diff --git a/ports/raspberrypi/common-hal/microcontroller/__init__.c b/ports/raspberrypi/common-hal/microcontroller/__init__.c
index 7911c21e3c..971c1db9ef 100644
--- a/ports/raspberrypi/common-hal/microcontroller/__init__.c
+++ b/ports/raspberrypi/common-hal/microcontroller/__init__.c
@@ -23,11 +23,13 @@
#include "src/rp2_common/hardware_sync/include/hardware/sync.h"
#include "hardware/watchdog.h"
+#include "hardware/irq.h"