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
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
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
#!/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
""" | |
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
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
""" | |
This example does a HTTP POST, change it to whatever you want. | |
The code here assumes that: | |
- Your API Gateway has been setup with a Cognito User Pool authorizer | |
- That User Pool authorizer is set up with http header "authorization" as Token Source | |
- The API Gateway Method you are invoking is set up to require at least one OAuth scope | |
""" | |
from urllib.request import Request, urlopen |
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 typing import List | |
import os | |
import shutil | |
import hashlib | |
import tempfile | |
from aws_cdk import core, aws_lambda | |
import jsii | |
from pathlib import Path | |
OlderNewer