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 / 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
@jesserobertson
jesserobertson / Gerris.YAML-tmLanguage
Created March 10, 2015 00:55
Syntax highlighting for Gerris solver files for Sublime Text editors
# [PackageDev] target_format: plist, ext: tmLanguage
# Gerris syntax highlighting (fairly crappy at this stage)
---
name: Gerris
scopeName: source.gerris
fileTypes: ["gfs"]
uuid: 959c45c1-fa9c-428c-b2a2-e74f9ee51c2f
foldingStartMarker: '\{\s*$'
foldingStopMarker: '^\s*\}'
@jesserobertson
jesserobertson / randomizing_authors.py
Created January 8, 2015 07:24
Randomizing an author list using atmospheric noise
import requests, simplejson
# Insert your API key here
api_key = '<my_api_key>'
# Some random names from http://www.namesgenerator.org/100-random-names/
authors = [
"Staffan Krammerer", "Rosalinda Stavoua", "Tahsin Tomms",
"Saikhantuya Stronge", "Bronte Movileanu", "Mykel Eletti",
"Brendan Hamzová", "Utaka Heldt", "Alekzander Ogiemwonyi",