$ git for-each-ref --sort=authordate --format '%(authordate:relative) %(refname:short)' refs/heads
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
process | |
.on('unhandledRejection', (reason, p) => { | |
console.error(reason, 'Unhandled Rejection at Promise', p); | |
}) | |
.on('uncaughtException', err => { | |
console.error(err, 'Uncaught Exception thrown'); | |
process.exit(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 {Construct} from 'constructs'; | |
import {App, TerraformOutput, TerraformStack} from 'cdktf'; | |
import {AwsProvider, LambdaFunction, IamRole} from "./.gen/providers/aws"; | |
import {SecondStack} from "./second-stack"; | |
class MainStack extends TerraformStack { | |
constructor(scope: Construct, id: string) { | |
super(scope, id); | |
new AwsProvider(this, "aws", { |
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 {Construct} from 'constructs'; | |
import {App, TerraformOutput, TerraformStack} from 'cdktf'; | |
import {AwsProvider, LambdaFunction, IamRole} from "./.gen/providers/aws"; | |
class MyStack extends TerraformStack { | |
constructor(scope: Construct, id: string) { | |
super(scope, id); | |
new AwsProvider(this, "aws", { | |
region: "eu-west-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
resource "aws_lambda_alias" "lambda-alias" { | |
name = "latest" | |
description = "alias pointing to the latest published version of the lambda" | |
function_name = aws_lambda_function.lambda.function_name | |
function_version = aws_lambda_function.lambda.version | |
} | |
resource "aws_lambda_provisioned_concurrency_config" "keep-lambda-warm" { | |
function_name = aws_lambda_alias.lambda-alias.function_name | |
provisioned_concurrent_executions = 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
resource "aws_lambda_alias" "lambda-alias" { | |
name = "latest" | |
description = "alias pointing to the latest published version of the lambda" | |
function_name = aws_lambda_function.lambda.function_name | |
function_version = aws_lambda_function.lambda.version | |
} | |
resource "aws_appautoscaling_target" "scale-warmer-target" { | |
max_capacity = 1 | |
min_capacity = 0 |
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
resource "aws_lambda_function" "lambda" { | |
... | |
publish = true // Publish a new version of the lambda when the code changes | |
} | |
resource "aws_lambda_alias" "lambda-alias" { | |
name = "latest" | |
description = "alias pointing to the latest published version of the lambda" | |
function_name = aws_lambda_function.lambda.function_name |
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 Kinesis = require('aws-sdk/clients/kinesis') | |
const cli = new Kinesis({ region: 'eu-west-1' }) | |
cli.getShardIterator({ | |
StartingSequenceNumber: '49595535202406761165676766185764002510013872440053071874', | |
StreamName: 'test', | |
ShardId: 'shardId-000000000000', | |
ShardIteratorType: 'AT_SEQUENCE_NUMBER' | |
}).promise().then(async ({ ShardIterator }) => { | |
const rec = await cli.getRecords({ ShardIterator, Limit: 1 }).promise() |
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 Config<T> = | |
T extends { type: 'sftp' } ? { login: string, password: string } : | |
T extends { type: 'post' } ? { url: string, header: string } : {}; | |
const union: { type: 'post' | 'sftp' } = { type: 'post' } | |
const simple: { type: 'post' } = { type: 'post' } | |
const splitUnion: { type: 'post' } | { type: 'sftp' } = { type: 'post' } | |
type Instance = Config<typeof union> // ==> Instance is {} and not {url: string, header: string} | |
type InstanceOk = Config<typeof simple> // ==> Instance is { url: string, header: string } | |
type InstanceOk2 = Config<typeof splitUnion> // ==> Instance is { url: string, header: 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
import * as request from 'superagent'; | |
import { | |
Observable, | |
from, | |
throwError | |
} from 'rxjs'; | |
import { | |
SuperAgentStatic | |
} from "superagent"; |
NewerOlder