Skip to content

Instantly share code, notes, and snippets.

@cmbaughman
cmbaughman / Vagrantfile
Created Apr 6, 2014
Preliminary Vagrant Notes
View Vagrantfile
Vagrant::Config.run do |config|
config.vm. box = "precise64"
config.vm.box_url = "http://hashicorp-files.vagrantup.com/precise64.box"
config.vm.share_folder "v-root", "/anydir", "."
config.vm.forward_port 80, 8080
config.vm.provision "shell", path: "provision.sh"
#or chef config.vm.provision "chef_solo", run_list: ["candoris_chef"]
end
@cmbaughman
cmbaughman / install_openvpn.sh
Created Apr 27, 2014
Install and configure PIA privateinternetaccess.com on Debain based Linux. Need to convert for other distros
View install_openvpn.sh
#! /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
cmbaughman / vagrant_docker.md
Created Jun 4, 2014
How to set up Vagrant to use the Docker Provisioner
View vagrant_docker.md

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 http://code.google.com/p/plv8js/wiki/PLV8
-- Inspired by
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html
-- http://ssql-pgaustin.herokuapp.com/#1
-- JSON Types need to be mapped into corresponding PG types
--
@cmbaughman
cmbaughman / s3fs-setup.sh
Created Jun 10, 2014
How to use rsync from your local machine to AWS S3
View s3fs-setup.sh
#!/bin/bash
# Dependencies
install build-essential libcurl4-openssl-dev libxml2-dev libfuse-dev
# Compile s3fs from source
wget https://s3fs.googlecode.com/files/s3fs-1.74.tar.gz
tar -zxvf s3fs-1.74.tar.gz
cd s3fs-1.74
./configure
@cmbaughman
cmbaughman / recover_file.sh
Created Jul 1, 2014
How to "UNDELETE" something deleted recently
View recover_file.sh
#!/bin/bash
####
## 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
cmbaughman / makefile
Created Jul 20, 2014
Make file template used in porting MIUI to a new device (see [https://github.com/MiCode/patchrom]).
View makefile
# Makefile for porting MIUI
#
local-zip-file := stockrom.zip
local-out-zip-file := MIUI_YOURDEVICE.zip
local-previous-target-dir :=
local-density :=
@cmbaughman
cmbaughman / vagrant-win-howto.md
Last active Sep 7, 2018
Vagrant >=1.6 Windows Instructions
View vagrant-win-howto.md

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 "https://www.modern.ie/vmdownload?platform=mac&virtPlatform=virtualbox&browserOS=IE10-Win8.1&parts=5&filename=VMBuild_20131127/VirtualBox/IE10_Win8/Mac/IE10.Win8.For.MacVirtualBox.part{1.sfx,2.rar,3.rar,4.rar,5.rar}"
@cmbaughman
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
cmbaughman / quick-pyenv.sh
Created Sep 17, 2014
Quickly create python 3.4 virtual environment.
View quick-pyenv.sh
pyvenv-3.4 --without-pip venv
source venv/bin/activate
cd venv
curl -LO https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py
python3.4 get-pip.py