Skip to content

Instantly share code, notes, and snippets.

View textbook's full-sized avatar

Jonathan Sharpe textbook

View GitHub Profile
@textbook
textbook / MidTerm2.py
Created December 13, 2012 09:58
MIT 6.00x - MidTerm2 answers by jonrsharpe
# Problem 4-2
class edXPerson(Person):
nextIdNum = 0
def __init__(self, name):
Person.__init__(self, name)
self.idNum = edXPerson.nextIdNum
edXPerson.nextIdNum += 1
def getIdNum(self):
return self.idNum
def __lt__(self, other):
@textbook
textbook / ProblemSet8.py
Created December 13, 2012 09:49
MIT 6.00x - PSet 8 answers by jonrsharpe
# Problem 2: SimpleVirus and Patient
class SimpleVirus(object):
def __init__(self, maxBirthProb, clearProb):
self.maxBirthProb = maxBirthProb
self.clearProb = clearProb
def getMaxBirthProb(self):
return self.maxBirthProb
@textbook
textbook / ProblemSet7.py
Created November 27, 2012 11:08
MIT 6.00x - PSet 7 answers by jonrsharpe
# 1. RectangularRoom
class RectangularRoom(object):
def __init__(self, width, height):
self.width, self.height = width, height
self.tiles = dict(((x, y), 0) for x in range(width) for y in range(height))
def cleanTileAtPosition(self, pos):
self.tiles[(int(pos.x), int(pos.y))] += 1
def isTileCleaned(self, m, n):
@textbook
textbook / ProblemSet6.py
Created November 15, 2012 11:02
MIT 6.00x - PSet 6 answers by jonrsharpe
# 1. NewsStory
class NewsStory(object):
def __init__(self, guid, title, subject, summary, link):
self.guid = guid
self.title = title
self.subject = subject
self.summary = summary
self.link = link
@textbook
textbook / MidTerm1.py
Created November 9, 2012 11:50
MIT 6.00x - MidTerm1 answers by jonrsharpe
# 3. Iterative/recursive log function
def myLog(x, b):
a = 0
while b ** a <= x:
a += 1
return a - 1
# 4. Interlace two strings iteratively
def laceStrings(s1, s2):
shorter, longer = sorted([s1, s2], key=len)
@textbook
textbook / ProblemSet3.py
Created November 1, 2012 13:16
MIT 6.00x - PSet 3 answers by jonrsharpe
import string
# 1. Polynomials
def evaluatePoly(poly, x):
return float(sum(b * (x ** a) for a,b in enumerate(poly)))
# 2. Derivatives
def computeDeriv(poly):
return [float (a * b) for a, b in enumerate(poly)][1:] or [0.0]
var cell = new Array(3);
for (i = 0; i < 3; i++) {
cell[i] = new Array(3);
}
var newCell = new Array(3);
for (i = 0; i < 3; i++) {
newCell[i] = new Array(3);
}
@textbook
textbook / r6.py
Last active February 10, 2019 11:14
Calculate the probability of a reward in R6 Siege
#! /usr/bin/env python3
"""Simulate the probability of a reward in R6 Siege."""
from argparse import ArgumentParser
import random
from textwrap import dedent
from typing import Mapping
@textbook
textbook / crash.log
Created April 5, 2019 12:39
Terraform crash log for issue
2019/04/05 12:38:38 [INFO] Terraform version: 0.11.8 7a5c1d221ac209bbac66947c369815cd9ca70ed5
2019/04/05 12:38:38 [INFO] Go runtime version: go1.10.1
2019/04/05 12:38:38 [INFO] CLI args: []string{"/home/circleci/base/e2e/terraform", "apply", "-auto-approve"}
2019/04/05 12:38:38 [DEBUG] Attempting to open CLI config file: /home/circleci/.terraformrc
2019/04/05 12:38:38 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/04/05 12:38:38 [INFO] CLI command args: []string{"apply", "-auto-approve"}
2019/04/05 12:38:38 [INFO] command: empty terraform config, returning nil
2019/04/05 12:38:38 [DEBUG] command: no data state file found for backend config
2019/04/05 12:38:38 [DEBUG] New state was assigned lineage "e48ff2b8-ddfe-882d-6ef9-9fbc2bf7e882"
2019/04/05 12:38:38 [INFO] command: backend initialized: <nil>

CYF Conference 2019

Code Retreat

Overview

  • Each iteration will be 35 minutes of coding, followed by a 15 minute retro, followed by a 10 minute break.
  • We will be working in pairs and using test-driven development (TDD). Pairs switch after each iteration.
  • After each iteration, we will start from scratch - delete your code! The goal is the practice, not the code.