Skip to content

Instantly share code, notes, and snippets.

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
@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
@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 / 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 / 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 / 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 / bm.rb
Created February 5, 2014 18:46
Benchmark Restfulness::Sanitizer#sanitize_query_string
#
# 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"
#!/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 / 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 / sshtunnel
Created October 29, 2014 11:16
sshtunnel helper
#!/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