Skip to content

Instantly share code, notes, and snippets.

View jesserobertson's full-sized avatar
🐍
geopythonining

Jess Robertson jesserobertson

🐍
geopythonining
View GitHub Profile
@jesserobertson
jesserobertson / homebrew-dynamodb-local.md
Created December 19, 2018 23:22 — forked from dgoguerra/homebrew-dynamodb-local.md
Install dynamodb-local through Homebrew (custom formula)

Install dynamodb-local through Homebrew

An official formula for dynamodb-local existed, but was removed since dynamodb-local is not open source and stopped having versions.

Now its available either through a Cask, or by installing it as a formula from an unofficial tap (third party repo).

When installed as a cask dynamodb-local cannot be exposed as a service, so here we are installing it as a formula. It has been forked from rjcoelho/homebrew-boneyard and updated to be a head-only formula, to avoid checksum erros on new versions. It is available at dgoguerra/homebrew-boneyard.

# dynamodb-local depends on Java 6+
@jesserobertson
jesserobertson / mount-bitlocker
Created November 21, 2018 08:54 — forked from dumbledore/mount-bitlocker
Mount/umount wrapper for dislocker on MacOS
#!/bin/bash
BITLOCKER_PARTITION="${1}"
BITLOCKER_PASSWORD="${2}"
function usage() {
echo "$(basename ${0}) <partition> <password>"
echo "Unlocks and mounts a bitlocker partition as read-only"
}
if [ -z "${BITLOCKER_PARTITION}" ]
@jesserobertson
jesserobertson / wcs.py
Created October 4, 2018 23:04
mucking around with wcs requests
import requests
from lxml import etree
def hit(url, params):
"Hit a URL, parse the xml"
response = requests.get(url, params=params)
print(response.url)
if response.ok:
print(response.headers)
return etree.fromstring(response.content)
@jesserobertson
jesserobertson / main.tf
Created August 30, 2018 04:22
Rendering template file
data "template_file" "batch_policy_template" {
template = "${file("${path.module}/batch_ecs_instance_policy.json.tpl")}"
vars = {
bucket_name = "${module.email_storage.name}"
}
}
resource "aws_iam_role_policy" "test_policy" {
name = "test_policy"
role = "${aws_iam_role.aws_batch_service_role.id}"
policy = "${data.template_file.batch_policy_template.rendered}"
@jesserobertson
jesserobertson / instance_role.json.tftpl
Created August 30, 2018 04:18
ECS Instance role template for terraform
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ses:SendEmail",
"ses:SendRawEmail"
],
"Effect": "Allow",
"Resource": "*"
@jesserobertson
jesserobertson / jupyter_logging.py
Created June 13, 2018 03:37
Enable logging to a Jupiter notebook by module namespace
import logging, sys
def log_to_notebook(module=None, level='INFO'):
"""
Sets up logging to stdout so we can capture it in the notebook
Parameters:
module - the module to log from. To log only certain submodules
do something like `module='placer.stream'`. If None, default is
to get the root logger which logs everything.
@jesserobertson
jesserobertson / hashicorp
Last active June 13, 2018 03:40
Installer script for hashicorp tools
#!/usr/bin/env bash
# file: hashicorp.sh
# author: Jess Robertson, CSIRO Mineral Resources
# date: March 2017
#
# description: Download and install Hashicorp products from their
# release server. Note that this assumes that Hashicorp doesn't change
# their release URLS.
#
# Requires gnupg and openssl (see `install_dependencies`)

Keybase proof

I hereby claim:

  • I am jesserobertson on github.
  • I am jessrobertson (https://keybase.io/jessrobertson) on keybase.
  • I have a public key ASD_4QhDJ-LfxNAGMMvnfQlBOtfqGNV4xGWGZ_w2TfOUTgo

To claim this, I am signing this object:

@jesserobertson
jesserobertson / gist:3ea35b3ff1bf7f95ffdc36244e22203d
Created November 2, 2016 10:27 — forked from tjcorr/gist:3baf86051471062b2fb7
CloudFormation to demo etcd-aws-cluster
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "An etcd cluster based off an auto scaling group",
"Mappings" : {
"RegionMap" : {
"eu-central-1" : {
"AMI" : "ami-840a0899"
},
"ap-northeast-1" : {
"AMI" : "ami-6c5ac56c"
@jesserobertson
jesserobertson / install_bfg.md
Created March 16, 2016 02:39
Notes on burning out big git commits using the BFG repo cleaner on OSX

Installing the BFG

First make sure that you install Java using homebrew - the Oracle installer makes a terrible fscking mess of your machine :(

$ brew tap caskroom/cask
$ brew install brew-cask
$ brew cask install java