# create a test server with canned responses
const server: TestServer = new TestServer(new Response(500, payload), new Response(200, payload))
# wait for it to start
const url = await server.ready()
# use it
fetch(url).then(async res => console.log(await res.json()), console.error)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Glue } from 'aws-sdk' | |
const glue = new Glue() | |
const SourceDatabaseName = "tmp" | |
const TargetDatabaseName = "ris-reporting" | |
// begin async | |
;(async () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { STSClient, GetCallerIdentityCommand } from '@aws-sdk/client-sts'; | |
new STSClient({}) | |
.send(new GetCallerIdentityCommand({})) | |
.then(console.log) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xray: | |
cd /tmp \ | |
&& [ -d "./xray" ] || ( \ | |
curl -O https://s3.dualstack.us-east-2.amazonaws.com/aws-xray-assets.us-east-2/xray-daemon/aws-xray-daemon-macos-3.x.zip \ | |
&& unzip -d xray aws-xray-daemon-macos-3.x.zip \ | |
) \ | |
&& cd xray \ | |
&& ./xray_mac -o -n us-west-2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# $ nohup python3 ./purge.py foo-bucket & | |
import sys | |
import boto3 | |
# Take the bucket name from command line args | |
BUCKET = sys.argv[1] | |
s3 = boto3.resource('s3') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import boto3 | |
# constants | |
role_name = 'OrganizationAccountAccessRole' | |
regions_in_scope = [ | |
'us-east-2', | |
'us-east-1', | |
'us-west-1', | |
'us-west-2', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SHELL := node | |
.SHELLFLAGS = -e | |
.ONESHELL: example | |
.SILENT: example | |
example: | |
const foo = "bar" | |
console.log( "success", { foo } ) |
Golang doesn't have try/catch blocks, so you can't simply "throw" an error and hope something will catch it and give you a stack-trace showing you where it came from. Instead we return errors and check them ... but it's important to introduce context before returning ... here's why
Here a simple go program I wrote which doesn't appear to work 🤔
$ go run main.go
access denied
... it attempts to "process" and "save", but since the "process" function adds no context to the error (it just bubbles it up), the final error is very confusing!