Skip to content

Instantly share code, notes, and snippets.

View morancj's full-sized avatar

Ciaran Moran morancj

View GitHub Profile
@morancj
morancj / .envrc example
Last active August 11, 2021 08:40 — forked from defanator/.envrc
Example of direnv .envrc configuration for working with awscli as MFA-enabled IAM user
#
# Copyright (C) Andrei Belov (defanator@gmail.com)
#
# This is an example of direnv [1] .envrc file approaching the way
# of using awscli [2] with MFA-enabled accounts in a (more or less)
# secure manner.
#
# The following assumptions are expected:
#
# a) there should be two files, key.asc and skey.asc, containing
#!/bin/bash
set -e
# Get first remote name
_first_remote=$(git remote -v | head -1 | nawk '{print $1}')
# Get first remote default branch name
_default_branch=$(git remote set-head "${_first_remote}" -a | nawk '{print $NF}')
_working_branch=$(git branch --show-current)
check_working_branch() {
@morancj
morancj / sway-config
Created December 17, 2020 18:39 — forked from tuxPT/sway-config
sway config
# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
exec wal -R
#notifications
exec mako
exec mailnag
@morancj
morancj / dockerhub-v2-api-organization.sh
Created July 29, 2020 10:24 — forked from kizbitz/dockerhub-v2-api-organization.sh
Get the list of images and tags for a Docker Hub organization account
#!/bin/bash
# Example for the Docker Hub V2 API
# Returns all images and tags associated with a Docker Hub organization account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username, password, and organization
UNAME=""
UPASS=""
ORG=""

Keybase proof

I hereby claim:

  • I am morancj on github.
  • I am morancj (https://keybase.io/morancj) on keybase.
  • I have a public key ASBj8QH-WDZqjkLDw7EQhL75HSLjvLA7ELSgNL2XrISy9Ao

To claim this, I am signing this object:

@morancj
morancj / znp
Created May 18, 2020 16:29 — forked from erikw/znp
znp: Wrap shell command in ZFS pre-post snapshots and log outputs.
#!/usr/bin/env bash
# Runs a command wrapped in ZFS pre-post snapshots. The whole data pool is recursively snapshotted.
# Analogous to my snp script for BTRFS: https://gist.github.com/erikw/5229436
# Usage: $ znp <commands>
# e.g.: $ znp pgk upgrade
# e.g.: $ znp portmaster -aG
# e.g.: $ znp freebsd-upgrade install
zfs_pool=zroot
#list all accounts
aws organizations list-accounts
# List all accounts in a table, don't use client-side pager
# How to Filter the Output with the --query Option:
# https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-output.html#cli-usage-output-filter
# Client-side Pagination:
# https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html#cli-usage-pagination-clientside
AWS_PAGER="" aws organizations list-accounts --query 'Accounts[*][Id,Name]' --output table