Skip to content

Instantly share code, notes, and snippets.

View nfisher's full-sized avatar
🏠
Working from home

Nathan Fisher nfisher

🏠
Working from home
View GitHub Profile
@nfisher
nfisher / gist:3680788
Created September 8, 2012 23:08
Array concatenation, scoped variables and templates
# Given the configuration below.
# Expected results list of users in bip.conf.
# Actual results in an empty file.
# bip.conf
<%
usernames = scope.lookupvar('users::usernames')
fullnames = scope.lookupvar('users::fullnames')
-%>
@nfisher
nfisher / Vagrantfile
Last active December 13, 2015 22:08
Mongo DBA Week 4 - Replica Sets
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.provision :puppet do |puppet|
# equivalent to;
# puppet apply manifests/base.pp
@nfisher
nfisher / core.clj
Last active December 18, 2015 01:49
pipejine shutdown
(ns pipedream.core
(:gen-class)
(:require [clojure.tools.logging :as log]
[pipejine.core :as pipe]))
(defn pipeline []
(let [q1 (pipe/new-queue {:name "q1"
:queue-size 5
:number-of-consumer-threads 5
:number-of-producers 1})
@nfisher
nfisher / d3-heatmap.html
Created June 24, 2013 23:13
Simple D3.js SVG heatmap
<!doctype HTML>
<title>D3 Test</title>
<script src="d3.v3.min.js" charset="utf-8"></script>
<style type="text/css">
body {
margin:0 auto;
position:relative;
width:958px;
}
.chart rect {
@nfisher
nfisher / response-graph.R
Created June 26, 2013 13:45
Simple data loading in R
data = read.csv("~/workspace/responses.csv")
timestamps = data$timestamp
responses = data$response
plot(timestamps,responses, xlab="Time", ylab="Response Time")
import java.net.NetworkInterface;
import java.util.Enumeration;
public class NetIf {
public static void main(String [] args) {
try {
Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
while (en.hasMoreElements()) {
NetworkInterface nif = en.nextElement();
Enumeration<NetworkInterface> suben = nif.getSubInterfaces();
@nfisher
nfisher / network.json
Last active December 20, 2015 20:49
Early draft of network structure interchange format.
{
"version": "1.0",
"networks": {
"ldn-dmz-prod": {"ip": "172.168.3.0", "mask": "/24"},
"ldn-dmz-priv": {"ip": "192.168.3.0", "mask": "/24"},
},
"services": {
"http": {"tcp_ports": 80},
"https": {"tcp_ports": 443},
@nfisher
nfisher / lookup.py
Created September 13, 2013 18:52
Look-up request IP's and categorise into a distribution by country using MaxMind DB.
#!/usr/bin/env python
# Usage:
#
# ip_locations.py LOCATIONS BLOCKS RESERVOIR
#
# Dependencies:
#
# - reservoir sample set with 'ips' column.
# - MaxMind IP and Location CSV.
@nfisher
nfisher / Performance Analysis.ipynb.json
Created May 8, 2014 00:05
Jmeter Performance Analysis
{
"metadata": {
"name": "Performance Analysis"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@nfisher
nfisher / reflect_test.go
Last active January 18, 2024 15:53
Golang - Benchmark of new vs reflect.New.
package main_test
import (
"reflect"
"testing"
)
type fluff struct {
Name string
}