Skip to content

Instantly share code, notes, and snippets.

joe miller joemiller

Block or report user

Report or block joemiller

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joemiller
joemiller / pdns-recursor-cache-stats.rb
Last active Oct 11, 2019
quick 1-time script to parse pdns_recursor cache hit ratio and qps across a range of hosts
View pdns-recursor-cache-stats.rb
#!/usr/bin/env ruby
#
# Usage:
#
# $ ruby pdns-recursor-cache-stats.rb
#
# Might need to use sudo or run as root to access the pdns_recursor control socket
#
uptime = 0
View 1-master-branch.md

test plan:

scenarios:

  1. vanilla
  2. with forked keyring lib

steps:

  • keychain
    • record stdout/stderr + exit code:
View 1-master-branch.md

test plan:

scenarios:

  1. vanilla
  2. with forked keyring lib

steps:

  • keychain
    • record stdout/stderr + exit code:
@joemiller
joemiller / k8shack-with-current-kubelet-cert.sh
Created Apr 3, 2019
quick script used during some exploratory GKE/k8s cluster pen-testing. Goal was to use a compromised node's kubelet to move laterally thru the cluster to other nodes and api objects
View k8shack-with-current-kubelet-cert.sh
#!/bin/bash
set -e
NODE_NAME="${NODE_NAME:-random-node-name}"
KUBE_API="${KUBE_API:-35.226.10.2}"
KUBELET_KEY="${KUBELET_KEY:-/etc/srv/kubernetes/pki/kubelet.key}"
KUBELET_CERT="${KUBELET_CERT:-/etc/srv/kubernetes/pki/kubelet.crt}"
WORKDIR="$(mktemp -d /tmp/foo.XXXXX)"
@joemiller
joemiller / docker-backup.sh
Created Aug 7, 2018
minimal docker image backup/restore. used once when resetting the docker/mac VM
View docker-backup.sh
#!/bin/bash
set -eou pipefail
dump_images() {
for i in $(docker images -q | uniq); do
local tarball="$i.tar.gz"
if [[ -e "$tarball" ]]; then
echo "$tarball exists, skipping $i"
continue
@joemiller
joemiller / git-diff-size-check-total-only.rb
Last active Dec 19, 2017
proof of concept script for checking the size of staged git commits and rejecting based on individual file or overall total
View git-diff-size-check-total-only.rb
#!/usr/bin/env ruby
MAX_DIFF_SIZE_MB = 4 # MB
def bytes_to_mb(bytes)
bytes.to_f / (1024*1024)
end
total_diff_bytes = 0
@joemiller
joemiller / kube-svc-check.rb
Created Oct 5, 2017
do a TCP connect test on all services in a kube namespace that have a public IP
View kube-svc-check.rb
#!/usr/bin/env ruby
require 'json'
require 'socket'
require 'timeout'
CONNECT_TIMEOUT = 2
def is_port_open?(ip, port)
begin
View foo.go
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"log"
@joemiller
joemiller / softirq-watch.rb
Created Jul 21, 2016
watch /proc/softirqs and print deltas of each metric at an interval
View softirq-watch.rb
#!/usr/bin/ruby
# CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 CPU8 CPU9 CPU10 CPU11 CPU12 CPU13 CPU14
# HI: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
# TIMER: 2344143 2305156 2295889 2278479 2274008 2260063 2237324 2245718 0 0 0 0 0 0 0
# NET_TX: 11309569 76523 76961 77020 77086 76261 78908 76016 0 0 0 0 0 0 0
# NET_RX: 11442620 47843 49607 48089 48989 45698 49201 41453 0 0 0 0 0 0 0
# BLOCK: 0 0 0 0 0 0 0 0
View chefdk.rb
cask 'chefdk' do
version '0.8.0-1'
sha256 '4d4d6d29324aeed5331d7e573a6d658bae78b7bbf3e3502b52702476a8b747b4'
# amazonaws is the official download host per the vendor homepage
url "https://opscode-omnibus-packages.s3.amazonaws.com/mac_os_x/10.8/x86_64/chefdk-#{version}.dmg"
name 'Chef Development Kit'
name 'ChefDK'
homepage 'https://downloads.getchef.com/chef-dk/'
license :apache
You can’t perform that action at this time.