Skip to content

Instantly share code, notes, and snippets.

codeslinger / example.rb
Created Apr 25, 2012 — forked from erikeldridge/example.rb
A utility for signing an url using OAuth in a way that's convenient for debugging
View example.rb
require 'oauth_util.rb'
require 'net/http'
o =
o.consumer_key = 'examplek9SGJUTUpocjZ5QjBJmQ9WVdrOVVFNHdSR2x1TkhFbWNHbzlNQS0tJnM9Y29uc3VtkZXJzZWNyZXQmeD0yYg--';
o.consumer_secret = 'exampled88d4109c63e778dsadcdd5c1875814977';
url = '*';
codeslinger / gist:2371012
Created Apr 12, 2012 — forked from mikeyk/gist:2307647
Run PGFouine for 30 seconds, logging all queries and analyzing the logs
View gist:2371012
def run_pg_fouine():
info = host_info[env.host_string]
db_name = info.tags.get('Name')
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 0/" /etc/postgresql/9.*/main/postgresql.conf')
sudo('/etc/init.d/postgresql reload')
sudo('perl -pi -e "s/log_min_duration_statement = .*/log_min_duration_statement = 500/" /etc/postgresql/9.*/main/postgresql.conf')
sudo('/etc/init.d/postgresql reload')
run('tail -n 100000 /var/log/postgresql/postgresql-9.*-main.log > /tmp/pgfouine.txt')
run('gzip -f /tmp/pgfouine.txt')
codeslinger /
Created Mar 31, 2012 — forked from erikh/
OSX For Hackers
#!/usr/bin/env sh
# This is script with usefull tips taken from:
# install it:
# curl -sL | sh
codeslinger /
Created Mar 19, 2012 — forked from leegao/
JIT for dummies: JIT compiling RPN in python

If you don't care about the explanation, scroll down to find the code, it's 50 some odd lines and written by someone who doesn't know any better. You have been warned.

What it does

This is a very simple proof of concept jitting RPN calculator implemented in python. Basically, it takes the source code, tokenizes it via whitespace, and asks itself one simple question: am I looking at a number or not?

First, let's talk about the underlying program flow. Pretend that you are a shoe connoisseur with a tiny desk. You may only have two individual shoes on that desk at any one time, but should you ever purchase a new one or get harassed by an unruly shoe salesman without realizing that you have the power to say no (or even maybe?), you can always sweep aside one of the two shoes on the desk (the one on the right, because you're a lefty and you feel that the left side is always superior) onto the messy floor, put the other shoe on the right hand side, and then place your newly acquired shoe in

codeslinger / gist:2122256
Created Mar 19, 2012 — forked from marcel/gist:2100703
giftube – Generates an animated gif from a YouTube url.
View gist:2122256
#!/usr/bin/env ruby
# giftube – Generates an animated gif from a YouTube url.
# Usage:
# giftube [youtube url] [minute:second] [duration]
# ex.
codeslinger / ctf_mpetrov.c
Created Feb 26, 2012 — forked from michaelpetrov/ctf_mpetrov.c
Stripe CTF Challenge Level 06 Solution
View ctf_mpetrov.c
// Created by Michael Petrov on 12-02-23.
// Copyright (c) 2012 TenthBit Inc. All rights reserved.
// (
// This solution performs a timing attack on the fork system call. By monitoring the process closely
// it is possible to discover where the fork likely happened. With some basic heuristics, it's possible
// to infer where the wrong character is. With very minor brute force searching it becomes very easy
// to find the password one letter at a time.
codeslinger / gist:1917396
Created Feb 26, 2012 — forked from evandrix/gist:1901352
Stripe CTF Challenge - Solutions to all Levels
View gist:1917396
Stripe CTF - Work Notes
mpetrov (
These notes are very rough. They should give a general idea of how each level was solved.
---- LEVEL 01 (login: e9gx26YEb2) -----
Solution: modifying PATH env variable
Password: kxlVXUvzv
codeslinger /
Created Jan 10, 2012 — forked from jbrisbin/
Disruptor RingBuffer-based simplistic NIO HTTP test server
import java.nio.ByteBuffer;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
codeslinger / Migration-Syntax.clj
Created Nov 8, 2011 — forked from RickMoynihan/Migration-Syntax.clj
Rails like Database Migrations in Clojure... Using clojure.contrib.sql
View Migration-Syntax.clj
(def migrations (sorted-map
;; Migrations are numbered by integer values to explicitly document them
1 {
:doc "Foo Table"
:up (fn []
; store a JSON blob in here for the screening record
codeslinger /
Created Aug 19, 2011 — forked from ericmoritz/
A counter stored in Riak that handles conflict resolutions on read
import logging
import riak
log = logging.getLogger(__name__)
class RiakCounter(object):
def __init__(self, bucket, key):
self.bucket = bucket
self.key = key