Skip to content

Instantly share code, notes, and snippets.

Jesse Dearing jessedearing

Block or report user

Report or block jessedearing

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jessedearing
jessedearing / g.go
Last active Oct 3, 2019
Simple go program to record timings for git pulls, pushes, and fetches
View g.go
package main
import (
"fmt"
"os"
"os/exec"
"strconv"
"strings"
"time"
)
View etcdvars.sh
export ETCDCTL_API=3 ETCDCTL_CACERT=$ETCD_TRUSTED_CA_FILE ETCDCTL_CERT=$ETCD_CERT_FILE ETCDCTL_KEY=$ETCD_KEY_FILE ETCDCTL_DISCOVERY_SRV=$ETCD_DISCOVERY_SRV
View main_rds.tf
resource "aws_db_instance" "main" {
allocated_storage = 10
storage_type = "gp2"
engine = "mysql"
engine_version = "5.7"
instance_class = "db.t2.micro"
name = "main"
username = "root"
password = "${data.external.something_in_one_password.result.password}"
parameter_group_name = "default.mysql5.7"
View one_password.tf
data "external" "something_in_one_password" {
program = ["${path.cwd}/bin/one_password.sh"]
query = {
vault = "Personal"
uuid = "abc123"
}
}
View one_password.sh
#!/usr/bin/env bash
set -e
# Eval so we can set the JSON values as shell variables
eval "$(jq -r '@sh "VAULT=\(.vault) UUID=\(.uuid)"')"
# Get the token or password from the first field of the second section (this is just how I store them, but you could use jq's select
password=`op get item --vault=$VAULT $UUID | jq -r '.details.sections[1].fields[0].v'`
View webtask_hack.js
const express = require('express')
const Webtask = require('webtask-tools')
const bodyParser = require('body-parser')
const MessagingResponse = require("twilio").twiml.MessagingResponse
const request = require('request-promise-native')
var app = express();
app.use(bodyParser.json());
View Risky Business.wiki

Risky Business

Presenter

Jesse Dearing

Abstract

As we operate production systems they inevitably fail. As they fail and fail and fail again we as operators start to identify the way they fail and we know the causes of the failures. What if we could see the future and predict failures before they happen. We're

View get_etc_hosts_by_aws_tag.sh
aws --profile invision ec2 describe-instances --filters "Name=tag:Service,Values=mongo" | jq -r '.Reservations[].Instances[] | .PrivateIpAddress + " "+ (.Tags[] | select(.Key == "Name")).Value' | v -
View README.md

This is a call to the RDS API to create new instances of MySQL. One of the things I've found really helpful is that as a staticly typed language, Go gives me reliable parameter autocomplete (via https://github.com/nsf/gocode) so I can pretty easily look up parameters to the *Input and *Output structs in all editors that have the integration In my case vim-go.

Amazon's Go API has a few quriks (like the pointers for everything needing the aws.String and aws.Bool convenience functions), but once you get into it flows easily.

Since the AWS functions are all in interfaces, I can mock github.com/aws/aws-sdk-go/service/rds/rdsiface using https://github.com/maxbrunsfeld/counterfeiter and write expectations in my unit tests.

@jessedearing
jessedearing / profile.go
Created Jan 5, 2017
Have go dump a stack trace on USR1
View profile.go
package main
import (
"os"
"os/signal"
"runtime/pprof"
"syscall"
)
func main() {
You can’t perform that action at this time.