Skip to content

Instantly share code, notes, and snippets.

View jsamuel1's full-sized avatar

Josh Samuel jsamuel1

  • Melbourne, Australia
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jsamuel1 on github.
  • I am jsamuel (https://keybase.io/jsamuel) on keybase.
  • I have a public key ASA9hW6CyKMB7rNeWruvLZMTGpr5SduIWm6IgxTFIQEbiwo

To claim this, I am signing this object:

@jsamuel1
jsamuel1 / instance-types.sh
Created September 25, 2018 04:52 — forked from trestletech/instance-types.sh
Get all EC2 Instance Types in All Availability Zones
#!/bin/bash
echo "Getting list of Availability Zones"
all_regions=$(aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' | sort)
all_az=()
while read -r region; do
az_per_region=$(aws ec2 describe-availability-zones --region $region --query 'AvailabilityZones[*].[ZoneName]' --output text | sort)
while read -r az; do
@jsamuel1
jsamuel1 / aws-s3-buckets-with-tags.sh
Last active February 25, 2019 04:36 — forked from filipenf/aws-s3-buckets-with-tags.sh
Print a list of aws buckets along with their tags
#!/bin/bash
# lists all buckets along with their tags in the following format:
# bucket_name | { tag_name: tag_value }
for bucket in `aws s3api list-buckets | jq .Buckets[].Name -r`; do
tags=$(aws s3api get-bucket-tagging --bucket $bucket 2>/dev/null | jq -c '.[][] | {(.Key): .Value}' | tr '\n' '\t')
echo $bucket '|' $tags
done
@jsamuel1
jsamuel1 / i3-gaps.sh
Last active February 11, 2019 00:09 — forked from dabroder/i3-gaps.sh
Install i3-gaps on ubuntu 18.04
#!/bin/bash
sudo apt install -y checkinstall libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev libxcb-util0-dev libxcb-icccm4-dev libyajl-dev libstartup-notification0-dev libxcb-randr0-dev libev-dev libxcb-cursor-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf libxcb-xrm0 libxcb-xrm-dev automake
cd /tmp
# clone the repository
git clone https://www.github.com/Airblader/i3 i3-gaps
cd i3-gaps
# compile & install
@jsamuel1
jsamuel1 / supportplan.sh
Last active February 13, 2019 02:30
AWS Enterprise Support Plan Enrollment
#!/bin/sh
# Call from the organization master accounts credentials after creating the account.
# Pass in the new account id.
aws support create-case --service-code customer-account --category-code other-account-issues --subject "Please add account $1 to our enterprise support plan" --severity-code low --communication-body "Please add account $1 to my organizations enterprise support plan"
@jsamuel1
jsamuel1 / 012_ecs_long_ids.tf
Created February 13, 2019 03:05
Terraform to enable long ARN formats for aws ecs, so that we can use fargate on all our workload accounts.
// Ensure we enroll ecs with long resource IDs
// Delete after April 1st as all new accounts will be enrolled by default
resource "null_resource" "enable_long_ecs_resource_ids" {
provisioner "local-exec" {
command = <<EOF
# $1=account_id, $2=region
source ${path.root}/../scripts/assume_role.sh \
${var.workload_account_id} \
${var.workload_provider_region}
@jsamuel1
jsamuel1 / lock.sh
Last active February 18, 2019 04:33
i3lock with a blured screenshot background
#!/bin/sh
# for autolock, have xautolock call this script:
# xautolock -time 10 -locker lock.sh -enable
scrot /tmp/screenshot.png
convert /tmp/screenshot.png -blur 0x7 -blue-shift 1.5 /tmp/screenshotblur.png
rm /tmp/screenshot.png
i3lock -i /tmp/screenshotblur.png
@ECHO off
:top
CLS
ECHO Choose a shell:
ECHO [1] cmd
ECHO [2] bash
ECHO [3] PowerShell
ECHO [4] PowerShell Core
ECHO [5] Python
ECHO [6] Visual Studio Developer Command Prompt
@jsamuel1
jsamuel1 / uefi-firmware-update.sh
Created May 12, 2019 23:20
Commandline - check for bios updates on Ubuntu
#!/bin/sh
sudo service fwupd start
# download metadata from https://cdn.fwupdate.org/downloads/firmware.xml.gz
sudo fwupdmgr refresh
# Output if any upgrades for each of the uefi firmare modoles
sudo fwupdmgr update
git checkout -b upstream
git remote add upstream [email protected]/upstream1/blah.git
git fetch upstream # or use -f in git remote add
git merge -s subtree upstream/master --allow-unrelated-histories -X theirs