Skip to content

Instantly share code, notes, and snippets.


David Fernig davefernig

View GitHub Profile
from __future__ import division
from random import randint
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
N_VALUES = [2**n for n in (range(10))]
View statcan
# Before executing this script, run the following in your terminal:
# virtualenv .
# source bin/activate
# pip install beautifulsoup4
from bs4 import BeautifulSoup
import urllib2
path = ""
View numpy array to string and back
def __numpy_to_string(A):
return A.tostring().hex()
def __string_to_numpy(S):
return np.frombuffer(bytes.fromhex(S), dtype=np.float32)
davefernig / dpll
Last active Apr 12, 2021
Full code for solving SAT in Python
View dpll
import seaborn as sns
import pandas as pd
import pylab as plt
import numpy as np
import itertools
import random
import time
def brute_force(cnf):
View perudo-script
A tool to calculate probabilities in Perudo.
David Fernig, 2018
from __future__ import division
import scipy.special
class Round(object):
davefernig /
Last active Aug 11, 2017
set up data science tools on ubuntu on gce
#### commands to provision the instance ####
# install gcc and make
sudo apt-get update
sudo apt-get install gcc
sudo apt-get install build-essential
# install python3; pip
sudo apt-get install python3-setuptools
sudo apt-get install python3-tk