This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib | |
matplotlib.use('Agg') | |
import matplotlib.pyplot as plt | |
import seaborn | |
import os | |
import re | |
import util | |
import pandas as pd | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division | |
import pandas as pd | |
import numpy as np | |
import scipy.optimize as sopt | |
def gradebook(): | |
grades = np.array([ | |
[100, 2.5], | |
[100, 2.5], | |
[100, 2.5], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import json | |
problem = None | |
fights = None | |
def mapit(st): | |
st = st.replace("T", "True").replace("F", "False").replace("{", "[") | |
st = st.replace("}", "]") | |
return st |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import pprint | |
from kwik import kwik | |
def data(): | |
games = [ | |
{ | |
'name': 'instructor_example', | |
'numOfPatrons': 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division | |
import timeit | |
import unittest | |
import datetime as dt | |
import marketsim as sim | |
from marketsim import compute_portfolio_stats | |
class Mc2P1Test(unittest.TestCase): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import sys | |
def convert(num): | |
bit_length = num.bit_length() | |
for x in reversed(range(bit_length)): | |
bit = (num >> x) & 1 | |
print("{0}".format(bit), end="") | |
print("") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create some data | |
x <- seq(0, 10, by=0.01) | |
y <- exp(1)^-x | |
df <- data.frame(x=x, y=y) | |
# Add some noise. | |
df$y <- jitter(df$y, amount=.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import matplotlib | |
import timeit | |
import optimization as opt | |
class TestMCP2(unittest.TestCase): | |
def test_runtime(self): | |
t = timeit.timeit("opt.optimize_portfolio()", | |
setup="import optimization as opt", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# set: ft=sh | |
set -e | |
setopt extendedglob | |
ROOT=/Applications/VMware\ Fusion.app/Contents/Library/ | |
if ! pwd | grep vmwarevm > /dev/null 2>&1; then | |
echo "Doesn't look like we're in a vmware image directory!" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import numpy as np | |
from stdev_code import stdev_p, stdev_s | |
class TestStdevCode(unittest.TestCase): | |
def setUp(self): | |
self.data = [] | |
for x in xrange(100): | |
self.data.append(np.random.uniform(0,50000000000,1000)) |