Skip to content

Instantly share code, notes, and snippets.

cmbaughman / Vagrantfile
Created Apr 6, 2014
Preliminary Vagrant Notes
View Vagrantfile do |config|
config.vm. box = "precise64"
config.vm.box_url = ""
config.vm.share_folder "v-root", "/anydir", "."
config.vm.forward_port 80, 8080
config.vm.provision "shell", path: ""
#or chef config.vm.provision "chef_solo", run_list: ["candoris_chef"]
cmbaughman /
Created Apr 27, 2014
Install and configure PIA on Debain based Linux. Need to convert for other distros
#! /bin/sh -
# Install OpenVPN connections for all available
# regions to NetworkManager
# Requirements:
# should be run as root
# python and openvpn (will be installed if not present)
# Usage:
cmbaughman /
Created Jun 4, 2014
How to set up Vagrant to use the Docker Provisioner

How to set up Vagrant do build/configure Dockers

  1. Put the dockerfile that you want to use in a directory next to your vagrantfile.

  2. In the vagrantfile put the following:

config.vm.provision "docker" do |d|
 d.build_image "/vagrant", args: "-t my-name/my-new-image"
View postsql.sql
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8
-- Inspired by
-- JSON Types need to be mapped into corresponding PG types
cmbaughman /
Created Jun 10, 2014
How to use rsync from your local machine to AWS S3
# Dependencies
install build-essential libcurl4-openssl-dev libxml2-dev libfuse-dev
# Compile s3fs from source
tar -zxvf s3fs-1.74.tar.gz
cd s3fs-1.74
cmbaughman /
Created Jul 1, 2014
How to "UNDELETE" something deleted recently
## NOTE: Change /dev/sda1 to the name of the device partition you
## deleted the file on.
# Also "x" needs to be big enough to hold the file contents.
grep --binary-files=text --context=x 'stringfromyourfile' \ /dev/sda1 > someFile.txt
cmbaughman / makefile
Created Jul 20, 2014
Make file template used in porting MIUI to a new device (see []).
View makefile
# Makefile for porting MIUI
local-zip-file :=
local-out-zip-file :=
local-previous-target-dir :=
local-density :=
cmbaughman /
Last active Sep 7, 2018
Vagrant >=1.6 Windows Instructions

How to set up a Windows VM with Vagrant

Create your VM


  1. Obtain a windows vm from Modern IE.
  • Win 8 OSX
curl -O -L "{1.sfx,2.rar,3.rar,4.rar,5.rar}"
cmbaughman / client.c
Created Aug 24, 2014
Getting down with sockets
View client.c
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <arpa/inet.h>
cmbaughman /
Created Sep 17, 2014
Quickly create python 3.4 virtual environment.
pyvenv-3.4 --without-pip venv
source venv/bin/activate
cd venv
curl -LO