Skip to content

Instantly share code, notes, and snippets.

View MattSurabian's full-sized avatar

Matthew Surabian MattSurabian

View GitHub Profile
@MattSurabian
MattSurabian / node-chrome-headless
Last active August 25, 2017 20:56
Dockerfile that builds an image running headless chrome and nodejs 8.4 in Ubuntu stable for sir calvin https://twitter.com/CWMma/status/901127364352114689
###
# node-chrome-headless
# Builds an image capable of running nodejs 8.4 and headless Chrome in an Ubuntu container.
# Build with docker build .
# Based off: https://hub.docker.com/r/justinribeiro/chrome-headless/
# Suggested run command: docker run -d -p 9222:9222 --cap-add=SYS_ADMIN
#
FROM ubuntu
resource "aws_route53_record" "domain-com_A_consul-domain-com" {
zone_id = "${var.domain_zone_id}"
type = "A"
name = "consul"
ttl = "1"
records = ["${aws_instance.host.0.public_ip}", "${aws_instance.host.1.public_ip}", "${aws_instance.host.2.public_ip}"]
}
// or

The CoreMetrics analytics library can be asychronously loaded; their knowledge base provides an example implementation that may not function as intended if it is used exactly as written:

<body>
<script type='text/javascript'>
var cmTagQueue = cmTagQueue || [];
cmTagQueue.push(['cmSetClientID', '99999999', false, "testdata.coremetrics.com", "mysite.com"]);
cmTagQueue.push(['cmCreatePageviewTag','AsyncTestPageID','AsyncTestPageID']);
@MattSurabian
MattSurabian / JsonModule.js
Created May 5, 2016 14:34
easy to generate webpack module with custom object body
'use strict';
var NormalModule = require('webpack/lib/NormalModule');
function JsonModule(request, parser, body) {
NormalModule.call(this, request.request, request.request, request.request, [], request.request, parser);
this.body = body;
return this;
}

Setting Tags in Terraform

Determine some sensible tags to pass non-critical information to Ansible or other CM solutions:

resource "aws_instance" "main" {
...
  tags {
  ...
    "some_tag" = "waka"

Jira Query

14 Days of Mentions

(summary ~ currentUser() OR description ~ currentUser() OR comment ~ currentUser()) and updatedDate >= -14d
@MattSurabian
MattSurabian / credentials
Last active March 21, 2016 14:20
Should live in ~/.aws/
[default]
aws_access_key_id = SOME_ACCESS_KEY_ID
aws_secret_access_key = SOME_SECRET_KEY_ID
@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"]
}
@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 / 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;