Skip to content

Instantly share code, notes, and snippets.

@crazed
crazed / gist:b5448baeb204eb816eb9
Created December 28, 2015 18:32
jq deep merge
➜ ~ cat a.json
{
"_meta": {
"tag_environment_magic": [
"a"
]
}
}
➜ ~ cat b.json
{
@crazed
crazed / gist:0cae1dc0e2d95da0cf5f
Created October 23, 2015 16:01
lint-ansible.py
#!/usr/bin/env python
import os
import re
import sys
import ansible.errors
import ansible.utils.template
import ansiblelint
import ansiblelint.utils
import jinja2
@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) {

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 / 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"
#!/usr/bin/env ruby
require 'open3'
require 'oj'
require 'multi_json'
require 'elasticsearch'
require 'faraday'
class FlowStoreClient
include Elasticsearch::API
@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
@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 / gist:8323783
Last active January 2, 2016 15:29
dhcpd config for juniper ztp
option option-150 code 150 = ip-address;
option space JUNOS_ZTP;
option JUNOS_ZTP.config-file-name code 1 = text;
option JUNOS_ZTP.image-file-type code 2 = text;
option JUNOS_ZTP.transfer-mode code 3 = text;
option JUNOS_ZTP.alt-image-file-name code 4= text;
option JUNOS_ZTP-encapsulation code 43 = encapsulate JUNOS_ZTP;
subnet 172.16.200.0 netmask 255.255.255.0 {
@crazed
crazed / example.py
Created January 3, 2014 02:52
example doing parallel junos pyez execution
import time
from multiprocessing import Pool
from pprint import pprint
from optopus import Client, OPTOPUS_ENDPOINT
from jnpr.junos import Device
# work in progress
class MetaStore(object):
"""