Skip to content

Instantly share code, notes, and snippets.

View davidsmalley's full-sized avatar

David Smalley davidsmalley

View GitHub Profile

Keybase proof

I hereby claim:

  • I am davidsmalley on github.
  • I am davidsmalley (https://keybase.io/davidsmalley) on keybase.
  • I have a public key whose fingerprint is 709D EA82 DEA7 2FA2 E7C3 CB8A ADC8 3266 E8E4 DF0C

To claim this, I am signing this object:

it "should create a new test set" do
expect { @preview_test.save }.should change(user.test_sets, :count).by(1)
@preview_test.test_set.tap do |t|
t.should be_valid
t.account.should == account
t.user.should == user
t.service.should == email_service
end
end
@davidsmalley
davidsmalley / gist:1844214
Created February 16, 2012 11:29
LVS tcpdump
## Dump of LVS-TUN server request
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on en0, link-type EN10MB (Ethernet), capture size 65535 bytes
11:24:59.448587 IP VIP.https > 10.0.1.13.55097: Flags [S.], seq 2595923349, ack 1491261251, win 5792, options [mss 1402,sackOK,TS val 4343326 ecr 593399430,nop,wscale 7], length 0
11:24:59.574451 IP VIP.https > 10.0.1.13.55097: Flags [.], ack 152, win 54, options [nop,nop,TS val 4343338 ecr 593399549], length 0
11:24:59.575315 IP VIP.https > 10.0.1.13.55097: Flags [.], seq 1:1391, ack 152, win 54, options [nop,nop,TS val 4343338 ecr 593399549], length 1390
11:24:59.576264 IP VIP.https > 10.0.1.13.55097: Flags [.], seq 1391:2781, ack 152, win 54, options [nop,nop,TS val 4343338 ecr 593399549], length 1390
11:24:59.576270 IP VIP.https > 10.0.1.13.55097: Flags [P.], seq 2781:4097, ack 152, win 54, options [nop,nop,TS val 4343338 ecr 593399549], length 1316
def meta_data
@meta_data ||= cache(self.guid) do
EaService.get_metadata(self.guid)
end
end
def started_at
meta_data.started_at
end
30/04/2010 10:54:18 [0x0-0x30e30e].com.spotify.client[20258] 09:54:18.093 I [snd:401] 64k-Latency: 3 ms. Play latency: 141 ms (ap)
30/04/2010 10:54:18 [0x0-0x30e30e].com.spotify.client[20258] 09:54:18.517 I [p2p:1877] AP: 0kB/s. CDN: 0kB/s. P2P: 322kB/s(4). Up: 0kB/s(0). Peers: 12/2/0
30/04/2010 10:54:19 [0x0-0x30e30e].com.spotify.client[20258] 09:54:19.734 I [p2p:308] Download stats: AP: 0kB(0%) P2P: 4869kB(100%) CDN: 0kB(0%) Waste: 0kB(0%)
30/04/2010 10:54:23 [0x0-0x30e30e].com.spotify.client[20258] 09:54:23.517 I [p2p:1877] AP: 0kB/s. CDN: 0kB/s. P2P: 12kB/s(2). Up: 0kB/s(0). Peers: 12/2/0
30/04/2010 10:55:29 [0x0-0x30e30e].com.spotify.client[20258] 09:55:29.088 I [p2p:1877] AP: 0kB/s. CDN: 0kB/s. P2P: 0kB/s(0). Up: 12kB/s(1). Peers: 11/0/0
30/04/2010 10:55:34 [0x0-0x30e30e].com.spotify.client[20258] 09:55:34.088 I [p2p:1877] AP: 0kB/s. CDN: 0kB/s. P2P: 0kB/s(0). Up: 9kB/s(1). Peers: 11/0/0
30/04/2010 10:55:39 [0x0-0x30e30e].com.spotify.client[20258] 09:55:39.096 I [p2p:1877] AP: 0kB/s. CDN: 0kB/s. P2P:
#!/bin/bash
LASTLINE=`tail -n 1 /etc/hosts`
HOST=`tail -n 1 /etc/hosts | awk '{ print $2 }'`
echo "127.0.0.1 $HOST.domain.ext $HOST localhost.localdomain localhost" > /etc/hosts
echo $LASTLINE >> /etc/hosts
curl -verbose -u xxx:xxx -H "Accept: application/xml" -H "Content-Type:application/xml" -d '<?xml version="1.0" encoding="UTF-8"?>
> <test_set>
> <applications type="array">
> <application>
> <code>saf2</code>
> </application>
> <application>
> <code>ie7</code>
> </application>
> <application>
# Find the current branch name without any textual adornments
function lparse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
# Override git so we can check the branch name
function git () {
GIT="`which git`"
if [[ "$1" == "commit" ]]; then
if [[ $(lparse_git_branch) == "staging" || $(lparse_git_branch) == "production" ]]; then
# Setup our director and configure the two backends
director doctype_director round-robin {
{
.backend = {
.host = "172.20.0.70";
.port = "http";
.probe = {
.url = "/lbcheck/lbuptest";
.timeout = 0.3 s;
.window = 8;
#!/bin/sh
#
# openvpn-tap-up-down.sh
#
#
# A script to be used as an OpenVPN bridged (tap) up/down script on Mac OSX 10.4
# - uses ipconfig to acquire a DHCP lease via the OpenVPN tap interface, and scutil to
# incorporate the DHCP-supplied DNS configuration
#
# Use in your OpenVPN config file as follows: