This file contains hidden or 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
# Cleanup images | |
docker images | grep "<none>" | awk '{print $3}' | xargs docker rmi | |
# Get shell | |
docker exec -it <containerId> /bin/bash | |
# Run Redis | |
docker run -d -p 6379:6379 redis |
This file contains hidden or 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 sendResponse = async (event, context, status, data = {}) => { | |
const response = { | |
Status: status, | |
RequestId: event.RequestId, | |
LogicalResourceId: event.LogicalResourceId, | |
StackId: event.StackId, | |
PhysicalResourceId: context.functionName, | |
Data: data | |
}; |
This file contains hidden or 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 fs = require('fs'); | |
const path = require('path'); | |
const dirToCreate; | |
const initDir = path.isAbsolute(dirToCreate) ? path.sep : ''; | |
dirToCreate.split(path.sep).reduce((parentDir, childDir) => { | |
const curDir = path.resolve(parentDir, childDir); | |
if (!fs.existsSync(curDir)) { | |
fs.mkdirSync(curDir); |
This file contains hidden or 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
'use strict'; | |
const AWS = require("aws-sdk"); | |
class EnhancedDynamoDBClient extends AWS.DynamoDB.DocumentClient { | |
constructor(options) { | |
super(options); | |
} | |
scanAll(params) { |
This file contains hidden or 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 resolveSequential = (funcs) => { | |
return funcs.reduce( | |
(promise, f) => { | |
return promise.then(all => { | |
return f().then(r => { | |
all.push(r); | |
return all; | |
}) | |
}) | |
}, |
This file contains hidden or 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
'use strict'; | |
// This plugin will bind to all available lifecycle events and print them out as they are invoked | |
class LifecyclePrinter { | |
constructor(serverless, options) { | |
this.serverless = serverless; | |
this.options = options; | |
this.provider = this.serverless.getProvider('aws'); | |
This file contains hidden or 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
'use strict'; | |
const printObject = (obj, seen = [], level = 0) => { | |
if (seen.length === 0) { | |
seen.push(obj); | |
} | |
const indent = " ".repeat(level); | |
for (let k in obj) { |
This file contains hidden or 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
# Enable Logback configuration debugging: | |
-Dlogback.debug=true |
This file contains hidden or 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
# Get account id | |
aws sts get-caller-identity --output text --query 'Account' | |
# Get CF exported values | |
aws cloudformation list-exports | jq '.Exports[] | "\(.Name) = \(.Value)"' |