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 / arduino_multibyte_serial_example.cpp
Created April 13, 2009 07:37
Simple updated examples of arduino serial communications
/* ------------------------------------------------
* SERIAL COM - HANDELING MULTIPLE BYTES inside ARDUINO - 03_function development
* by beltran berrocal
*
* this prog establishes a connection with the pc and waits for it to send him
* a long string of characters like "hello Arduino!".
* Then Arduino informs the pc that it heard the whole sentence
*
* the same as examlpe 03 but it deploys 2 reusable functions.
* for doing the same job.

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@fairchild
fairchild / regexp_syntax.md
Created January 16, 2023 16:48 — forked from glv/regexp_syntax.md
Ruby and PostgreSQL Regular Expressions

Ruby and Postgres Regular Expression Syntaxes

Ruby's regular expressions are unusually powerful. Postgres' regular expressions are not as powerful, but they come close; close enough that it's possible to do many pattern-based queries and string transformations entirely in a query.

And sometimes, it's very useful to have a single regular expression that works

@fairchild
fairchild / Gemfile
Created December 7, 2011 09:58
An example sinatra omniauth client app
source :rubygems
gem 'sinatra'
gem 'json'
gem 'omniauth'
gem 'omniauth-oauth2'
gem 'omniauth-github'
# gem 'omniauth-att', :path => File.expand_path("./../../omniauth-att", __FILE__)
gem 'thin'
@fairchild
fairchild / setup.sh
Created July 1, 2012 21:22
Setup a Ubuntu 12.04 server for serving a ruby and nodejs apps
#!/bin/bash
set -x
set -e
# Setup a new ubuntu 12.04 server
# this file can be used as the userdata file for a new instance.
# It should set any environments variables needed, and select which setup functions to run, in what order.
USERNAME=${1:-deploy}
APPNAME=${2:-deploy}
@fairchild
fairchild / bundle-to-ebs.sh
Created December 5, 2009 23:32
2 scripts that can be used to create an bootable EBS from a running instance. ami-4205e72b created with this process
#!/bin/bash -xe
EBS_DEVICE='/dev/sdh'
INSTANCE_ID=$1
AKI=${2:-'aki-5f15f636'}
ARI=${3:-'ari-0915f660'}
ARCH=${4:-'i386'}
SIZE=${5:-10}
AZ=${6:-'us-east-1d'}
NAME=${7:-"ami-from-$INSTANCE_ID"}
@fairchild
fairchild / user_data_functions.sh
Last active September 29, 2019 10:49
functions usefull in user-data deploy scrips.
fake_fuse () {
echo "hello faker fuse"
apt-get -y install libfuse2
cd /tmp ; apt-get download fuse
cd /tmp ; dpkg-deb -x fuse_* .
cd /tmp ; dpkg-deb -e fuse_*
cd /tmp ; rm fuse_*.deb
cd /tmp ; echo -en '#!/bin/bash\nexit 0\n' > DEBIAN/postinst
cd /tmp ; dpkg-deb -b . /fuse.deb
cd /tmp ; dpkg -i /fuse.deb
@fairchild
fairchild / logstash_indexer.conf
Created July 2, 2012 01:53
Logstash config example
input {
redis {
host => "127.0.0.1"
type => "redis-input"
# these settings should match the output of the agent
data_type => "list"
key => "logstash"
# We use json_event here since the sender is a logstash agent
message_format => "json_event"
}
import urllib
import plantumlencoder
from IPython.core.magic import magics_class, cell_magic, Magics
from IPython.display import Image, SVG
@magics_class
class Plantuml(Magics):
@cell_magic
@fairchild
fairchild / object_and_module_grapher.rb
Created February 8, 2009 21:21
graphviz of ruby class heriarchy, modified from http://objectgraph.rubyforge.org/
# jEdit :folding=explicit:collapseFolds=1:indentSize=2:tabSize=2:
# add requires here #{{{
#}}}
# handle command line #{{{
def usage #{{{
puts <<-USAGE