Skip to content

Instantly share code, notes, and snippets.

View bpoweski's full-sized avatar

Ben Poweski bpoweski

View GitHub Profile
@bpoweski
bpoweski / bgpd.conf
Created September 21, 2016 15:54 — forked from heri16/bgpd.conf
AWS VPC VPN StrongSwan Virtual Tunnel Interface (VTI)
#@ /etc/quagga/bgpd.conf (Centos & Ubuntu)
hostname <Local OS hostname>
password <Any random phrase>
enable password <Any random phrase>
!
log file /var/log/quagga/bgpd
!debug bgp events
!debug bgp zebra
debug bgp updates
@bpoweski
bpoweski / _service.md
Created March 19, 2016 17:10 — forked from fengye/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
(defn get-field! [^Class klass instance ^String name]
(.get (doto (.getDeclaredField klass name) (.setAccessible true)) instance))
(defn ^ScriptingCommands scripting-commands [conn]
(if (instance? JedisCluster conn)
(let [conn-handler (get-field! JedisCluster conn "connectionHandler")
max-redirections (get-field! JedisCluster conn "maxRedirections")]
(reify ScriptingCommands
(evalsha [this ^String sha1 ^java.util.List keys ^java.util.List args]
(.run (proxy [JedisClusterCommand] [conn-handler max-redirections]
require "formula"
class Dynomite < Formula
homepage "https://github.com/Netflix/dynomite"
head "https://github.com/Netflix/dynomite.git"
option "enable-debug", "Debug mode with assertion panics enabled"
depends_on :automake => :build
depends_on :autoconf => :build
depends_on :libtool => :build
@bpoweski
bpoweski / accuracy.R
Created March 29, 2014 21:27
Calculating Pi
attempts <- seq(1000, 1000000, by=10000)
estimated <- sapply(attempts, function(x) calc.pi(make.pi(x)))
ggplot(data.frame(estimated=estimated, n=attempts)) + geom_point(aes(x=n, y=estimated)) + geom_hline(yintercept=pi, color="green")
@bpoweski
bpoweski / gist:5034188
Created February 25, 2013 23:08
High memory 8XL
$ free -m
total used free shared buffers cached
Mem: 245751 12945 232805 0 967 7148
-/+ buffers/cache: 4829 240921
Swap: 1999 0 1999
@bpoweski
bpoweski / init.el
Created November 11, 2012 01:10
Emacs Clojure
(require 'package)
(defun arrange-frame (w h x y)
(let ((frame (selected-frame)))
(delete-other-windows)
(set-frame-position frame x y)
(set-frame-size frame w h)))
(arrange-frame 190 90 1200 5)
;;(require 'copterj.git-version) ;; Pick up DRY'd version numbers
(require 'clojure.contrib.io) ;; Needed to locate newrelic
(let [java-agent (str "-javaagent:" (clojure.contrib.io/pwd) "/lib/newrelic.jar")]
(defproject apij ~(copterj.git-version/git-describe)
:description "Hotelicopter's API"
:dependencies
[[com.hotelicopter/copterj "1.0.0-SNAPSHOT"]
@bpoweski
bpoweski / iostat_output.txt
Created August 12, 2012 21:06
Bonnie++ Extra Large Instance (m1.xlarge) EBS-Optimized (io1 with 1000 provisioned IOPS)
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
xvdap1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdd 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvde 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdk 0.00 0.00 0.00 636.00 0.00 27948.00 87.89 143.42 223.31 0.00 223.31 1.57 100.00
@bpoweski
bpoweski / benchmark.rb
Created August 6, 2011 21:29
Benchmark
require "benchmark"
require "mongoid"
require "./perf/models"
Mongoid.configure do |config|
config.master = Mongo::Connection.new.db("mongoid_perf_test")
end
Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)