Skip to content

Instantly share code, notes, and snippets.

import numpy.random as npr
# Monte Carlo simulation code to estimate the probability that I had COVID
# back in February 2020. My flatmate had COVID almost certainly (he still doesn't
# have his sense of smell back and also got a positive antibody test about
# 6 months later). I had more ambiguous symptoms but was ill with something
# COVID like at the same time. How likely was it that I had COVID vs something
# unrelated?
# Please note that I am not a specialist in disease transmission and it is
A module for when you find modern numeric notation far too convenient to use
and want to go back to good old fashioned roman numerals.
You can import any numeral you like from here and it will work just fine.
>>> from numerals import IX, XVIIIII

Finding the shortlex predecessor

Problem: You have a DFA M and a string s that matches it. You want to find the shortlex-predecessor to s in the language matched by the DFA.


Create the P which matches all strings that are strictly shortlex smaller than s. Build the product DFA M' which intersects M with P, matching all strings matched by M that are shortlex predecessors of s.

Now annotate each state in M' with the length of the longest matching string starting from there (this is possible because there is an upper bound on the length of strings matched by M' and is easy to calculate recursively with dynamic programming because this means there are no loops in the DFA).

View data.jsons
This file has been truncated, but you can view the full file.
{"experiment": "sympy-1.1.1", "seed": 179540526898165123797060690791111459212044264363, "bug": ["TypeError", "/mnt/storage/SSD1/projects/tstl-hypothesis-experiments/.working/virtualenvs/sympy-1.1.1-dfca6c65a1/lib/python3.7/site-packages/sympy/core/", 90], "original": 45, "internal": {"result": 9, "calls": 1322}, "internal_delete_only:": {"result": 14, "calls": 239}, "external": {"result": 8, "calls": 36}}
{"experiment": "sympy-1.1.1", "seed": 52045884472328045539590115091521681625464858836, "bug": ["AssertionError", "/mnt/storage/SSD1/projects/tstl-hypothesis-experiments/.working/virtualenvs/sympy-1.1.1-dfca6c65a1/lib/python3.7/site-packages/sympy/core/", 3329], "original": 78, "internal": {"result": 9, "calls": 1247}, "internal_delete_only:": {"result": 18, "calls": 411}, "external": {"result": 16, "calls": 116}}
import sys
from hypothesis import given, strategies as st, settings, Verbosity, HealthCheck
from hypothesis.searchstrategy.featureflags import FeatureStrategy
import traceback
if __name__ == '__main__':
target = sys.argv[1]
with open(target) as i:
source =
import sys
from hypothesis import given, strategies as st, settings, Verbosity
if __name__ == '__main__':
target = sys.argv[1]
with open(target) as i:
source =
exec_globals = {}
View crasher.c
#include "csmith.h"
int16_t a;
int32_t volatile b;
static int32_t *c(uint8_t, uint32_t, uint16_t);
static uint32_t d();
int32_t e() {
uint32_t f[][1] = {1};
c(a, d(), f[0][0]);
return 0;
View crasher.c
#include "csmith.h"
int16_t c;
int32_t *d;
int32_t **e[];
static int32_t *f(uint8_t, uint32_t, uint16_t);
static uint32_t g();
static int32_t **h(int32_t *, int16_t);
int32_t i() {
uint32_t o[][1] = {};
f(c, g(), o[0][0]);
View crasher.c.orig
* Generator: csmith 2.3.0
* Git version: 30dccd7
* Options: (none)
* Seed: 5102155513851171502
#include "csmith.h"