Skip to content

Instantly share code, notes, and snippets.

View bgrenet's full-sized avatar

Bruno Grenet bgrenet

View GitHub Profile
@bgrenet
bgrenet / xopp2pdf.py
Created November 9, 2023 20:35
Export xournal++ file to pdf, preserving bookmarks, pdf links, etc.
#!/usr/bin/env python3
import gzip
import xml.etree.ElementTree as ET
import subprocess
import argparse
import sys
import pathlib
import tempfile
@bgrenet
bgrenet / md2ipynb.py
Created February 2, 2017 15:00
(Extremely basic) Python script to create jupyter notebooks from markdown
#! /usr/bin/env python3
############################################################################
# #
# (Extremely basic) Python script to create jupyter notebook from markdown #
# Bruno Grenet, 02.02.2017 #
# License: Public Domain #
# #
############################################################################
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bgrenet
bgrenet / PolyRings.md
Last active August 29, 2016 14:17
New polynomial ring categories

Basic problem

Classes for univariate polynomial (elements) need refactoring. Some reasons are:

  1. Some classes are missing, such as for instance a generic class for polynomials over finite fields (only specialized class for some given implementation are provided).
  2. We need more abstract classes. To date, many classes directly inherit from the generic class Polynomial since (for instance) the class Polynomial_generic_dense is concrete and thus fixes some data structure. Polynomials based on (say) Flint cannot use this data structure.
  3. Based on the above, it seems useful for a polynomial class to support multiple inheritance. For instance, a class for sparse polynomials over ZZ should inherit both from a class for sparse polynomials, and a class for ZZ. This is impossible with Cython (which does not support multiple inheritance).
  4. A consequence is also that many classes are directly in the class Polynomial with long spaghetti code made of tons of if ...: ... else: ... constructions
Compiling essai.spyx...
Traceback (most recent call last):
File "/home/bruno/Software/sage/src/bin/sage-run-cython", line 8, in <module>
s = load_cython(sys.argv.pop(1))
File "/home/bruno/Software/sage/local/lib/python2.7/site-packages/sage/repl/load.py", line 65, in load_cython
mod, dir = cython(name, compile_message=True, use_cache=True)
File "/home/bruno/Software/sage/local/lib/python2.7/site-packages/sage/misc/cython.py", line 477, in cython
raise RuntimeError("Error compiling {}:\n{}\n{}".format(filename, log, err))
RuntimeError: Error compiling essai.spyx:
running build