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 Archiver = require('archiver') | |
const Stream = require('stream') | |
const AWS = require("aws-sdk"); | |
const s3 = new AWS.S3( { apiVersion: '2006-03-01'} ); | |
const archiveFolder = async (data) => { | |
//get list of items | |
const s3Files = await s3.listObjectsV2({ | |
Bucket: data.bucket, |
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 node:12.16.1-alpine3.9 | |
WORKDIR /app | |
COPY app/* /app/ | |
RUN npm install | |
CMD node archive.js |
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 | |
function push_it { | |
docker tag $DOCKER_IMAGE_TAG $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$AWS_ECR_NAME | |
docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$AWS_ECR_NAME | |
} | |
function usage { |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "S1", | |
"Effect": "Allow", | |
"Action": [ | |
"s3:PutObject", | |
"s3:GetObject", | |
], |
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
{ | |
"bucket": "your-bucket", | |
"key": "prefix", | |
"destination": "path-to-arhive", | |
"exluce": "regexp for excluding paths" | |
} |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "S1", | |
"Effect": "Allow", | |
"Action": "iam:PassRole", | |
"Resource": "arn:aws:iam::aws-acount-id:role/ecs-task-role" | |
}, | |
{ |
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 AWS = require('aws-sdk') | |
var ecs = new AWS.ECS(); | |
exports.handler = async (event, context) => { | |
const record = event.Records[0] | |
const receiptHandle = record.receiptHandle | |
const sqsARN = record.eventSourceARN | |
let message = null |
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
type Zero = { | |
__type: 'zero', | |
} | |
type One = { | |
__type: 'one' | |
} | |
type Bit = Zero | One; |
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
type BitNot<T extends Bit> = T extends Zero ? One : Zero; | |
type BitAnd<LHS extends Bit, RHS extends Bit> = LHS extends One | |
? RHS extends One | |
? One | |
: Zero | |
: Zero; | |
type BitOr<LHS extends Bit, RHS extends Bit> = LHS extends Zero | |
? RHS extends Zero | |
? Zero | |
: One |
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
type ShiftLeft<T extends Byte> = T extends [ | |
infer U extends Bit, | |
...infer R extends Bit[] | |
] | |
? [...R, Zero] | |
: never; | |
type ShiftRight<T extends Byte> = T extends [ | |
...infer U extends Bit[], | |
infer R extends Bit | |
] |
OlderNewer