Skip to content

Instantly share code, notes, and snippets.

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on en1, link-type EN10MB (Ethernet), capture size 65535 bytes
20:48:33.497527 IP 192.168.0.4.50639 > r-199-59-148-12.twttr.com.http: Flags [S], seq 4031936946, win 65535, options [mss 1460,nop,wscale 1,nop,nop,TS val 778861211 ecr 0,sackOK,eol], length 0
20:48:33.660910 IP r-199-59-148-12.twttr.com.http > 192.168.0.4.50639: Flags [S.], seq 1371944304, ack 4031936947, win 5792, options [mss 1460,sackOK,TS val 2915537900 ecr 778861211,nop,wscale 8], length 0
20:48:33.660941 IP 192.168.0.4.50639 > r-199-59-148-12.twttr.com.http: Flags [.], ack 1, win 33304, options [nop,nop,TS val 778861213 ecr 2915537900], length 0
20:48:33.661002 IP 192.168.0.4.50639 > r-199-59-148-12.twttr.com.http: Flags [P.], seq 1:148, ack 1, win 33304, options [nop,nop,TS val 778861213 ecr 2915537900], length 147
20:48:33.825157 IP r-199-59-148-12.twttr.com.http > 192.168.0.4.50639: Flags [.], ack 148, win 27, options [nop,nop,TS val 2915538064 ecr 778861
@jabley
jabley / monty_hall.py
Created November 8, 2011 09:11
Initial sketch at Monty Hall simulation, from http://www.ai-class.com/
from random import randrange
n = 1000000 # The number of iterations
switch = stay = 0 # The respective sum of wins for each strategy
for i in range(n):
# We have 3 doors
doors = [False] * 3
@jabley
jabley / snippet.js
Created October 27, 2011 12:23
Firebug console snippet for adding jQuery to a page for nice selector API
var script = document.createElement("script");
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js";
document.getElementsByTagName("head")[0].appendChild(script);
package main
import "go-tour.googlecode.com/hg/pic"
func Pic(dx, dy int) [][]uint8 {
r := make([][]uint8, dy)
for i := 0; i < dy; i++ {
r[i] = make([]uint8, dx)
for j := 0; j < dx; j++ {
@jabley
jabley / ClosureMinifier.java
Created October 4, 2011 17:30
Example of using the Google Closure Compiler at runtime
/*
* Copyright 2011 James Abley
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@jabley
jabley / UK DNS
Created October 4, 2011 09:08
Delicious transition pain
$ nslookup www.delicious.com
Server: 62.24.199.13
Address: 62.24.199.13#53
Non-authoritative answer:
www.delicious.com canonical name = fe.web1.del.a01.yahoodns.net.
Name: fe.web1.del.a01.yahoodns.net
Address: 98.139.50.166
@jabley
jabley / brew doctor
Created September 29, 2011 21:25
Valgrind build problems with homebrew
$ brew doctor
Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libblkid.2.0.dylib
/usr/local/lib/libcom_err.1.1.dylib
/usr/local/lib/libe2p.2.1.dylib
@jabley
jabley / Capabability.java
Created September 22, 2011 14:19
Hibernate upgrade woes
package com.example.domain;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@jabley
jabley / gist:1228867
Created September 20, 2011 11:05 — forked from marick/gist:1228842
(ns scratch.core
(:use midje.sweet
[clojure.set :only [union intersection difference]]
))
(def east [1 0])
(def north [0 1])
(def west [-1 0])
(def south [0 -1])
@jabley
jabley / gist:1226883
Created September 19, 2011 16:24 — forked from marick/gist:1226882
(ns scratch.core
(:use midje.sweet
[clojure.set :only [union intersection]]
))
(unfinished booking-transaction bookings)
(defn empty-history []
[ [] ])