Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Poignant thomaspoignant

View GitHub Profile
View localstack_sns_sqs.sh
docker run --rm -it -p 4566:4566 -p 4571:4571 localstack/localstack
# create topic
aws --region=eu-west-1 --endpoint-url=http://localhost:4566 sns create-topic --name responseTopic
# list topic and get ARN
aws --region=eu-west-1 --endpoint-url=http://localhost:4566 sns list-topics
# create SQS queue
aws --region=eu-west-1 --endpoint-url=http://localhost:4566 sqs create-queue --queue-name test-queue
View keybase.md

Keybase proof

I hereby claim:

  • I am thomaspoignant on github.
  • I am thomaspoignant (https://keybase.io/thomaspoignant) on keybase.
  • I have a public key ASDtkh-5twLIZx6Ip4W7QaueOa06almAgIuHeoc3DToyXgo

To claim this, I am signing this object:

@thomaspoignant
thomaspoignant / pipeline.go
Last active Aug 12, 2021
Building a pipeline system in golang
View pipeline.go
package main
import (
"fmt"
"gopkg.in/yaml.v3"
"io"
"net/http"
)
// PipelineConfig is the representation of a pipeline in the configuration.
@thomaspoignant
thomaspoignant / pipeline.yaml
Created Apr 16, 2021
Pipeline configuration example
View pipeline.yaml
root: handler1_name
steps:
handler1_name:
type: handlerImpl1
next: handler2_name
handler2_name:
type: handlerImpl2
View createApiGatewayForLambda.ts
/**
* createApiGatewayForLambda is creating a Rest API Gateway to access to your lambda function
* @param id - CDK id for this lambda
* @param handler - Lambda function to call
* @param description - Description of this endpoint
*/
createApiGatewayForLambda(id: string, handler: lambda.Function, description: string): LambdaRestApi{
return new LambdaRestApi(this, id, {
handler,
description
View buildAndInstallGOLambda.ts
/**
* buildAndInstallGOLambda build the code and create the lambda
* @param id - CDK id for this lambda
* @param lambdaPath - Location of the code
* @param handler - name of the handler to call for this lambda
*/
buildAndInstallGOLambda(id: string, lambdaPath: string, handler: string): lambda.Function {
const environment = {
CGO_ENABLED: '0',
GOOS: 'linux',
View lambda_go-chi.go
var chiLambda *chiadapter.ChiLambda
// handler is the function called by the lambda.
func handler(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
return chiLambda.ProxyWithContext(ctx, req)
}
// main is called when a new lambda starts, so don't
// expect to have something done for every query here.
func main() {
@thomaspoignant
thomaspoignant / monitor_nested.ts
Last active Feb 18, 2021
Use NestedStack to use the type
View monitor_nested.ts
import * as cdk from '@aws-cdk/core';
import {CfnResource} from "@aws-cdk/core";
export class CdkCustomResourcesStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const monitorType = new CfnResource(this, 'datadog_monitor_id',{
type: 'AWS::CloudFormation::ResourceVersion',
properties:{
@thomaspoignant
thomaspoignant / monitor.ts
Last active Feb 18, 2021
Create custom resource with CDK
View monitor.ts
new CfnResource(this, 'datadog_monitor_id',{
type: 'AWS::CloudFormation::ResourceVersion',
properties:{
'TypeName': 'Datadog::Monitors::Monitor',
'SchemaHandlerPackage':
's3://datadog-cloudformation-resources/datadog-monitors-monitor/datadog' +
'-monitors-monitor-2.1.0.zip'
}
})
@thomaspoignant
thomaspoignant / Makefile
Last active Aug 22, 2021
My ultimate Makefile for Golang Projects
View Makefile
GOCMD=go
GOTEST=$(GOCMD) test
GOVET=$(GOCMD) vet
BINARY_NAME=example
VERSION?=0.0.0
SERVICE_PORT?=3000
DOCKER_REGISTRY?= #if set it should finished by /
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true
GREEN := $(shell tput -Txterm setaf 2)