Skip to content

Instantly share code, notes, and snippets.

@crazed
crazed / http-proxy.go
Last active August 29, 2015 13:57
simple http proxy in go, with a chaos monkey twist
package main
import (
"fmt"
"net/http"
"net/http/httputil"
"strconv"
"time"
)
@crazed
crazed / ssltest.py
Created April 8, 2014 13:48
ssltest.py that was pulled from http://s3.jspenguin.org/ssltest.py
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
#!/usr/bin/env ruby
require 'open3'
require 'oj'
require 'multi_json'
require 'elasticsearch'
require 'faraday'
class FlowStoreClient
include Elasticsearch::API
@crazed
crazed / tmux.conf
Created October 1, 2014 16:56
my tmux.conf
# Act like Vim
set-window-option -g mode-keys vi
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Look good
set-option -g default-terminal "xterm-256color"

Keybase proof

I hereby claim:

  • I am crazed on github.
  • I am crazed (https://keybase.io/crazed) on keybase.
  • I have a public key whose fingerprint is 0D3C 2DB8 139C 2EC3 43C5 94FA F6DD 372A 1087 6B9A

To claim this, I am signing this object:

@crazed
crazed / multiwriter.go
Last active August 29, 2015 14:10
non working go multiwriter example
package main
import (
"net/http"
"io"
"log"
"bufio"
)
func performRequest(logPrefix string, url string, bodyReader io.Reader) {
bash -c '
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://download.elff.bravenet.com/5/i386/elff-release-5-3.noarch.rpm
yum install -y ruby ruby-devel gcc gcc-c++ automake autoconf make
wget -O /tmp/rubygems-1.3.7.tgz http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
tar xzf /tmp/rubygems-1.3.7.tgz -C /tmp
ruby /tmp/rubygems-1.3.7/setup.rb
rm -rf /tmp/rubygems-1.3.7
search(:node, "role:#{app_info['prod_role']}").each do |server|
Chef::Log.info("Found a server: #{server} IP: #{server.cloud.private_ips.first}")
server_list << server.cloud.private_ips.first
end
server_list.sort!
# /opt/rightscale/sandbox/bin/chef-solo -c /tmp/chef.rb -j /tmp/solo.json
[Fri, 21 Jan 2011 18:32:23 +0000] INFO: Starting Chef Solo Run
[Fri, 21 Jan 2011 18:32:24 +0000] INFO: Replacing the run_list with ["recipe[load_balancer::elb_register]"] from JSON
[Fri, 21 Jan 2011 18:32:24 +0000] WARN: Missing gem 'right_aws'
[Fri, 21 Jan 2011 18:32:25 +0000] INFO: Installing gem_package[fog] version 0.4.0
[Fri, 21 Jan 2011 18:32:44 +0000] WARN: Mising the 'fog' gem
[Fri, 21 Jan 2011 18:32:44 +0000] ERROR: load_balancer_elb[test-lb] (/opt/rightscale/sandbox/lib/ruby/gems/1.8/gems/chef-0.8.16.3/lib/chef/mixin/recipe_definition_dsl_core.rb line 59) had an error:
uninitialized constant Chef::Provider::LoadBalancerElb::Fog
/root/rightscale_cookbooks/load_balancer/providers/elb.rb:13:in `elb'
/root/rightscale_cookbooks/load_balancer/providers/elb.rb:18:in `class_from_file'
# COLORS
LIGHT_GRAY="\[\033[0;37m\]"; BLUE="\[\033[1;36m\]"; RED="\[\033[0;31m\]"; LIGHT_RED="\[\033[1;31m\]";
GREEN="\[\033[0;32m\]"; WHITE="\[\033[1;37m\]"; LIGHT_GRAY="\[\033[0;37m\]"; YELLOW="\[\033[1;33m\]";
# GIT PROMPT (http://gist.github.com/120804)
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \(\1\)/';
}
function parse_git_status {
git status 2> /dev/null | sed -e '/(working directory clean)$/!d' | wc -l;
}