Skip to content

Instantly share code, notes, and snippets.

@tjulien
tjulien / LRUCache.java
Created March 4, 2012 19:41 — forked from hoffrocket/LRUCache.java
Simple LRUCache in java (not threadsafe)
import java.util.HashMap;
import java.util.Map;
public class LRUCache<K, V> {
private final Map<K, Pair<Node<K>, V>> map = new HashMap<K, Pair<Node<K>,V>>();
private Node<K> head = null;
private Node<K> tail = null;
private final int maxSize;
@tjulien
tjulien / serve.sh
Created May 17, 2011 01:27 — forked from aroscoe/serve.sh
Start a simple python server to serve files
#!/usr/bin/env bash
IP=`ifconfig | grep "inet " | grep -v "inet 127.0.0.1" | cut -f 2 -d " "`
PORT=$1
if [ -z "$1" ]
then
PORT=8000
fi
# Copy ip and port to pasteboard
@tjulien
tjulien / http sniff
Created October 1, 2010 22:13 — forked from fberger/mvn invocations
http sniff
# print http headers and body
tshark -R 'http' -S -V -l | awk '/^[HL]/ {p=30} /^[^ HL]/ {p=0} /^ / {--p} {if (p>0) print}'