Skip to content

Instantly share code, notes, and snippets.

View mcohen01's full-sized avatar

Michael Cohen mcohen01

View GitHub Profile
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
1 189 0 189 0 0 1 1 1 1 1 0 100 169 39 34
2 287 0 287 0 0 1 1 2 2 1 0 90 149.5 15 34
3 242 0 242 0 1 2 0 1 1 1 1 100 23.5 9 20
4 199 0 199 0 0 1 1 1 1 1 0 90 46 53 48
5 286 0 286 0 1 2 0 1 1 3 0 90 10 12 46
import re
import PyPDF2
from collections import defaultdict
import matplotlib.pyplot as plt
import warnings
import seaborn as sns
sns.set()
warnings.filterwarnings('ignore')

title: CS 519 Exercise 1 author: Michael Cohen date: 4/14/2018

fontsize: 12pt margin-left: 60pt margin-right: 60pt margin-bottom: 30pt margin-top: 20pt

from collections import Counter, defaultdict
from pandas import DataFrame, Series
import json
import seaborn
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import FuncFormatter, MaxNLocator
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
library(ggplot2)
observations <- 5
mu = 10
trials <- 100
confidence.interval <- function(threshold = .975, variance = 4) {
x <- rnorm(observations, mean = mu, sd = sqrt(variance))
df <- length(x) - 1
SE <- sd(x) / sqrt(length(x))
import websocket # pip install websocket_client
import _thread
import json
def main():
def on_open(ws):
def run(*args):
msg = {
'type': 'subscribe',
'product_ids': ['ETH-USD']
import hmac, hashlib, locale, math, time, requests, base64
from requests.auth import AuthBase
class CoinbaseExchangeAuth(AuthBase):
def __init__(self, api_key, secret_key, passphrase):
self.api_key = api_key
self.secret_key = secret_key
self.passphrase = passphrase
library(dplyr)
library(readr)
library(reshape2)
library(stringr)
library(ggplot2)
library(pdftools)
setwd('/Users/mcohen/Downloads/Scratch/codeplay/R/motogp/lap_times')
import boto.ec2
regions = {
'dev': ['us-east-1', 'us-west-2'],
'corp': ['us-east-1', 'us-west-2'],
'outside': ['us-west-1'],
'stage': ['us-east-1', 'us-west-2', 'ap-southeast-2'],
'prod': ['us-east-1', 'us-west-2', 'ap-southeast-2', 'sa-east-1', 'eu-west-1', 'ap-northeast-1', 'ap-southeast-1'],
}
region = 'dev'
for reg in regions[region]: