Skip to content

Instantly share code, notes, and snippets.

View aeporreca's full-sized avatar

Antonio E. Porreca aeporreca

View GitHub Profile
@aeporreca
aeporreca / sat.py
Last active October 9, 2024 11:03
4-line (6-line if counting imports) SAT solver using the nondeterminism Python library
# nondeterminism library: https://github.com/aeporreca/nondeterminism
from collections import defaultdict
from nondeterminism import nondeterministic, guess
# SAT solver
@nondeterministic
def satisfiable(formula):
@aeporreca
aeporreca / test.tex
Last active October 2, 2023 17:34
Using 💪 (or any other emoji) as QED symbol in LaTeX under macOS (compile with LuaLaTeX)
% Code inspired by https://tex.stackexchange.com/q/520968
% Compile with LuaLaTeX (or, I think, XeLaTeX if you don't need Harfbuzz)
\documentclass{article}
\usepackage{fontspec}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\newfontfamily{\emoji}{Apple Color Emoji}[Renderer=Harfbuzz]
% I think it's just \newfontfamily{\emoji}{FontName} for other fonts
@aeporreca
aeporreca / graphiso.py
Last active August 7, 2020 09:39
Random graph isomorphism testing via a SAT solver (CryptoMiniSat 5)
#!/usr/bin/env python3
from pycryptosat import Solver
from itertools import product
from argparse import ArgumentParser
from random import randrange, sample
from timeit import default_timer as timer
class Graph: