Skip to content

Instantly share code, notes, and snippets.

View jweissbock's full-sized avatar

Joshua Weissbock jweissbock

View GitHub Profile
from bs4 import BeautifulSoup
import requests
import re
def getYearIDs(year):
pass
def writeLine(fileName, listOfLists):
pass
@jweissbock
jweissbock / montecarlo.py
Last active December 20, 2015 11:48
Monte Carlo for calculating the st.dev of an all skill NHL league
import csv, random, math
# STuff do once
schedule = []
n = 10000
avgsd = 0.0
pskill = 24 #percent skill
# store the schedule
@jweissbock
jweissbock / dailyData.py
Created April 24, 2013 01:53
Gets the data daily for the teams before and after the games. getData.py was set up as a cron job and was able to figure out which information to grab from each team, bit of a hack job dailyData.py gets the data and stats for each team before the game, normally you would pass a list of teams via command line dailyScores.py gets the scores of the…
from bs4 import BeautifulSoup
import urllib2
import csv
import datetime
import sys
"""teams = ['Washington', 'Boston', 'NY Rangers', 'Pittsburgh', 'Ottawa', 'Buffalo', 'Minnesota', 'Colorado', 'Winnipeg', 'Toronto', 'Montreal',
'New Jersey', 'Carolina', 'Tampa Bay', 'Phoenix', 'Columbus', 'NY Islanders', 'Florida', 'Anaheim', 'St Louis', 'Chicago',
'Dallas', 'Detroit', 'Vancouver', 'San Jose', 'Los Angeles']"""
@jweissbock
jweissbock / app.py
Created April 2, 2013 04:17
1 function in my flask file
@app.route('/saveGame')
def saveGame():
n = 6# n = depending on how many items we are saving per puck
msg = "Not working yet."
# check if number - 2 % n = 0 to see if has right # parameters
if ((len(request.args) - 2) % n > 0):
json.dumps([{ 'success' : False, 'msg' : 'Invalid number of arguements.' }])
args = sorted(request.args)
#print args
# need to check if these are valid
@jweissbock
jweissbock / settlers.py
Created March 29, 2013 01:45
Pioneers of Katan
import pygame, sys, random, math
from pygame.locals import *
# set up game
pygame.init()
mainClock = pygame.time.Clock()
# create window
WINDOWWIDTH = 600
WINDOWHEIGHT = 600
data = [[1, 1200, [u'24', u'28', u'93', u'5', u'8', u'30'], [u'87', u'9', u'14', u'7', u'44', u'92']], [1, 1200, [u'24', u'28', u'93', u'5', u'8', u'30'], [u'87', u'9', u'14', u'7', u'44', u'92']], [1, 1171, [u'24', u'28', u'93', u'5', u'8', u'30'], [u'87', u'9', u'14', u'7', u'44', u'92']], [1, 1155, [u'14', u'9', u'24', u'22', u'44', u'30'], [u'71', u'18', u'24', u'7', u'58', u'92']], [1, 1125, [u'14', u'25', u'9', u'22', u'44', u'30'], [u'71', u'18', u'24', u'2', u'58', u'92']], [1, 1122, [u'14', u'25', u'9', u'22', u'44', u'30'], [u'71', u'18', u'24', u'2', u'58', u'92']], [1, 1122, [u'10', u'48', u'17', u'27', u'29', u'30'], [u'16', u'48', u'19', u'5', u'41', u'92']], [1, 1084, [u'10', u'48', u'17', u'27', u'29', u'30'], [u'16', u'48', u'19', u'5', u'41', u'92']], [1, 1078, [u'10', u'48', u'17', u'27', u'29', u'30'], [u'16', u'48', u'19', u'5', u'41', u'92']], [1, 1078, [u'36', u'12', u'26', u'5', u'8', u'30'], [u'46', u'27', u'10', u'5', u'58', u'92']], [1, 1075, [u'36', u'12', u'26', u'5', u'8', u'30']
@jweissbock
jweissbock / play.py
Created March 28, 2012 01:06
Scrape TimeOnIce.com
import urllib2
from bs4 import BeautifulSoup
import datetime
start = datetime.datetime.now()
teams = ["MIN", "MTL", "N.J", "NSH", "NYI", "NYR",
"OTT", "PHI", "PHX", "PIT", "S.J", "STL", "T.B", "TOR", "VAN", "WSH"]
seasons = ["0809", "0910", "1011"]
@jweissbock
jweissbock / settlers.py
Created November 15, 2011 01:22
PyGame Settlers of Catan
import pygame, sys, random, math
from pygame.locals import *
# set up game
pygame.init()
mainClock = pygame.time.Clock()
# create window
WINDOWWIDTH = 600
WINDOWHEIGHT = 600
@jweissbock
jweissbock / Jack-Hack VM.py
Created February 4, 2011 00:32
the VM to turn Jack VM into Hack ASM
import glob
# declare types of commands
C_ARITMETIC = object()
C_PUSH = object()
C_POP = object()
C_LABEL = object()
C_GOTO = object()
C_IF = object()
C_FUNCTION = object()
@jweissbock
jweissbock / gist:803500
Created January 31, 2011 01:00
HACK Assembler
# we need our imports
import string, sys
# global hash table
hashTable = {}
RAMstart = 16 # variables are stored in RAM[16] to... RAM[255]??
# parse the assembly
def Assembler(filename):
# define the variables we need to