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
const Amplify = require('aws-amplify'); | |
Amplify.default.configure({ | |
aws_appsync_graphqlEndpoint: 'https://something.appsync-api.eu-west-1.amazonaws.com/graphql', | |
aws_appsync_region: 'eu-west-1', | |
aws_appsync_authenticationType: 'API_KEY', | |
aws_appsync_apiKey: 'yourkey' | |
}); | |
const mutation = `mutation CreatePerson($firstName: String!, $lastName: String!, bankAccountBalance: Float!) { |
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
#!/bin/bash | |
log() { | |
echo $(date -u +"%Y-%m-%dT%H:%M:%SZ") $@ # >> output.log | |
} | |
convert_single () { | |
cd /mnt/ | |
FULL_PATH=$1 | |
time wine /home/ubuntu/bin/Dat2Cvw_1.4.7.1.A/DAT2CVW.exe -i $FULL_PATH >/dev/null 2>&1 |
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 { randomBytes } from 'crypto'; | |
let bitsNeeded: number, bytesNeeded: number, chunks: number, tooBig: number, randomNumber: number, index: number; | |
export function randomChoiceFromIndexable(indexable: string | any[]) { | |
bitsNeeded = Math.log2(indexable.length); | |
bytesNeeded = Math.ceil(bitsNeeded / 8); | |
chunks = Math.floor(256 / indexable.length) || 1; | |
tooBig = indexable.length * chunks; | |
do { | |
randomNumber = randomBytes(bytesNeeded).readUIntBE(0, bytesNeeded); |
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
from urllib.request import Request, urlopen | |
import json | |
class CfnResponse: | |
SUCCESS = "SUCCESS" | |
FAILED = "FAILED" | |
@staticmethod | |
def send( |
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 ts-node | |
// This script uploads your assets to the CDK staging bucket in S3 (just as cdk deploy would) | |
// and writes out two files: | |
// - parameters.ini to use in CLI deployments (see instructions below) | |
// - parameters.json to use in AWS CodePipeline for CloudFormation deployments | |
// | |
// Installation instructions: | |
// - Save this script cdk-package.ts to the root of your CDK repo (i.e. next to cdk.json) and make it executable | |
// - Install script dependencies: npm install jsonpath aws-sdk adm-zip @types/jsonpath @types/adm-zip |
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
#!/bin/sh | |
LAYER_DIR=lib/lambda-layers | |
for DIR in $(ls $LAYER_DIR); do | |
echo "Installing layer: $DIR" | |
cd $LAYER_DIR/$DIR | |
git check-ignore * > /dev/null && rm -r $(git check-ignore *) | |
docker run --rm --init -v "$(pwd):/${DIR}" lambci/lambda:build-python3.8 sh '-c' "pip install -r /${DIR}/requirements.txt --target /${DIR}/python" | |
done |
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 { request } from "https"; | |
export enum Status { | |
"SUCCESS" = "SUCCESS", | |
"FAILED" = "FAILED", | |
} | |
export async function sendCfnResponse(props: { | |
event: { | |
StackId: string; |
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
""" | |
Logging utility for logging to CloudWatch Logs, to use in e.g. AWS Lambda. | |
Some small features included: | |
- log structured JSON as that works really well with CloudWatch Logs filters and CloudWatch Logs Insights | |
- support turning any Python object into JSON | |
- replace line endings for nice folding of entries in CloudWatch Logs | |
- do not buffer stdout | |
""" |
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 | |
""" | |
Usage: | |
- Save this script somewhere on your path (e.g. `vi /usr/local/bin/aws-console && chmod +x /usr/local/bin/aws-console`) | |
- Make AWS credentials available in one of the usual places where boto3 can find them (~/.aws/credentials, env var, etc.) | |
- Excute the script: `aws-console --profile myprofile` | |
- :tada: Your browser opens and you are signed in into the AWS console | |
""" |
OlderNewer