Skip to content

Instantly share code, notes, and snippets.

@vedantk
vedantk / nqueens.py
Created December 19, 2010 08:31
A solution to N-Queens using the Min-Conflicts local search algorithm
#!/usr/bin/python
# A solution to N-Queens using the Min-Conflicts local search algorithm
# Vedant Kumar <vminch@gmail.com>
import random
def nqueens(nr):
show(min_conflicts(list(range(nr)), nr), nr)
def show(soln, nr):
@socantre
socantre / foil_optimizer.cpp
Last active August 11, 2019 17:36
CppCon 2015: Chandler Carruth "Tuning C++: Benchmarks, and CPUs, and Compilers! Oh My!" functions to disable compiler optimization
static void escape(void *p) {
asm volatile("" : : "g"(p) : "memory");
}
static void clobber() {
asm volatile("" : : : "memory");
}