Skip to content

Instantly share code, notes, and snippets.

View bdruth's full-sized avatar

Brice Ruth bdruth

  • Deerfield, WI
  • 16:20 (UTC -05:00)
View GitHub Profile
@bdruth
bdruth / README.md
Last active April 28, 2020 14:18
Credentials slurper to work with SAML to AWS STS keys conversion extension in Chrome

For folks using the SAML to AWS STS keys conversion extension in Chrome to use their AWS account from the CLI that might have a prior version of my automatic 'credentials' slurper - I made some improvements to that script to allow exporting the temporary credentials directly to the ENV instead of only being able to set a profile in ~/.aws/credentials

Usage:
/> source path/to/script.sh <profile to slurp> # sets up profile in ~/.aws/credentials & exports AWS_PROFILE accordingly
/> source path/to/script.sh -e <profile to slurp> # sets AWS_* vars in current shell for apps that can't use profile credentials

Note: Each invocation undoes the vars set by the opposite invocation (you can't have both set and get predictable results)

@bdruth
bdruth / upgrade.sh
Last active April 21, 2021 20:56
dafang-uboot-upgrade-1080p
#!/bin/sh
set -ex
cd /system/sdcard
curl -L -o dafang_128mb_v2.bin https://github.com/Dafang-Hacks/uboot/blob/master/compiled_bootloader/dafang_128mb_v2.bin?raw=true
set +x
MD5=$(md5sum dafang_128mb_v2.bin)
EXPECTED_MD5="aab52eefe246dc1e15e56b253df3d64f dafang_128mb_v2.bin"
#!/bin/bash
WITH_RESOURCE="true"
function analyzePolicies() {
jq '.AttachedPolicies[].PolicyArn' | xargs -n 1 echo |
while read arn; do
version=$(aws iam get-policy --policy-arn $arn | jq '.Policy.DefaultVersionId' | xargs -n 1 echo);
aws iam get-policy-version --policy-arn $arn --version-id $version;
done |

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@bdruth
bdruth / getLatest.sh
Created May 18, 2016 18:35
Get the latest Amazon Windows Base AMI ID
aws ec2 describe-images \
--owners amazon \
--filters \
"Name=architecture,Values=x86_64" \
"Name=platform,Values=windows" \
"Name=description,Values=Microsoft Windows Server 2012 R2*Locale English*" \
"Name=name,Values=*Base*" | \
jq -r '.Images[-1].ImageId'
@bdruth
bdruth / Dockerfile
Last active October 14, 2015 13:11
Dockerfile for puppetlabs-aws experimentation
FROM cgswong/aws:latest
RUN apk update && apk add ruby
RUN gem install --no-rdoc --no-ri aws-sdk-core retries puppet
RUN puppet module install puppetlabs-aws
RUN addgroup -S puppet && adduser -G puppet -D -S -s /bin/bash puppet
bruth@MacBook-Pro-2:~
> ls -l .lein/plugins && unzip -l .lein/plugins/pallet-lein-template-0.2.5.jar []
total 16
-rw-r--r-- 1 bruth bruth 5336 Jul 22 20:21 pallet-lein-template-0.2.5.jar
Archive: .lein/plugins/pallet-lein-template-0.2.5.jar
Length Date Time Name
-------- ---- ---- ----
81 07-10-12 14:49 META-INF/MANIFEST.MF
2290 07-10-12 14:49 META-INF/maven/pallet/lein-template/pom.xml
95 07-10-12 14:49 META-INF/maven/pallet/lein-template/pom.properties