Skip to content

Instantly share code, notes, and snippets.

@gordcorp
gordcorp / GeoWebCacheService.py
Created February 8, 2016 03:51
Empty and reseed GeoServer GeoWebCache
import requests
class GeoWebCacheService(object):
"""Class to communicate with the geowebcache api.
Api doco here: http://geowebcache.org/docs/current/rest/seed.html
"""
_url = None
_username = None
_password = None

Keybase proof

I hereby claim:

  • I am bjgordon on github.
  • I am bjgordon (https://keybase.io/bjgordon) on keybase.
  • I have a public key whose fingerprint is 6FC9 79BA 603F F38A 05AC 145D E88C 3537 3A86 7010

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am gordcorp on github.
  • I am bjgordon (https://keybase.io/bjgordon) on keybase.
  • I have a public key whose fingerprint is 6FC9 79BA 603F F38A 05AC 145D E88C 3537 3A86 7010

To claim this, I am signing this object:

@gordcorp
gordcorp / update-env.sh
Created January 9, 2018 00:51
BOSH lite update-env
#!/bin/bash
set -u
set -x
# Clear previous current_manifest_sha value from state.json
sed -in 's/^.*current_manifest_sha.*$/"current_manifest_sha": "",/g' ~/deployments/vbox/state.json
bosh create-env ~/workspace/bosh-deployment/bosh.yml \
--state ~/deployments/vbox/state.json \
-o ~/workspace/bosh-deployment/virtualbox/cpi.yml \
@gordcorp
gordcorp / Dockerfile
Last active August 31, 2018 05:07
Give me a docker env with nodejs
FROM ubuntu:18.04
RUN apt-get update && \
apt-get -y --no-install-recommends install \
asciidoc \
ca-certificates \
curl \
gnupg2
RUN bash -o pipefail -c "curl -L https://deb.nodesource.com/setup_10.x | bash" && \
@gordcorp
gordcorp / rotate-deploy-key.sh
Created December 4, 2018 05:54
Example of rotating github repo deploy key in bash
#!/usr/bin/env bash
set -euo pipefail
: "${GITHUB_USER:?Need to set GITHUB_USER}"
: "${GITHUB_PERSONAL_ACCESS_TOKEN:?Need to set GITHUB_PERSONAL_ACCESS_TOKEN}"
CREDS="${GITHUB_USER}:${GITHUB_PERSONAL_ACCESS_TOKEN}"
URL=https://api.github.com
KEY_NAME=foo
@gordcorp
gordcorp / rotate.sh
Last active January 8, 2019 05:11
Rotate AWS access keys
function trim_to_one_access_key(){
iam_user=$1
key_count=$(aws iam list-access-keys --user-name "${iam_user}" | jq '.AccessKeyMetadata | length')
if [[ $key_count > 1 ]]; then
oldest_key_id=$(aws iam list-access-keys --user-name "${iam_user}" | jq -r '.AccessKeyMetadata |= sort_by(.CreateDate) | .AccessKeyMetadata | first | .AccessKeyId')
aws iam delete-access-key --user-name "${iam_user}" --access-key-id "${oldest_key_id}"
fi
}