Skip to content

Instantly share code, notes, and snippets.

View fairchild's full-sized avatar

Michael Fairchild fairchild

  • Procore
  • California
View GitHub Profile
@fairchild
fairchild / timed_subprocess.rb
Last active March 21, 2017 04:58
method to wrap a subprocess in a timeout
require 'timeout'
SUBPROCESS_TIMEOUT = 90
def timed_shell_command(cmd)
begin
Timeout.timeout(SUBPROCESS_TIMEOUT) do
subprocess = IO.popen(cmd)
Process.wait subprocess.pid
unless $?.success?
@fairchild
fairchild / mobile_data_creation_first.websequence
Created March 31, 2016 07:01
sync flow for data created on mobile first
title Create Data Mobile First
participant mobile as m
participant server as s
participant database as db
m -> m: create item {uuid}
m -> s: POST item {uuid}
s -> db: begin transaction
s -> db: SELECT id, uuid WHERE uuid={uuid} from write_log
@fairchild
fairchild / gist:262248
Created December 23, 2009 01:40
example of posting an anonymous gist with curl
curl -i -F file_name[gistfile1]='foooo' -F file_contents[gistfile1]='abcde' -F file_ext[gistfile1]='.sh' http://gist.github.com/gists
local application = require "hs.application"
local tiling = require "hs.tiling"
local hotkey = require "hs.hotkey"
local Spotify = require "hs.spotify"
-- TODO: Move more stuff into these
-- custom scripts
require "sizeup"
require "triggers"
@fairchild
fairchild / breezy-sample.breeze.json
Created January 27, 2014 19:27
sample breeze project
[]
@fairchild
fairchild / Vagrantfile
Last active January 2, 2016 11:09
sample Vagrantfile
Vagrant.configure(2) do |config|
config.ssh.forward_agent = true
config.vm.define "www", :primary=>true do |www|
end
# ================================================
@fairchild
fairchild / .babelrc
Last active December 29, 2015 22:44
simple example of getting babel 6 running
{
"presets": ["es2015"]
}
@fairchild
fairchild / commonrc
Last active December 28, 2015 15:39
a localrc for the controller node
# Enable Logging
LOGFILE=/opt/stack/logs/stack.sh.log
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs
@fairchild
fairchild / Dockerfile
Last active December 27, 2015 10:09
dockerfile defining a basic apt-cacher-ng service
# Apt-Proxy hosting image
#
# VERSION 0.1.0
# Use a modified version of the Ubuntu base image provided by dotCloud
FROM fairchild/ubuntu
MAINTAINER Michael Fairchild fairchild@stimble.net
ENV APT_PROXY apt.dockerdev.att.io
RUN apt-get update && apt-get install -y apt-cacher-ng
@fairchild
fairchild / setup.sh
Created July 8, 2013 17:42
script that can be passed as userdata when booting an instance. It fetches a gist of bash functions and runs the ones called in the main function.
#!/bin/bash
# Setup a new ubuntu 12.04 or 12.10 server appropriate for deploying nodejs and/or ruby applications.
set -x
set -e
# mkdir -p /tmp/user_data
date >> /tmp/provisioning_began