Skip to content

Instantly share code, notes, and snippets.

@gotyaoi
gotyaoi / day1.py
Last active December 24, 2015 00:50
advent of code
import sys
with open(sys.argv[1]) as f:
s = f.read().strip()
floor = 0
basement = False
for i, c in enumerate(s, start=1):
if c == '(':
@gotyaoi
gotyaoi / go_tour_webcrawler.go
Last active October 15, 2015 19:38
A solution for the webcrawler exercise of the go tour
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@gotyaoi
gotyaoi / big_o.py
Last active August 29, 2015 14:19
Big O estimation
from timeit import repeat
from math import log
from time import time
def estimate_big_o(fun):
timings = []
data_length = 2**5
while data_length <= 2**14:
seconds = repeat(
stmt='%s(%d)' % (fun.__name__, data_length),