Skip to content

Instantly share code, notes, and snippets.

View daniel-j-h's full-sized avatar
🤗

Daniel J. H. daniel-j-h

🤗
View GitHub Profile
@daniel-j-h
daniel-j-h / 1-notes.md
Last active February 10, 2023 01:04
SMT Solvers and Constraint Programming

On Logic Solvers

From SAT to SMT and back.

There is a Gist, see references [@gist].

Satisfiability (SAT)

Is a given formula (i.e. $\lnot A \land (B \lor C)$) satisfiable?

@daniel-j-h
daniel-j-h / A-trees.py
Last active July 28, 2022 10:50
Trees with SQLAlchemy
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# http://docs.sqlalchemy.org/en/latest/orm/self_referential.html
import json
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, CheckConstraint
from sqlalchemy.orm import sessionmaker, relationship, backref
from sqlalchemy.ext.declarative import declarative_base
@daniel-j-h
daniel-j-h / z3bug.cc
Created June 24, 2015 15:56
Z3 issue: toStream gives different result as toInt conversion
#include <iostream>
#include <z3++.h>
int main() {
z3::config config;
z3::context context{config};
z3::optimize optimizer{context};
auto x = context.int_const("x");
@daniel-j-h
daniel-j-h / comparator.cc
Last active August 29, 2015 14:27
Proving the Strict Weak Ordering property
bool operator()(const InternalExtractorEdge &lhs, const InternalExtractorEdge &rhs) const
{
return (lhs.result.source < rhs.result.source) ||
((lhs.result.source == rhs.result.source) &&
(lhs.result.target < rhs.result.target));
}
set disassembly-flavor intel
@daniel-j-h
daniel-j-h / parallel-modernize.sh
Last active August 29, 2015 14:27
clang-modernize all the things (in parallel)
#!/usr/bin/env bash
git ls-files '*.cpp' | \
xargs -I{} -P $(nproc) clang-modernize -p build -final-syntax-check -format -style=file -summary -for-compilers=clang-3.4,gcc-4.8 -include . -exclude third_party {}
@daniel-j-h
daniel-j-h / default.yaml
Created August 18, 2015 21:53
default cncc style --- accept everything
unexposed_decl: '^.*$'
struct_decl: '^.*$'
union_decl: '^.*$'
class_decl: '^.*$'
enum_decl: '^.*$'
field_decl: '^.*$'
enum_constant_decl: '^.*$'
function_decl: '^.*$'
var_decl: '^.*$'
parm_decl: '^.*$'
@daniel-j-h
daniel-j-h / on.cc
Last active September 7, 2015 22:35
compare greater on age
#include <iostream>
#include <ostream>
#include <algorithm>
#include <iterator>
#include <functional>
#include <type_traits>
struct Person {
int age;
@daniel-j-h
daniel-j-h / warnings.txt
Created September 9, 2015 22:34
cmake .. -DCMAKE_BUILD_TYPE=Release -Wdev --warn-uninitialized --warn-unused-vars
CMake Warning (dev) in /tmp/osrm-backend/CMakeLists.txt:
unused variable (changing definition) 'CMAKE_CURRENT_SOURCE_DIR'
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in /tmp/osrm-backend/CMakeLists.txt:
unused variable (changing definition) 'CMAKE_CURRENT_BINARY_DIR'
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /tmp/osrm-backend/CMakeLists.txt:9 (project):
unused variable (out of scope) 'CMAKE_BINARY_DIR'
@daniel-j-h
daniel-j-h / on.cc
Created September 11, 2015 22:16
sortBy (greater `on` age)
#include <iostream>
#include <ostream>
#include <algorithm>
#include <iterator>
#include <functional>
#include <type_traits>
struct Person {
int id;
int age;