Skip to content

Instantly share code, notes, and snippets.

@RobinJadoul
RobinJadoul / flat_roots.sage
Last active September 11, 2023 00:12
Coppersmith + flatter, because sometimes you need the speed
# Based up https://github.com/defund/coppersmith
def flat_roots(f, bounds, m=1, d=None):
import itertools, subprocess
def dump(M):
return "[{}]".format("\n".join("[{}]".format(" ".join(map(str, r))) for r in M))
def parse_row(r):
return map(ZZ, r.split())
def parse(x):
@RobinJadoul
RobinJadoul / README.md
Created January 20, 2023 13:08
HEPL - a simple repl integration for the helix editor

HEPL

This is a simple repl integration for the helix editor. It relies on on tmux to show the repl in a separate pane and on jupyter (jupyter-console and whatever jupyter kernels you might like) to run the actual repl.

Features

  • Works with any jupyter kernel
  • Code is dedented to the highest common level, so you can send python code from the middle of a function to the repl too
  • No issues with multiline pieces of code or blank lines inside of a function body, it works as you'd expect it to
import sys, collections
try:
import rich.traceback, rich.console
console = rich.console.Console(file=sys.stderr)
def nice_traceback(_app, t, v, tb):
console.print(rich.traceback.Traceback.from_exception(t, v, tb))
except ImportError:
def nice_traceback(app, t, v, tb):
app.shell.excepthook(t, v, tb)

Keybase proof

I hereby claim:

  • I am RobinJadoul on github.
  • I am robin_jadoul (https://keybase.io/robin_jadoul) on keybase.
  • I have a public key whose fingerprint is DE65 874B 05CD 5438 74EF 75E3 C27C 2DD5 1108 8AF1

To claim this, I am signing this object: