Skip to content

Instantly share code, notes, and snippets.

View jpittis's full-sized avatar

Jake Pittis jpittis

View GitHub Profile
@jpittis
jpittis / cont.lisp
Last active July 12, 2019 19:46
Mostly working continuation interpreter based on "Lisp in Small Pieces".
(defclass value () ())
(defclass environment () ())
(defclass continuation () ((k :initarg :k :accessor k)))
(defmethod invoke (f v* r k)
(error "not a function (f: ~a, r: ~a, k: ~a)" f r k))
(defmethod resume ((k continuation) v)
(error "unknown continuation (k: ~a)" k))
require 'forwardable'
class LRUHash
# This LRU (Least Recently Used) hash will allow
# the cleaning of resources as time goes on.
# The goal is to remove the least recently used resources
# everytime we set a new resource. A default window of
# 5 minutes will allow empty item to stay in the hash
# for a maximum of 5 minutes
extend Forwardable
@jpittis
jpittis / experiment.go
Created January 2, 2019 13:31
FIN vs RST Experiment
package main
import (
"log"
"net"
"os"
"time"
)
// FIN vs RST Experiment
@jpittis
jpittis / test.go
Created July 14, 2018 18:22
Playing around with mid write crashing.
package main
import (
"encoding/json"
"fmt"
"log"
"math/rand"
"os"
"time"
)
module Main where
import Control.Exception
import Control.Concurrent
import Control.Concurrent.MVar
import Control.Monad.Trans.Writer.Strict
import Control.Monad.IO.Class
import Control.Monad.Trans.Class
import Control.Concurrent.Async
@jpittis
jpittis / gist:7592636
Last active December 29, 2015 01:19
Jake's Humberside NXC Code Things to be done: add support for opposite directions, add unCrash() code, add sprint() code, change distance DEFs and time in sound_crash.
/*
* This version of the drive program will only drive on the BLACK lane.
* If WHITE turn right, if GREY turn left.
* We assume that the only WHITE it encounters will be the inner lane.
* This is meant as a working concept so that we have something to present.
*/
/* Time taken for 180 degree turn. */
#define time180 1000