Skip to content

Instantly share code, notes, and snippets.

View sihil's full-sized avatar

Simon Hildrew sihil

View GitHub Profile
@sihil
sihil / deleteZone.sc
Created December 10, 2020 13:05
Ammonite script to delete a Route53 zone (since you have to delete all the records first 😭)
import $ivy.`software.amazon.awssdk:route53:2.15.42`
import software.amazon.awssdk.services.route53.{Route53Client, Route53ClientBuilder}
import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider
import software.amazon.awssdk.regions.Region
import software.amazon.awssdk.services.route53.model.{Change, ChangeAction, ChangeBatch, ChangeResourceRecordSetsRequest, DeleteHostedZoneRequest, HostedZone, ListHostedZonesRequest, ListResourceRecordSetsRequest}
import scala.collection.JavaConverters._
@main
def main(zoneId: String, profile: String) = {
@sihil
sihil / clone-recent-repos.sh
Created March 20, 2019 13:49
A script to clone recently used github repos
#!/bin/bash -e
if [ -z "$1" -o -z "$2" ]; then
cat <<MSG
${BASH_SOURCE[0]} is a script to clone recently used github repos. Potentially
useful when you have a new laptop.
Usage: ${BASH_SOURCE[0]} user token [clone_dir] [months]
user: your github username
token: a github token with enough permission to see the repos you want
@sihil
sihil / Attempt.scala
Last active December 14, 2017 16:48
Attempt
package utils.attempt
import cats.data.EitherT
import scala.concurrent.{ExecutionContext, Future}
import scala.util.control.NonFatal
/**
* Represents a value that will need to be calculated using an asynchronous
* computation that may fail.
@sihil
sihil / keybase.md
Created July 20, 2017 10:27
my keybase proof

Keybase proof

I hereby claim:

  • I am sihil on github.
  • I am sihil (https://keybase.io/sihil) on keybase.
  • I have a public key whose fingerprint is 40C6 DFE9 FE2A 94F8 E3BF 5F5F 0C15 D6A7 8215 2459

To claim this, I am signing this object:

@sihil
sihil / synchronise.sh
Created December 19, 2016 15:47
Script for gluing nsnotifyd and cli53 together
#!/bin/bash
set -e
# Script to update a zone - designed to be triggerd by nsnotifyd
PATH=/bin:/usr/bin:/usr/local/bin:$PATH
# Constants
DYN_TRANSFER_HOST=xfrout1.dynect.net
# Get command line parameters
ZONE=$1
@sihil
sihil / plambda.yaml
Created October 5, 2016 21:33
Snippet of some CloudFormation resources for Plambda
API:
Type: AWS::ApiGateway::RestApi
Properties:
Name:
Fn::Join:
- " "
- - Restorer Plambda
- Ref: Stage
Description: Experimental Restorer Play app in Lambda
@sihil
sihil / .gitignore
Created April 15, 2016 11:43
Global Git Ignore
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
@sihil
sihil / prism.json
Last active February 24, 2016 18:05
{
"data" : {
"images" : [ {
"arn" : "arn:aws:ec2:eu-west-1::image/ami-XXXXXXXX",
"name" : "ubuntu-vivid-java8_408_2016/02/17_12-18-34",
"imageId" : "ami-XXXXXXXX",
"region" : "eu-west-1",
"description" : "AMI for ubuntu-vivid-java8 built by TeamCity: tools-machine-images#408",
"tags" : {
"Name" : "ubuntu-vivid-java8_408_2016/02/17_12-18-34",
@sihil
sihil / iam-upload.sh
Last active September 18, 2015 10:08
Bash script for uploading certificates to IAM
#!/bin/bash
# Upload a certificate and chain to AWS
set -e
DOMAIN=$1
if [ -n "$2" ]; then
PROFILE_PARAM="--profile $2"
fi
if [ -z "${DOMAIN}" ]; then
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Publish or be damned.",
"Parameters": {
"SubscriberPrincipals": {
"Type": "CommaDelimitedList",
"Description": "Account IDs to allow subscription from."
},
"Stage": {
"Type": "String",