Skip to content

Instantly share code, notes, and snippets.

View balintsera's full-sized avatar

Bálint Séra balintsera

  • LastPass
  • Szeged, Hungary
View GitHub Profile
@balintsera
balintsera / lambda-proxy-integration.yml
Last active December 4, 2024 17:51
Lambda Proxy Integration with Cloudformation tamplate
apiGateway:
Type: "AWS::ApiGateway::RestApi"
Properties:
Name: "example-api-gw"
Description: "Example API"
ProxyResource:
Type: "AWS::ApiGateway::Resource"
Properties:
ParentId: !GetAtt apiGateway.RootResourceId
@balintsera
balintsera / mock-single-method.test.js
Created December 4, 2018 12:40
Mock a single method of a class with Rewire
const rewired = rewire('../index.js')
const orig = require('../service/SESMail')
orig.prototype.send = () => { return Promise.resolve() }
rewired.__set__({
'SESMail': orig
})
expect(rewired.handler.bind(null, testEvent, null)).to.not.throw()
@balintsera
balintsera / result.json
Last active November 11, 2018 18:05
Example dynamoDB description
{
"Table": {
"AttributeDefinitions": [
{
"AttributeName": "label",
"AttributeType": "S"
},
{
"AttributeName": "listID",
"AttributeType": "S"
@balintsera
balintsera / Dockerfile
Created June 25, 2018 06:43
Gitlab docker-in-docker builder image
FROM debian:jessie
MAINTAINER [email protected]
# image: customrepo/docker-builder
RUN apt-get update -y
RUN apt-get install -y curl ssh-client
# docker
ENV DOCKER_BUCKET get.docker.com
@balintsera
balintsera / .gitlab-ci.yml
Last active November 3, 2020 08:49
Gitlab config for docker based CICD pipeline (node.js)
image: customregistry/docker-builder:latest
variables:
dockerTag: '$CI_BUILD_REF'
DOCKER_REPO: customregistry
IMAGE_BASE_NAME: redis-faas
IMAGE: $EVISTA_DOCKER_REPO/$IMAGE_BASE_NAME:$CI_BUILD_REF
CONTAINER_NAME: 'fotok-redis-pipeline'
TARGET_DIR_STAGE: /srv/docker/staging/redis-faas
TARGET_DIR_PROD: /srv/docker/prod/redis-faas
@balintsera
balintsera / datastore-internal-attribs.md
Last active May 2, 2018 08:45
Datastore Internal Attributes (Table 11-2 from Database Reliability Engineering, Designing and Operating Resilient Database Systems – Laine Campbell, Charity Majors)
Attribute MySQL Cassandra MongoDB Neo4J
Storage engines Plugins, B-tree primarily LSM only Plugins, B-tree, or LSM Native graph storage
Distributed consistency Focused on consistency Eventual, secondary to availability Focused on consistency Focused on consistency
Distributed availability Secondary to consistency Focused on availability Secondary to consistency Secondary to consistency
Latency Tunable based on durability Optimized for writes Tunable for consistency Optimized
@balintsera
balintsera / Dockerfile
Created October 1, 2017 08:40
Static React docker image build file with nginx enviroment variable replacing
FROM nginx:alpine
ENV APP_CONF="config={}"
WORKDIR /usr/share/nginx/html
COPY --from=vhostfront_build /opt/app/build/ .
COPY nginx-default.conf.template /etc/nginx/conf.d/deafault.conf.template
@balintsera
balintsera / default.conf
Last active October 1, 2017 08:33
Nginx config before substitution
location / {
root /usr/share/nginx/html;
index index.html index.htm;
add_header "Set-Cookie" '${APP_CONF}';
}
@balintsera
balintsera / docker-compose.yml
Created October 1, 2017 08:28
Use environment variable in an Nginx container using templating
version: "3"
services:
vhostfront:
image: repository/vhostmon/vhostfront:latest
environment:
- APP_CONF=config={"baseUrl":"http://localhost:8081"}
ports:
- "8085:80"
command: ["sh", "-c", "envsubst < /etc/nginx/conf.d/deafault.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"]
@balintsera
balintsera / nginx.conf
Created October 1, 2017 08:23
Send config as cookie with nginx to single page javascript apps
location / {
root /usr/share/nginx/html;
index index.html index.htm;
add_header "Set-Cookie" 'config={"baseUrl":"http://localhost:8081"}';
}