Skip to content

Instantly share code, notes, and snippets.

View cndreisbach's full-sized avatar
🍕
eatin' pizza

Clinton N. Dreisbach cndreisbach

🍕
eatin' pizza
View GitHub Profile
public class Floor {
enum State { NO_ONE_WAITING, PASSENGERS_WAITING, LOADING }
private int passengersWaiting = 0;
private State state = State.NO_ONE_WAITING;
synchronized public void waitForElevator(String msg) {
if (state == State.LOADING) {
try {
wait();
@cndreisbach
cndreisbach / nv.pl
Created August 8, 2011 02:11
Console-based Notational Velocity
#!/usr/bin/perl -w
use strict;
use Curses::UI;
use Curses::UI::Common;
use File::Basename;
use String::Approx 'amatch';
my $notedir = "~/Dropbox/Notes";
$notedir =~ s{ ^ ~ ( [^/]* ) } { $1 ? (getpwnam($1))[7] : ( $ENV{HOME} || $ENV{LOGDIR} || (getpwuid($>))[7] ) }ex;
#lang racket
;; Instructions on how to play Hunt the Wumpus.
(define *instructions* "
Welcome to Hunt the Wumpus!
The wumpus lives in a cave of 20 rooms. Each room has three tunnels
leading to other rooms. (Look at a dodecahedron to see how this works.
If you don't know what a dodecahedron is, ask someone or get thee to
a Wikipedia.
(ns monger.key-compression)
(def select (comp first filter))
(defn- trie-add
[trie words]
(reduce
(fn [trie word]
(assoc-in trie (concat word [::val]) word))
trie
@cndreisbach
cndreisbach / maze.rkt
Last active December 19, 2015 14:29
Our Maze Jam from Lambda Jam 2013
#lang racket
(require json)
(define (get-maze-cell maze x y)
(list-ref
(list-ref maze y)
x))
(define (neighbors x y)
(list (list x (sub1 y))
@cndreisbach
cndreisbach / keybase.md
Created February 26, 2014 21:25
keybase.md

Keybase proof

I hereby claim:

  • I am cndreisbach on github.
  • I am cndreisbach (https://keybase.io/cndreisbach) on keybase.
  • I have a public key whose fingerprint is DF23 53D2 60A3 9410 AC62 9931 68A5 AEAD 4863 E401

To claim this, I am signing this object:

@cndreisbach
cndreisbach / burger_feed.rb
Created August 15, 2014 01:38
burger-feed
require "rubygems"
require "bundler/setup"
require 'google_spreadsheet'
require 'sinatra'
require 'atom'
require 'rss/maker'
class Burger
attr_reader :name, :score, :link, :cows
@cndreisbach
cndreisbach / HOWTO.md
Last active August 29, 2015 14:08
How to Be An Introvert and Still Have a Great Career

People tell me that in order to get a job, you have to network. There is nothing I would like to do less than talk to strangers about myself, so that's not been an option for me. Here's my tips to having a good career.

Take risky jobs.

Often, we look at job listings and choose something that matches our skills, our interests, and our salary requirements.

If you keep doing those jobs, you'll steadily grow your salary -- maybe -- but it will plateau eventually. Anecdotally, I've seen a plateau at age 40 or at around $150K, whichever comes first. $150K sounds like a lot when you don't have kids and are single or have a partner that also works. It isn't when you're supporting two or three other people.

You'll stay in your interests, but you'll continue to do the same thing for years and years until you are bored to tears, if you're like me.

class Car:
acceleration = 2
braking = 3
desired_speed = 30 # mps = 108 km/hr
minimum_spacing = 15
slowing_prob = 0.2
def __init__(self, speed=0, location=0):
self.speed = speed
self.location = location
#!/usr/bin/env python3
"""
Game of Sticks is based on an assignment from Stanford's Nifty Assignments.
http://nifty.stanford.edu/2014/laaksonen-vihavainen-game-of-sticks/handout.html
"""
import random
from collections import Counter
from math import gcd