Skip to content

Instantly share code, notes, and snippets.

@andrewdolce
andrewdolce / parrot.html
Created November 9, 2011 23:06
Cheesy Parrot Demo
<!DOCTYPE html>
<html>
<head>
<title>Cheesy Parrot Demo</title>
<script type="text/javascript" src="parrot.js"></script>
</head>
<body>
<input id="main-input" type="text" maxlength="20" autocomplete="off" /input>
<div id="parrot">Type something and the parrot will repeat it!</div>
</body>
@andrewdolce
andrewdolce / wrapper.js
Created February 1, 2012 19:29
physics wrapper
var NaClWrapper = {};
NaClWrapper.World = function() {
// Initialize…
};
NaClWrapper.World.prototype.addCar = function( position, rotation ) {
// Set up some shit…
return new NaClWrapper.Car();
};
@andrewdolce
andrewdolce / ipfw_post_1
Created August 1, 2012 07:23
ipfw list
$ sudo ipfw list
65535 1136838 609191629 allow ip from any to any
@andrewdolce
andrewdolce / ipfw_post_2
Created August 1, 2012 07:27
ipfw add pipe
$ sudo ipfw pipe 1 config delay 100ms
$ sudo ipfw add 100 pipe 1 ip from any to xkcd.com
00100 pipe 1 ip from any to any dst-ip 107.6.106.82
@andrewdolce
andrewdolce / ipfw_post_3
Created August 1, 2012 07:31
ipfw list 2
$ sudo ipfw list
00100 pipe 1 ip from any to 107.6.106.82
65535 allow ip from any to any
@andrewdolce
andrewdolce / ipfw_post_4
Created August 1, 2012 07:33
ping xkcd
$ ping xkcd.com
PING xkcd.com (107.6.106.82): 56 data bytes
64 bytes from 107.6.106.82: icmp_seq=0 ttl=55 time=117.092 ms
64 bytes from 107.6.106.82: icmp_seq=1 ttl=55 time=124.583 ms
64 bytes from 107.6.106.82: icmp_seq=2 ttl=55 time=117.916 ms
64 bytes from 107.6.106.82: icmp_seq=3 ttl=55 time=121.067 ms
@andrewdolce
andrewdolce / ipfw_post_5
Created August 1, 2012 07:34
ipfw delete
$ sudo ipfw delete 100
$ sudo ipfw pipe 1 delete
@andrewdolce
andrewdolce / ipfw_post_7
Created August 1, 2012 07:37
ipfw less naive loopback
$ sudo ipfw add 100 pipe 1 ip from 127.0.0.1 to 127.0.0.1 in
$ sudo ipfw add 100 allow ip from 127.0.0.1 to 127.0.0.1 out
@andrewdolce
andrewdolce / jitter.sh
Created August 1, 2012 07:40
ipfw jitter test script
#!/bin/bash
MIN_LAG=25
MAX_LAG=50
(( LAG_RANGE = MAX_LAG - MIN_LAG ))
TIME=600 # total test time (in seconds)
INTERVAL=0.1 # time in between changes in latency (in seconds)
STEPS=6000 # TIME / INTERVAL
@andrewdolce
andrewdolce / physics.js
Created September 19, 2012 12:48
Physics API
// This is a JS component interface.
// It acts as the window to the physics layer. It also emits collision events
// that have been processed / generated by the CollisionEventDispatcher.
function Physics () {
this.physicsId = null;
// would store serializable physics properties like:
// linear velocity
// angular velocity
// anything else needed for backing up physics state
};