Skip to content

Instantly share code, notes, and snippets.

@jtimberman
jtimberman / ec2_client.rb
Created March 2, 2010 03:38
generate user_data.json with knife, launch instance with it and magic!
# Author:: Adam Jacob <adam@opscode.com>
# Author:: Joshua Timberman <joshua@opscode.com>
#
# Copyright 2009-2010, Opscode, Inc
#
# 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
require 'minitest/unit'
require 'minitest/spec'
require 'rubygems'
require 'ansi'
class MiniTest::Unit
include ANSI::Code
PADDING_SIZE = 4
@torsten
torsten / bookmarks.sh
Created February 20, 2011 11:20
A port of Huy Nguyen's bash directory bookmarks to zsh
# Original code for bash from:
# http://www.huyng.com/archives/quick-bash-tip-directory-bookmarks/492/
# Zsh Directory Bookmarks
alias m1='alias g1="cd `pwd`"'
alias m2='alias g2="cd `pwd`"'
alias m3='alias g3="cd `pwd`"'
alias m4='alias g4="cd `pwd`"'
alias m5='alias g5="cd `pwd`"'
alias m6='alias g6="cd `pwd`"'
@vmihailenco
vmihailenco / proxy.go
Created November 20, 2011 15:22
Simple TCP proxy in Golang
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
@cpatni
cpatni / app.rb
Created November 21, 2011 22:39
unique calculation using redis
require 'sinatra'
require 'redis'
require 'json'
require 'date'
class String
def &(str)
result = ''
result.force_encoding("BINARY")
@b1nary
b1nary / post_tor_ruby.rb
Created February 8, 2012 17:35
[Ruby] Post form data trough socks
require 'rubygems'
require 'rest-client'
# Socksify is amazing handling Proxys, also Socks like tor
# The proxy is simply aviable in the whole script
require 'socksify'
TCPSocket::socks_server = "127.0.0.1"
TCPSocket::socks_port = 9070
# Create a cookie
@firedfox
firedfox / gist:2037945
Created March 14, 2012 17:09
find google ads with phantomjs
var page = require('webpage').create();
page.settings.loadImages = false;
page.onConsoleMessage = function(msg) { console.log(msg); };
page.onLoadFinished = function() {
page.evaluate(function() {
var getFrames = function(doc) {
var frames = doc.querySelectorAll('iframe');
for (var i = frames.length - 1; i >= 0; i--) {
var fdoc = frames[i].contentWindow.document;
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@feyeleanor
feyeleanor / dnsruby-naptr-ordering.rb
Created August 14, 2012 15:47
Ordering NAPTR records with Dnsruby
require 'rubygems'
require 'dnsruby'
include Dnsruby
$nameserver = Resolver.new
def dig domain, rrtype
search = $nameserver.query(domain, Types.send(rrtype))
if rrtype == :NAPTR
search.answer.sort_by { |a| [ a.order, a.preference ] }.each { |rr|
###
# Scheme code is translated to YARV byte code, then evaluated in the
# Ruby Virtual Machine
require 'rbconfig'
require 'dl'
require 'fiddle'
require 'strscan'
class RubyVM