Skip to content

Instantly share code, notes, and snippets.

View nathandines's full-sized avatar

Nathan Dines nathandines

View GitHub Profile
@nathandines
nathandines / aws_console.py
Last active May 26, 2017 05:40
Just something quick which I hacked up which logs you into the AWS console using your Access Keys
#!/usr/bin/env python
import argparse
import json
import urllib2
import webbrowser
from urllib import urlencode
import boto3
parser = argparse.ArgumentParser()
@nathandines
nathandines / assume_role.ps1
Last active November 1, 2021 10:49
Assume role wrapper scripts in bash and PowerShell (Using Role ARN from environment variable "ROLE_ARN")
if (Get-Command "powershell" -ErrorAction SilentlyContinue) {
$powershell = "powershell"
} else {
$powershell = "pwsh"
}
& $powershell -Command {
Set-StrictMode -Version 2.0
Import-Module AWSPowerShell.NetCore
@nathandines
nathandines / aws_ssm_ssh.sh
Last active May 1, 2020 03:17
SSH Session via AWS Session Manager with SSH Agent Passthrough
#!/usr/bin/env bash
set -euo pipefail
randomPort="$((49152 + ($RANDOM % 16383)))"
function cleanup_jobs() {
for i in $(jobs -p); do
pkill -P $i
done
@nathandines
nathandines / dateToLocalISOString.js
Created April 7, 2022 02:58
Small JS function to output a timezone formatted ISO string
function dateToLocalISOString(date) {
const tzOffsetMins = date.getTimezoneOffset();
const tzString = (-tzOffsetMins*100/60).toString();
let tzPrefix = "";
if (tzOffsetMins === 0) {
return date.toISOString()
} else if (tzOffsetMins < 0) {
tzPrefix = "+";
} else {
tzPrefix = "-";