Skip to content

Instantly share code, notes, and snippets.

Using the saml2aws utility, you can get a set of temporary AWS credentials that you can export to your docker container.
Use this command to put those credentials into a local environment file for docker:
$ saml2aws exec env | egrep 'AWS_(ACC|SECR|SES)' > env.file
Running command as: arn:aws:sts::123456789012:assumed-role/AWS-MyRole/username@globeandmail.com
You should now see AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN inside of env.file
Now start your container with the --env-file option, using the env.file you just created.
@shmick
shmick / config
Created February 13, 2019 15:10
~/.aws/config example
# ~/.aws/config example
[profile org-master]
aws_access_key_id=AK...
aws_secret_access_key=AY...
region=us-east-1
[profile org-acctfoo]
role_arn = arn:aws:iam::111111111111:role/OrganizationAccountAccessRole
source_profile = org-master
@shmick
shmick / mute
Created September 18, 2018 14:23
Twitter mute words
suggest_recycled_tweet_inline
suggest_activity_tweet
suggest_recycled_tweet
suggest_recap
suggest_who_to_follow
suggest_activity
suggest_pyle_tweet
suggest_ranked_timeline_tweet
@shmick
shmick / boto3_sts_assumerole
Last active May 24, 2018 14:07
A quick example for using roles within a boto3 script
import boto3
acct1_arn = 'arn:aws:iam::111111111111:role/S3-Write-Role'
acct2_arn = 'arn:aws:iam::222222222222:role/S3-Read-Role'
def switch_role(role_arn):
sts_client = boto3.client('sts')
response = sts_client.assume_role(
RoleArn=role_arn,
RoleSessionName="AssumeRoleSession"
#!/bin/bash
BASEURL="https://bitcoin.org/bin"
ARCH="arm-linux-gnueabihf"
VER=$(curl -s https://api.github.com/repos/bitcoin/bitcoin/releases | grep -m 1 tag_name | awk -F\" '{print $4}' | cut -c 2-)
DIR="bitcoin-core-$VER"
FILE="bitcoin-$VER-$ARCH.tar.gz"
FILEURL="$BASEURL/$DIR/$FILE"
SHA256HASH=$(curl -s $BASEURL/$DIR/SHA256SUMS.asc | grep $FILE | awk '{print $1}')
@shmick
shmick / verifyAkamaiIp.sh
Created January 24, 2017 15:56 — forked from rafaelfelix/verifyAkamaiIp.sh
Shell script to programmatically check if an IP address belongs to Akamai. Requires Akamai login, password and permission to access https://control.akamai.com/partner-tools/index.action?target=VerifyAkamaiIP
#!/bin/bash
#
# Issue request to Akamai tool verifyAkamaiIpInternal to check if
# the given IP address belongs to Akamai
#
## defining helper functions first
# show usage
@shmick
shmick / ColorTwinkles.ino
Created November 30, 2016 21:25 — forked from kriegsman/ColorTwinkles.ino
Twinkling 'holiday' lights that fade in and out.
#include "FastLED.h"
#define LED_PIN 3
#define LED_TYPE WS2811
#define COLOR_ORDER RGB
#define NUM_LEDS 50
CRGB leds[NUM_LEDS];
// Twinkling 'holiday' lights that fade up and down in brightness.
// Colors are chosen from a palette; a few palettes are provided.
@shmick
shmick / stripedTwinkle.ino
Created November 21, 2016 05:58 — forked from hsiboy/stripedTwinkle.ino
fastled - striped twinkle
void stripedTwinkle(){
int twinkle = 0;
int flash = 15; // twinkle flash time
int lag = 50; // time between twinkles
for (i = 0; i <LED_NUM i++)
{
if (i % 2 == 0)
{
leds[twinkle] = CRGB::Red;
/* Title: inoise8_pal_demo.ino
*
* By: Andrew Tuline
*
* Date: August, 2016
*
* This short sketch demonstrates some of the functions of FastLED, including:
*
* Perlin noise
* Palettes
@shmick
shmick / FastLED-Sunrise.ino
Created November 21, 2016 03:24 — forked from jasoncoon/FastLED-Sunrise.ino
Simple FastLED "sunrise" example that fades from black to red, orange, yellow, and white.
#include "FastLED.h"
// How many leds in your strip?
#define NUM_LEDS 60
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 3
#define CLOCK_PIN 13