Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# Quick and dirty demonstration of CVE-2014-0160 by
# Jared Stafford (jspenguin@jspenguin.org)
# Modified so that it finds cookies
import sys
import struct
import socket
import time
import select
@pims
pims / riakshell.go
Last active December 27, 2015 03:09
// tim$ go install
// tim$ cat logs | riakshell
package main
import (
"bufio"
"github.com/mrb/riakpbc"
"io"
"log"
# Artie - Artie Server
#
# Real-time messaging service
description "artie"
start on filesystem
stop on runlevel S
respawn
# use with: logging.config.dictConfig(yaml.load(open('logging.yaml', 'r')))
# Formatters detailed here: http://docs.python.org/2/library/logging.html#logrecord-attributes
version: 1
formatters:
simple:
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
detail:
format: '%(asctime)s - %(levelname)s - File: %(filename)s - %(funcName)s() - Line: %(lineno)d - %(message)s'
# This is a short collection of tools that are useful for managing your
# known_hosts file. In this case, I'm using the '-f' flag to specify the
# global known_hosts file because I'll be adding many deploy users on this
# system. Simply omit the -f flag to operate on ~/.ssh/known_hosts
# Add entry for host
ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts
# Scan known hosts
ssh-keygen -f /etc/ssh/ssh_known_hosts -H -F github.com
@pims
pims / pi.txt
Created October 13, 2012 19:27
First 100,000 digits of pi spelled out.
three dot one four one five nine two six five three five height nine seven nine three two three height four six two six four three three height three two seven nine five zero two height height four one nine seven one six nine three nine nine three seven five one zero five height two zero nine seven four nine four four five nine two three zero seven height one six four zero six two height six
two zero height nine nine height six two height zero three four height two five three four two one one seven zero six seven nine height two one four height zero height six five one three two height two three zero six six four seven zero nine three height four four six zero nine five five zero five height two two three one seven two five three five nine four zero height one two height four height one
one one seven four five zero two height four one zero two seven zero one nine three height five two one one zero five five five nine six four four six two two nine four height nine five four nine three zero three height one
@pims
pims / gist:2030637
Created March 13, 2012 18:46
NCAA Brackets March Madness 2012
# note: xxx means team unknown ATM
kaf,xxx
iao,cbp
wax,vaa
iai,nan
naj,cbl
bae,sds
nbf,xaa
dau,laf
@pims
pims / README.md
Created January 22, 2012 03:54 — forked from mbostock/.block
Line Transition

D3’s default path interpolation is the same as its string interpolation: it finds numbers embedded in strings, and interpolates those numbers. So, the default behavior when interpolating two paths is like this:

M x0, y0 L x1, y1 L x2, y2 L x3, y3 
   ↓   ↓    ↓   ↓    ↓   ↓    ↓   ↓
M x0, y1 L x1, y2 L x2, y3 L x3, y4 

For example, the first point ⟨x0,y0⟩ is interpolated to ⟨x0,y1⟩. Since x0 is the same, all you see are the y-values changing (see example)—you don't see the path slide to the left as intended.

What you want to happen here is something like this:

#!/usr/bin/env python
"""
code slightly adapted from http://www.amazon.com/Programming-Collective-Intelligence-Building-Applications/dp/0596529325
"""
import random
from math import sqrt
@pims
pims / parser.go
Created November 14, 2011 18:49
Basic Log parser written in Go.
package main
import (
"json";
"fmt";
"strconv";
"bufio";
"os";
"flag";
)