Skip to content

Instantly share code, notes, and snippets.

View knowsuchagency's full-sized avatar
💭
hustlin'

Stephan Fitzpatrick knowsuchagency

💭
hustlin'
View GitHub Profile
@knowsuchagency
knowsuchagency / tic-tac-toe.ipynb
Last active August 11, 2017 02:40
tic-tac-toe
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knowsuchagency
knowsuchagency / LIK8-0.java
Created September 15, 2017 05:33
null created by knowsuchagency - https://repl.it/LIK8/0
class Main {
public static void main(String[] args) {
int seconds, minutes, hours, days, weeks;
seconds = 100;
weeks = seconds/(168*60*60);
seconds -= weeks*168*60*60;
days = seconds/(24*60*60);
@knowsuchagency
knowsuchagency / LIK8-1.java
Created September 15, 2017 05:52
null created by knowsuchagency - https://repl.it/LIK8/1
import java.util.Scanner;
class Main {
public static void main(String[] args) {
int seconds, minutes, hours, days, weeks;
Scanner scan = new Scanner(System.in);
System.out.println("Please enter the number of seconds");
seconds = scan.nextInt();
@knowsuchagency
knowsuchagency / recursion-post.md
Created September 24, 2017 01:04
recursion post markdown

In the beginning, there was the Imperative

It all started when a friend of mine asked for help on their introductory computer science class.

They had been assigned the task of writing a program that would ask a user to input a number of seconds, and then print how much time that was in terms of weeks, days, hours, and seconds.

For example,

@knowsuchagency
knowsuchagency / printer.py
Last active September 24, 2017 23:57
asyncio example
# print to stdout in infinite loop
from datetime import datetime
from pathlib import Path
from time import sleep
from typing import List
import random
import json
import os
@knowsuchagency
knowsuchagency / follow.py
Created October 5, 2017 22:05
tail -f implementation in Python
# This code was borrowed from David Beazley http://www.dabeaz.com/generators/follow.py
# Follow a file like tail -f.
import time
def follow(thefile):
thefile.seek(0,2)
while True:
line = thefile.readline()
if not line:
time.sleep(0.1)
@knowsuchagency
knowsuchagency / madlibs.ipynb
Last active October 8, 2017 04:54
madlibs.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knowsuchagency
knowsuchagency / decorator example.ipynb
Last active October 13, 2017 20:42
just decorator things
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knowsuchagency
knowsuchagency / Untitled200.ipynb
Created October 27, 2017 03:51
interest calculator
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knowsuchagency
knowsuchagency / main.py
Created November 13, 2017 21:13
TEMPOrary
import re
import json
import typing as T
from typing import NamedTuple
from textwrap import dedent
from collections import Counter
class Record(NamedTuple):