Skip to content

Instantly share code, notes, and snippets.

View flosell's full-sized avatar

Florian Sellmayr flosell

View GitHub Profile
@flosell
flosell / cleanup.sh
Created September 24, 2017 15:57
This gist reproduces hashicorp/vault#3368
#!/usr/bin/env bash
function echob() {
echo -e "\033[1m$1\033[0m"
}
function delete_user() {
local username="$1"
echo "deleting ${username}"
aws iam delete-access-key --user-name ${username} --access-key-id $(jq -r .AccessKey.AccessKeyId ${username}-credentials.json)
aws iam delete-user --user-name ${username}
@flosell
flosell / example-output
Last active January 31, 2017 21:05
Example on how one could implement notifications on build failures in LambdaCD
============ Build 2 failed! =============
Failed Step: (3 1 1 4) client-publish {:status :failure, :out Publishing to /tmp/mockrepo
cp: /tmp/mockrepo/client-snapshot.tar.gz: No such file or directory
, :exit 1}
Failed Step: (3 2 1 4) server-publish {:status :failure, :out Publishing to /tmp/mockrepo
cp: /tmp/mockrepo/server-snapshot.tar.gz: No such file or directory
, :exit 1}
@flosell
flosell / hook-dns-01-lets-encrypt-route53.py
Last active December 16, 2016 09:44
Python 3 script to use as a hook for the letsencrypt.sh client (without needing a profile)
#!/usr/bin/env python3
# How to use:
#
# LE_HOSTED_ZONE=XXXXXX LE_AWS_PROFILE=dns-access ./letsencrypt.sh --cron --domain example.org --challenge dns-01 --hook /tmp/hook-dns-01-lets-encrypt-route53.py
#
# More info about letsencrypt.sh: https://github.com/lukas2511/letsencrypt.sh/wiki/Examples-for-DNS-01-hooks
# Using AWS Profiles: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-multiple-profiles
# Obtaining your Hosted Zone ID from Route 53: http://docs.aws.amazon.com/cli/latest/reference/route53/list-hosted-zones-by-name.html
@flosell
flosell / debug-core-async.clj
Created October 16, 2016 12:11
Utility functions that can replace standard core.async functions and track which writes were stuck. good to debug core async deadlocks
(ns debug-core-async
(:require [clojure.core.async :as async])
(:import (java.util UUID)
(org.apache.commons.lang.exception ExceptionUtils)))
(defonce chans (atom {}))
(defonce open-writes (atom {}))
(defn reset-state []
(reset! chans {})
@flosell
flosell / core.clj
Last active August 3, 2016 19:22
LambdaCD as a CLI - Minimal example
(ns my-first-pipeline.core
(:require
[lambdacd.util :as util]
[lambdacd.core :as lambdacd]
[clojure.tools.logging :as log]
[lambdacd.internal.execution :as execution]
[lambdacd.steps.shell :as shell]
[lambdacd-git.core :as lambdacd-git]
[lambdacd.steps.control-flow :refer [with-workspace]]
[lambdacd.event-bus :as event-bus]
@flosell
flosell / go
Last active May 12, 2024 16:32
Template `./go` script as a main entrypoint into the development environment (http://www.thoughtworks.com/insights/blog/praise-go-script-part-i)
#!/bin/bash
set -e
SCRIPT_DIR=$(cd $(dirname $0) ; pwd -P)
die() {
red=$(tput setaf 1)
normal=$(tput sgr0)
echo "${red}${1}${normal}"