Skip to content

Instantly share code, notes, and snippets.

View jameskyle's full-sized avatar

James Kyle jameskyle

View GitHub Profile
import numpy as np
a = np.ones(shape=(1e9,), dtype=int)
print(a.shape)
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
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],
#!/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
import unittest
import pprint
from kwik import kwik
def data():
games = [
{
'name': 'instructor_example',
'numOfPatrons': 2,
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
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("")
# 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)
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",
#!/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