Skip to content

Instantly share code, notes, and snippets.

View seanorama's full-sized avatar

Sean Roberts seanorama

  • Cloudera (formerly Hortonworks, Rackspace)
  • London, UK
  • X @seano
View GitHub Profile
@seanorama
seanorama / auto_configure_aws_cli_sso_roles.sh
Last active November 30, 2023 16:31 — forked from lukeplausin/auto_configure_aws_cli_sso_roles.sh
Automatically configure AWS SSO configuration file for all available accounts and roles
#!/usr/bin/env bash -e
# How to use this script:
# 1. Follow these instructions to configure a single AWS account to do initial login with SSO
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html
# 2. Export AWS_PROFILE=... and then run "aws sso login" to get an SSO token
# 3. Once signed in with AWS SSO, run this script to automatically list out all the other accounts and roles and add them to your config file
# If you want to filter roles / accounts in the process, or validate config before committing it, you can customise the script to do this.
[
{
"core-site" : {
"fs.s3a.endpoint" : "s3.eu-central-1.amazonaws.com"
}
}
]
@seanorama
seanorama / brew-cask-upgrade-list.sh
Last active February 21, 2017 08:24 — forked from n0ts/brew-cask-upgrade.sh
brew cask upgrade
#!/usr/bin/env bash
for c in $(brew cask list); do
info=$(brew cask info ${c})
installed_ver=$(echo "$info" | cut -d$'\n' -f1 | tr -d ' ' | cut -d':' -f 2)
current_ver=$(echo "$info" | cut -d$'\n' -f3 | cut -d' ' -f 1 | rev | cut -d'/' -f 1 | rev)
if [ "$installed_ver" != "$current_ver" ]; then
echo "## ${c} is installed '$installed_ver', current is '$current_ver'"
echo brew cask reinstall ${c}
fi
@seanorama
seanorama / cask_upgradeable_list.sh
Last active December 2, 2016 09:32
Script upgrading outdated brew casks
#!/usr/bin/env bash
(set -x; brew update;)
(set -x; brew cleanup;)
(set -x; brew cask cleanup;)
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
#!/bin/bash
checkusage() {
[[ $# -eq 0 ]] && err_exit 'Usage: diskcheck.sh DEVICE...'
}
checkperms() {
for disk in $@; do
local f="diskcheck.sh: ${disk}"
[[ -e ${disk} ]] || err_exit "${f}: No such file or directory"
# Put expressions that hit more files first.
/home/chroot/.*
/home/[^/]+/Workspaces?/.*/target/.*
/home/[^/]+/Workspaces?/.*/\.pants\.d.*
/home/[^/]+/\.m2/repository/.*
/home/[^/]+/\.ivy2/(?:cache|local|limiter)/.*
/home/[^/]+/.*(?:~|\.(?:log|tmp|bak|lock))
/home/[^/]+/S3/.*
/home/[^/]+/Virtualization/Machines/.*
@seanorama
seanorama / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console