Skip to content

Instantly share code, notes, and snippets.

#!/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 / dupimgs.go
Last active October 22, 2021 20:52
Duplicate image detector
package main
// Duplicate image detector.
//
// Usage:
// ./dupimgs -dir .
//
// This will recursively search the given directory for files with
// {.jpg, .jpeg} extensions (currently hardcoded). For each file with
// such an extension, the MD5 hash of the file's contents will be calculated.
@awilliams
awilliams / clean_git_tags.sh
Last active June 17, 2017 21:31
Delete multiple grepable tags from git
#!/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
@awilliams
awilliams / benchmark_results.txt
Last active August 6, 2016 16:25 — forked from billhathaway/benchmark_results.txt
Added my solution algorithmFive to elvis problem. Similar to Tyler's algorithmFour, but slightly slower.
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
@awilliams
awilliams / vnc_scan.sh
Created July 22, 2013 12:35
VNC nmap scan
#!/bin/sh
nmap -p 5900 192.168.2.0/24 --open | awk '/Nmap scan/ {print $5}'
@awilliams
awilliams / ar_mysql2_bug.rb
Last active December 19, 2015 00:18
ActiveRecord Mysql2 boolean casting error
# Must have mysql installed with user 'rails' and 'root', no password for either
# Tested on the rails dev box virtual machine - https://github.com/rails/rails-dev-box
#
# See https://github.com/rails/rails/issues/11119
TEST_DATABASE = 'ar_mysql2_boolean_quoting'
unless File.exists?('Gemfile')
File.write('Gemfile', <<-GEMFILE
source 'https://rubygems.org'
@awilliams
awilliams / mobile_concern.rb
Last active December 18, 2015 01:29
Rails controller concern to help with rendering mobile views
#
# Add this to your Gemfile
# gem 'rack-mobile-detect', :require => 'rack/mobile-detect'
#
module MobileConcern
extend ActiveSupport::Concern
included do
# Call this from a controller to enable mobile for a given action
# Example: enable_mobile :only => [:show]
@awilliams
awilliams / bq_curie_adb_setup
Last active December 17, 2015 11:09
BQ Curie Android Dev setup
## /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="2207", ATTR{idProduct}=="0010", MODE="0660", GROUP="plugdev", OWNER="root"
## ~/.android/adb_usb.ini
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x2207
@awilliams
awilliams / screencapture.sh
Created March 3, 2013 11:30
quick bash script to do a screen capture on Ubuntu with xvidcap
#!/bin/bash
xvidcap --mf --audio no --file ${1:-screencapture.avi} --cap_geometry 800x600+0+0 --gui no

Development box installation guide

This guide will show how to setup a VirtualBox similiar to an Ubuntu 12.04.1 server for use with Amazon EC2.

Covered in this guide:

  • VeeWee: Tool for building base boxes which will be used by vagrant
  • Vagrant: Tool for managing virtual machines with an easy to use CLI
  • Librarian: Bundler for chef cookbooks
  • Chef-solo & Knife solo: Tool for automating installing and management of servers