Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Williams awilliams

View GitHub Profile
View approle-poc.bash
#!/usr/bin/env bash
set -eu
# Proof-of-concept script to demonstrate using an AppRole
# generated token for the kubernetes-vault controller.
# https://github.com/Boostport/kubernetes-vault
# Expects vault local development server to be running.
# Launch with:
# vault server -dev
@awilliams
awilliams / benchmark_results.txt
Last active Aug 6, 2016 — forked from billhathaway/benchmark_results.txt
Added my solution algorithmFive to elvis problem. Similar to Tyler's algorithmFour, but slightly slower.
View benchmark_results.txt
go test -run none -bench . -benchtime 3s -benchmem
testing: warning: no tests to run
PASS
BenchmarkAlgorithmOne-8 2000000 2590 ns/op 53 B/op 2 allocs/op
BenchmarkAlgorithmTwo-8 5000000 957 ns/op 0 B/op 0 allocs/op
BenchmarkAlgorithmThree-8 3000000 1470 ns/op 16 B/op 1 allocs/op
BenchmarkAlgorithmFour-8 2000000 1907 ns/op 1 B/op 1 allocs/op
BenchmarkAlgorithmFive-8 2000000 2026 ns/op 1 B/op 1 allocs/op
BenchmarkAlgorithmSix-8 2000000 2177 ns/op 16 B/op 1 allocs/op
BenchmarkAlgorithmSeven-8 2000000 1878 ns/op 176 B/op 3 allocs/op
View gist:551d8282e8b66e6f8c15
# Add this to ~/.ssh/config, changing the Host and IdentifyFile definitions as needed.
# Run `vagrant ssh-config` for more info.
Host devbox
HostName 127.0.0.1
User vagrant
Port 2222
ForwardAgent yes
IdentityFile ~/vms/devbox/.vagrant/machines/default/virtualbox/private_key
UserKnownHostsFile /dev/null
@awilliams
awilliams / raspberry_pi.md
Created Jan 4, 2015
Raspberry Pi setup - for my own records mostly
View raspberry_pi.md

This is available at: gist

Raspberry Pi

Creating image

View poo_server.go
// HTTP server which periodically emits a message, in this case, "💩 ".
//
// Idea taken from http://robpike.io/
// Test with: curl -i -N http://localhost:8080
package main
import (
"fmt"
"io"
@awilliams
awilliams / sshtunnel
Created Oct 29, 2014
sshtunnel helper
View sshtunnel
#!/usr/bin/env bash
# ARG1 = remote host, ie db.example.com
# ARG2 = port to forward, ie 8080
set -eu
echo "Tunneling $1 -> http://sshtunnel:$2"
#open /Applications/Google\ Chrome.app/ "http://sshtunnel:$2/"
ssh -C $1 -L $2:localhost:$2 -N
@awilliams
awilliams / clean_git_tags.sh
Last active Jun 17, 2017
Delete multiple grepable tags from git
View clean_git_tags.sh
#!/bin/bash
for i in $( git tag -l | grep staging ); do
echo Tag: $i
#git tag -d $i
#git push origin :refs/tags/$i
done
View template.bash
#!/usr/bin/env bash
set -o pipefail
set -o errexit
# set -o xtrace
__DIR__="$(cd "$(dirname "${0}")"; echo $(pwd))"
__BASE__="$(basename "${0}")"
__FILE__="${__DIR__}/${__BASE__}"
@awilliams
awilliams / bm.rb
Created Feb 5, 2014
Benchmark Restfulness::Sanitizer#sanitize_query_string
View bm.rb
#
# Benchmark Restfulness::Sanitizer#sanitize_query_string
# Usage: ruby -I lib bm.rb 1000
#
require 'benchmark'
require 'restfulness'
iterations = ARGV.empty? ? 1000 : ARGV.shift.to_i
query_string = "alongparam=das3e23&something=dfasd&password=caca&another=false"
View vnc_scan.sh
#!/bin/sh
nmap -p 5900 192.168.2.0/24 --open | awk '/Nmap scan/ {print $5}'
You can’t perform that action at this time.