npm i webpack webpack-cli ts-loader aws-sdk @types/node
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
let CONFIG = { | |
endpoints: [ | |
"https://global.gcping.com/ping", | |
"https://us-central1-5tkroniexa-uc.a.run.app/ping", | |
], | |
//number of failures that trigger the reset | |
numberOfFails: 5, | |
//time in seconds after which the http request is considered failed | |
httpTimeout: 10, | |
//time in seconds for the relay to be off |
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 {DynamoDB} from 'aws-sdk'; | |
import {Key} from 'aws-sdk/clients/dynamodb'; | |
async function dynamodbRecursiveScan(tableName: string, startFromKey?: Key) { | |
const results: DynamoDB.ItemList = []; | |
const dynamodb = new DynamoDB(); | |
const items = await dynamodb | |
.scan({ | |
TableName: tableName, |
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 {Stripe} from 'stripe'; | |
const STRIPE_API_KEY = process.env.STRIPE_API_KEY; | |
const s = new Stripe(STRIPE_API_KEY, { | |
apiVersion: "2020-08-27", | |
}); | |
const deletePage = async () => { | |
const customers = await s.customers.list(); |
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 S3 = require("aws-sdk/clients/s3"); | |
import CloudFormation = require("aws-sdk/clients/cloudformation"); | |
import {StackResourceSummaries, StackSummaries} from "aws-sdk/clients/cloudformation"; | |
import {ObjectVersion} from "aws-sdk/clients/s3"; | |
const s3 = new S3(); | |
const cf = new CloudFormation(); | |
export const emptyBucket = async (bucketName: string) => { | |
// delete bucket contents |
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
/* | |
* Copyright (c) 2020 Phillipp Bertram | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
* | |
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH T |
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 {UserPool} from '@aws-cdk/aws-cognito'; | |
import {Construct, Duration} from '@aws-cdk/core'; | |
import {AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId} from '@aws-cdk/custom-resources'; | |
export class Cognito extends Construct { | |
public userPool: UserPool; | |
constructor(scope: Construct, id: string) { | |
super(scope, id); |
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 -e | |
stack=$1 | |
if [ -z "${stack}" ]; then | |
echo 'Usage:' | |
echo "$0 <stack>" | |
exit 1 | |
fi | |
# Get a list of the service names | |
services=$(docker stack services --format {{.Name}} ${stack}) | |
# Sort the service names |
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
docker run -ti -v $(pwd):/tmp DOCKER_IMAGE /bin/bash |
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
docker stack deploy -c <(docker-compose config) stack-name-here |