Skip to content

Instantly share code, notes, and snippets.

View MattSurabian's full-sized avatar

Matthew Surabian MattSurabian

View GitHub Profile
@MattSurabian
MattSurabian / Quiche.md
Created February 26, 2015 02:50
Quiche Recipe

Quiche

It's not just for breakfast. It can make a great dinner!

Ingredients

  • 1.5 cups of milk
  • 1.5 cups of shredded cheese
  • 3 eggs
  • Filling of your choice:
@MattSurabian
MattSurabian / hoist.js
Last active August 29, 2015 14:17
Example of JS hoisting
// In this case the variable hoisted ends up being declared
// but undefined before the if statement, because it is hoisted
(function(){
try {
if (hoisted) {
var hoisted = true;
console.log("This will not get printed")
}else{
console.log("This will be printed, because hoisted has been declared, but is not set to a truthy value.")
}
@MattSurabian
MattSurabian / output
Last active August 29, 2015 14:20
Output of the ProXPN Bash Client
$ proxpn
Welcome to the ProXPN OpenVPN Bash Client!
Which exit node would you like to use?
1) UK 4) Singapore 7) LA 10) Miami
2) Sweden 5) Dallas 8) NYC 11) Czech
3) Netherlands 6) BASIC 9) Seattle
Select an exit node:9
@MattSurabian
MattSurabian / DATE-TITLE.md
Last active August 29, 2015 14:22
Basic post markdown file required for a podcast site powered by Jekyll
---
layout: episode
number: "000"
duration: "TIME:CODE:LENGTH"
length: "FILE_BYTES"
title: "The Episode's Title"
short_description: "This is a short description about the episode."
aac_asset_link: "LINK TO AAC ENCODED EPISODE"
ogg_asset_link: "LINK TO OGG ENCODED EPISODE"
@MattSurabian
MattSurabian / podcast-producer-iam.json
Created June 2, 2015 02:12
The IAM policy we use for the Rubber Ducking podcast.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::rubberduckcast.com/*",
"arn:aws:s3:::rubberduckcast.com",
"arn:aws:s3:::episodes.rubberduckcast.com/*",
@MattSurabian
MattSurabian / credentials
Created June 2, 2015 02:17
Sample AWS CLI credentials file which includes the profile rubberduck in addition to the default.
[default]
aws_access_key_id = SOME_ACCESS_KEY_ID
aws_secret_access_key = SOME_SECRET_KEY_ID
[rubberduck]
aws_access_key_id = SOME_ACCESS_KEY_ID
aws_secret_access_key = SOME_SECRET_KEY_ID
@MattSurabian
MattSurabian / Makefile
Created June 10, 2015 13:16
How I cut reproducible builds in Go projects. The nice part about this method is that it allows devs to work on a project in a standard Go development environment while also allowing someone who ONLY HAS GO INSTALLED to clone an application anywhere they want and compile it from source. No deps need to be committed to the project repo and no rel…
# A Makefile for Go projects
# This "makes" it easy to cut reproducible builds using an ignored _vendor
# directory and built in Go tooling. When this runs, it first executes the
# vendor.sh shell script. It then temporarily "blesses" your GOPATH with
# the _vendor directory. This ensures all modules will first be looked for
# in _vendor and anything else will get picked up from your standard Go workspace.
GO_CMD=$(shell which go 2>/dev/null)
GO_TEST=$(GO_CMD) test
GO_BUILD=$(GO_CMD) build
@MattSurabian
MattSurabian / coins.js
Created August 10, 2015 20:55
Monte Carlo Experiment
var startTime = Date.now();
var trials = 10000000;
var numQuarters = 8;
var quarterDelta = 6.667;
var quarterRadius = 1.213;
var dimeRadius = 0.895;
@MattSurabian
MattSurabian / coins.go
Created August 10, 2015 22:57
Monte Carlo experiment in Go
package main
import (
"time"
"math/rand"
"fmt"
)
func main() {
startTime := time.Now()
@MattSurabian
MattSurabian / ansible-hacks.tf
Last active December 14, 2015 17:22
terraform ansible provisioning hack uses environment variables:DEBIAN_FRONTEND=noninteractive, AWS_PRIV_KEY=one line using \n, ANSIBLE_HOST_KEY_CHECKING=false, AWS_ACCESS_KEY_ID, and AWS_SECRET_ACCESS_KEY
provider "aws" {
region = "us-east-1"
}
resource "aws_instance" "terraform-test" {
ami = "ami-408c7f28"
instance_type = "t1.micro"
key_name = "atlas-testing"
security_groups = ["terraform-testing"]
}