Skip to content

Instantly share code, notes, and snippets.

View andrecunha's full-sized avatar

Andre Cunha andrecunha

View GitHub Profile
@andrecunha
andrecunha / gunicorn
Last active August 29, 2015 14:14 — forked from suda/gunicorn
#!/bin/sh
### BEGIN INIT INFO
# Provides: gunicorn
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the gunicorn server
# Description: starts gunicorn using start-stop-daemon
@andrecunha
andrecunha / sudoku.py
Created December 1, 2014 19:03
Solve an n x m Sudoku puzzle using the Z3 theorem prover (http://z3.codeplex.com/) as backend.
#!/usr/bin/env python
from __future__ import print_function, unicode_literals
from sys import argv
import z3
def parse_spec(n, m):
sdk_spec = {}
for row in range(n * m):
line = raw_input()
@andrecunha
andrecunha / nltk_to_tikz.py
Created August 26, 2014 17:55
Convert NLTK dependency graph to Tikz drawing
def as_tikz_graph(graph):
"""Converts an nltk.parse.dependencygraph.DependencyGraph object to a Tikz
drawing.
:graph: An NLTK dependency graph.
:returns: A string containing the LaTeX code to draw the graph with the
tikz-dependency package.
"""
nodes = graph.nodelist