Skip to content

Instantly share code, notes, and snippets.

:octocat:
benchmarking

Yun Zhi Lin yunspace

:octocat:
benchmarking
Block or report user

Report or block yunspace

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yunspace
yunspace / bucket_template.yml
Created Nov 24, 2018
Adding Lambda S3 Event Trigger from separate CloudFormation template
View bucket_template.yml
Resources:
OriginalBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub ${Realm}-{Env}-original-bucket
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
NotificationConfiguration:
@yunspace
yunspace / apigw_template.yml
Last active Nov 24, 2018
API Gateway ResourcePolicy
View apigw_template.yml
Resources:
MyAPI:
Type: AWS::Serverless::Api
Properties:
StageName: dev
DefinitionBody:
swagger: 2.0
info:
title: !Ref AWS::StackName
x-amazon-apigateway-policy:
@yunspace
yunspace / artillery-multi-scenario.yml
Last active Sep 26, 2018
Artillery Hack to run multiple scenarios
View artillery-multi-scenario.yml
scenarios:
- name "multi scenario hack"
flow:
- get:
url: "/server1:1234/test"
- get:
url: "/server2:4567/test2"
View make_assumeRole.sh
_assumeRole:
ifndef AWS_SESSION_TOKEN
$(eval ROLE = "$(shell aws sts assume-role --role-arn "$(TF_VAR_provider_role)" --role-session-name "terraform-assume-role" --query "Credentials.[AccessKeyId, SecretAccessKey, SessionToken]" --output text)")
$(eval export AWS_ACCESS_KEY_ID = $(shell echo $(ROLE) | cut -f1))
$(eval export AWS_SECRET_ACCESS_KEY = $(shell echo $(ROLE) | cut -f2))
$(eval export AWS_SESSION_TOKEN = $(shell echo $(ROLE) | cut -f3))
endif
View artillery.sh
# api.txt is a list of API urls
for api in `cat apis.txt`
do
echo “testing $api
artillery quick — duration 3600 — rate 10 — num 1 $api &
done
View Handler.go
package main
import (
"context"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
)
func Handler(ctx context.Context, request *events.APIGatewayProxyRequest) (*events.APIGatewayProxyResponse, error) {
@yunspace
yunspace / Handler.fs
Created Mar 4, 2018
Performance benchmarks
View Handler.fs
namespace AwsDotnetFsharp
open Amazon.Lambda.Core
[<assembly:LambdaSerializer(typeof<Amazon.Lambda.Serialization.Json.JsonSerializer>)>]
do ()
module Handler =
type Response = { statusCode : int; body : string }
@yunspace
yunspace / Handler.cs
Last active Mar 4, 2018
Lambda Performance Benchmarks
View Handler.cs
using System;
namespace AwsDotnetCsharp
{
public class Handler
{
public Response Hello(Request request)
{
return new Response {
statusCode = 200,
@yunspace
yunspace / gist:51fe6cbb3438079350298a9930449f46
Created Oct 17, 2017 — forked from flaccid/gist:97473d0d85e2d6f4e292
Quick example of blue/green app ugprade on Rancher
View gist:51fe6cbb3438079350298a9930449f46
$ export RANCHER_HOST=foo.bar.suf
$ export RANCHER_PORT=8080
$ export RANCHER_PROJECT_ID=1a8
$ export RANCHER_STACK_NAME=killerapp
$ ./cattle-deploy.py
output:
snapshot epoch is1437634695
created temp file /var/folders/sx/ht6gznq979v5r725sqt7_p617p38sz/T/tmpprzZsd
View win10-bash-go-install.sh
#!/bin/bash
set -e
GVERSION="1.9"
GFILE="go$GVERSION.linux-amd64.tar.gz"
GOPATH="$HOME/go"
GOROOT="/usr/local/go"
if [ -d $GOROOT ]; then
echo "Installation directories already exist $GOROOT"
You can’t perform that action at this time.