Skip to content

Instantly share code, notes, and snippets.

@owstron
owstron / cs166_8-1.ipynb
Created March 4, 2019 15:17
CS166_8-1.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@owstron
owstron / cs166-6-2-dynamics_network-voter_model.py
Created February 20, 2019 15:16
The Pre-Class Work for CS166 6.2 Dynamics on networks class.
import matplotlib
matplotlib.use('TkAgg')
from pylab import *
import networkx as nx
import random as rd
def initialize():
global g, num_steps
g = nx.karate_club_graph()
g.pos = nx.spring_layout(g)
@owstron
owstron / 4-2-traffic_simulation.ipynb
Created February 11, 2019 15:59
4-2 Traffic_Simulation.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import matplotlib
matplotlib.use('TkAgg')
import pylab as PL
import random as RD
import scipy as SP
import numpy as NP
import requests as r
import sys
from datetime import datetime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine, Column, Integer, String, DateTime, Numeric
from sqlalchemy.orm import sessionmaker
#bash
'''
docker swarm init
rm(list=ls())
library('Matching')
library('MASS')
library('quantreg')
nswre74_control <- read.table("nswre74_control.txt")
nswre74_treated <- read.table("nswre74_treated.txt")
@owstron
owstron / CS112-8-2-q1-t-test.R
Last active March 8, 2018 18:11
CS112 8.2 Statistical Matching Pre-Classwork
# know your working directory:
getwd()
####### PART 1: Get the 2 RCT data sets...
# website with data is here: http://users.nber.org/~rdehejia/data/nswdata2.html
### For the original Lalonde data
# STEP 1: Download the two text files, nsw_control.txt and nsw_treated.txt
# STEP 2: Ensure that they are in R's working directory
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Made with Thimble</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Kanban Board</h1>
@owstron
owstron / lalonde-3-ways.R
Created February 18, 2018 06:02
Analysis of Lalonde data set using 3 different models. CS112 Lalonde 3 Ways assignment
library('Matching')
library(boot)
library(arm)
library(randomForest)
data(lalonde)
attach(lalonde)
# Normalizing the real earnings by dividing by 1000 dollars.
lalonde$re75 = lalonde$re75 / 1000
@owstron
owstron / edited-bankloans.sql
Created February 12, 2018 08:28
CS162 Session 6.1 Pre-Class Work. SQL Overview!
.mode column
CREATE TABLE Clients (
CLIENTNUMBER INT,
FIRSTNAME VARCHAR(20),
SURNAME VARCHAR(20),
EMAIL VARCHAR(100),
PHONE VARCHAR(20)
);