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
-- 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 / 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
@cmbaughman
cmbaughman / touchpad_fix.sh
Created September 22, 2014 15:41
Fix Ubuntu 14.04 Touchpad Issues
sudo apt-get install libevdev-dev
sudo aptitude purge xserver-xorg-input-synaptics
sudo aptitude build-dep xserver-xorg-input-synaptics
sudo git clone git://anongit.freedesktop.org/xorg/driver/xf86-input-synaptics
cd xf86-input-synaptics
wget -q -O - http://xps13-9333.appspot.com/root/0001-Don-t-use-finger-width-for-the-palm-detection.patch | git am
@cmbaughman
cmbaughman / port_scan.sh
Created October 17, 2014 17:58
The poorman's port scanner!
#!/bin/bash
for port in {1..65536}; do
nc -zv 127.0.0.1 $port 2>&1
done | grep open
@cmbaughman
cmbaughman / deploy_to_aws.sh
Created October 30, 2014 00:40
Deploy dockerfile to aws originally by mvanholsteijn, adjustments by me.
#!/bin/bash
shopt -r -o
declare SCRIPT=${0##*/}
#
# all functions
#
function usage() {
echo USAGE: $0 application-name zip-file [environment] [solution-stack]>&2
@cmbaughman
cmbaughman / Install_Readytalk.sh
Created November 4, 2014 18:30
Ready Talk on Linux
# Just run this command:
bash -c "wget 'https://core.readytalk.com/interface/bin/installer/linux-x86_64/WebMeetingInstaller.sh' -O /tmp/WebMeetingInstaller.sh && sh /tmp/WebMeetingInstaller.sh"