Skip to content

Instantly share code, notes, and snippets.

View kkumler's full-sized avatar
Verified

Kris Kumler kkumler

Verified
View GitHub Profile
@kkumler
kkumler / clear-task-definitions.sh
Last active April 12, 2024 14:46
Remove AWS ECS Task Definitions in bulk
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
FAMILY_PREFIX=""
# Ensure variables are set, that we don't directly use. This works do to the nounset option.
[[ "${AWS_PROFILE:?}" ]]
@kkumler
kkumler / gist:91f23b3e385f21c254db13a590d80176
Created April 9, 2024 16:52
AWS service compatibility for a region
# Given a file with a list of required services, sorted
# This could be created by aws ssm get-parameters-by-path --path /aws/service/global-infrastructure/regions/us-east-1/services --query 'Parameters[].Name' --output yaml | cut -d'/' -f8 | sort > aws-services-us-east-1.txt
# And using GNU coretools (prefixed here with g, as usual with Homeberw on macos)
# Environment variables AWS_PROFILE & REGION exported
gcomm -2 -3 required-services.txt <(aws ssm get-parameters-by-path --path /aws/service/global-infrastructure/regions/$REGION/services --query 'Parameters[].Name' --output yaml | cut -d'/' -f8 | sort)
@kkumler
kkumler / get-parameters.sh
Last active October 25, 2022 17:09
Get a set of parameters from Systems Manager Parameter Store and format them for use as environment variables
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# As is the classic warning, this is so far light on error handling.
# Get a set of parameters from Systems Manager Parameter Store and format them for use as environment variables
# Usage: ./get-parameters.sh [--export] prefix [prefix...]
# Options:
@kkumler
kkumler / whatFilesHaveIShared.gs
Created June 24, 2019 15:00 — forked from danjargold/whatFilesHaveIShared.gs
Google script to list (on a Google Sheet) all files shared in your google drive, including all viewers, editors, and sharing permissions. Credit goes to @woodwardtw (https://gist.github.com/woodwardtw/22a199ecca73ff15a0eb) as this is an improvement on his code which only assesses a single folder and one level of sub-folders down.
function listFolders(folder) {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow(["Name", "Sharing Access", "Sharing Permission", "Get Editors", "Get Viewers", "Date", "Size", "URL", "Download", "Description", "Type"]); //writes the headers
//var folder = DriveApp.getFolderById("INSERT_YOUR_FILE_ID");//that long chunk of random numbers/letters in the URL when you navigate to the folder
//getLooseFiles(folder, sheet);
//getSubFolders(folder, sheet);
//instead of getting folder by ID rather get all folders and cycle through each. Note this will miss loose files in parent directory.
var folder = DriveApp.getFolders()
{
"title": "Change option+x to c, for when your c key breaks",
"rules": [
{
"description": "Change option+x to c",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "x",
@kkumler
kkumler / keybase.md
Created January 10, 2018 19:57
keybase.md

Keybase proof

I hereby claim:

  • I am kkumler on github.
  • I am kkumler (https://keybase.io/kkumler) on keybase.
  • I have a public key ASBxMX3sDYIPNPtC11O16lLeRTkGFnFawhH56VmAlQBkvgo

To claim this, I am signing this object:

@kkumler
kkumler / .config_git_attributes
Created December 8, 2017 20:40
Simple dicom git diff
*.dcm diff=dcmdump
@kkumler
kkumler / post-checkout
Last active December 11, 2015 23:19
git post-checkout hook to stop spring when checking out a new branch.
#!/bin/bash
PREV_HEAD=$1
NEW_HEAD=$2
BRANCH_CHECKOUT=$3
if [[ $BRANCH_CHECKOUT == 1 ]]; then
# Show when it's been stopped, but not that it's already stopped.
bin/spring stop | grep --color=never stopped
fi
@kkumler
kkumler / iam-assume-role.sh
Last active September 24, 2015 20:30 — forked from ambakshi/iam-assume-role.sh
Assume an IAM role. An interesting way of doing IAM roles is to give the instance permissions to assume another role, but no actual permissions by default. I got this idea while setting up security monkey: http://securitymonkey.readthedocs.org/en/latest/quickstart1.html#setup-iam-roles.
#!/bin/bash
#
# Assume the given role, and print out a set of environment variables
# for use with aws cli.
#
# To use:
#
# $ eval $(./iam-assume-role.sh)
#
@kkumler
kkumler / s3.sh
Last active August 29, 2015 14:20 — forked from chrismdp/s3.sh
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1