Skip to content

Instantly share code, notes, and snippets.

View dooferlad's full-sized avatar

James Tunnicliffe dooferlad

  • Octopus Energy
  • Oxford, UK
View GitHub Profile
#!/usr/bin/env python3
from subprocess import run
import os
import sys
import configparser
import yaml
#!/usr/bin/env bash
set -e
if [ "$#" -lt 1 ]
then
echo "Usage: update-kubeconfig <aws profile> [cluster-name]"
exit 1
fi

Keybase proof

I hereby claim:

  • I am dooferlad on github.
  • I am dooferlad (https://keybase.io/dooferlad) on keybase.
  • I have a public key ASCdFWB_UDUzfspgkjlG-ele8GCOfwivIrvoaB2xxcc5bgo

To claim this, I am signing this object:

@dooferlad
dooferlad / logglyq
Created August 2, 2019 12:04
Search Loggly on the command line
curl -H 'Authorization: bearer $LOGGLY_APIKEY' "http://octoenergy.loggly.com/apiv2/events?rsid=$(curl -H 'Authorization: bearer $LOGGLY_APIKEY' "http://octoenergy.loggly.com/apiv2/search?q=$1" | jq .rsid.id | xargs)" | jq $2
@dooferlad
dooferlad / vpprint.py
Last active July 31, 2019 14:45
Very pretty print of Django objects
from django.db import models
def vpprint(item):
"""
Very pretty print of Django objects
:param item: Object to print
:return: None
"""
print(item.__class__.__name__)
_vpprint(item, [item.__class__.__name__], set())
@dooferlad
dooferlad / main.go
Created August 30, 2017 15:46
An HTTP server that responds slowly.
package main
import (
"fmt"
"log"
"net/http"
"time"
"github.com/julienschmidt/httprouter"
@dooferlad
dooferlad / reset_maas_static_pool.py
Created August 7, 2015 14:46
Delete all static address allocations from a mass called maas.
#!/usr/bin/python
import subprocess
import json
addresses = json.loads(subprocess.check_output("maas maas ipaddresses read", shell=True))
for addr in addresses:
subprocess.check_call("maas maas ipaddresses release ip=" + addr['ip'], shell=True)