Skip to content

Instantly share code, notes, and snippets.

View 9thbit's full-sized avatar

Barry Hurley 9thbit

View GitHub Profile
@9thbit
9thbit / shufflecnf.py
Created December 12, 2014 14:25
Python code to shuffle a SAT instance in CNF format. Renames the variables, re-orders the clauses, and re-orders the literals in each clause.
from math import copysign
import random
import sys
import os
def shufflecnf(cnffilename, seed, outputfile):
random.seed(seed)
numvar, numclauses = None, None
@9thbit
9thbit / timing_existance_check_list_versus_set.py
Created September 15, 2016 08:32
Times checks for UUIDs in a large list versus a large set
from uuid import uuid4
import timeit
def build_uuid_list(num_uuids):
return [uuid4() for i in xrange(num_uuids)]
def main():
setup = """