Skip to content

Instantly share code, notes, and snippets.

View ch1bo's full-sized avatar

Sebastian Nagel ch1bo

View GitHub Profile
@ch1bo
ch1bo / Main.hs
Created November 25, 2020 13:03
servant-exceptions impure exceptions example
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeOperators #-}
module Main where
import Control.Exception.Base (ErrorCall)
@ch1bo
ch1bo / aws-mfa
Last active March 25, 2020 15:56
AWS environment setup with MFA devices
#!/usr/bin/env bash
set -e
SERIAL_NUMBER=$1
TOKEN_CODE=$2
if [ -z "${SERIAL_NUMBER}" ] || [ -z "${TOKEN_CODE}" ]; then
# Clear when called with eval
>&2 echo "# Clearing credentials"
echo "unset AWS_ACCESS_KEY_ID"
@ch1bo
ch1bo / aws-yk
Last active March 25, 2020 15:52
Interactive AWS profile selection and environment setup using a yubikey, fzf and constistent names in ~/.aws/credentials
#!/usr/bin/env bash
set -e
if [ -z "$(which aws)" ] || [ -z "$(which fzf)" ] || [ -z "$(which ykman)" ] || [ -z "$(which jq)" ]; then
>&2 echo "# This script requires 'aws', 'fzf', 'ykman' and 'jq' to be installed"
exit 1
fi
function clear-credentials {
>&2 echo "# Clearing credentials"