Skip to content

Instantly share code, notes, and snippets.

View cmbaughman's full-sized avatar
🧐
I may be slow to respond.

Chris Baughman cmbaughman

🧐
I may be slow to respond.
View GitHub Profile
@cmbaughman
cmbaughman / Vagrantfile
Created April 6, 2014 23:55
Preliminary Vagrant Notes
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 April 27, 2014 22:24
Install and configure PIA privateinternetaccess.com 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
cmbaughman / vagrant_docker.md
Created June 4, 2014 13:29
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"
-- 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 June 10, 2014 17:13
How to use rsync from your local machine to AWS S3
#!/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 July 1, 2014 03:16
How to "UNDELETE" something deleted recently
#!/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 July 20, 2014 14:25
Make file template used in porting MIUI to a new device (see [https://github.com/MiCode/patchrom]).
# 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 September 7, 2018 09:15
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 "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 August 24, 2014 14:03
Getting down with sockets
#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 September 17, 2014 17:39
Quickly create python 3.4 virtual environment.
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