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 / interpolation_functional.js
Created August 12, 2017 10:55
A more functional interpolation example
// Original elements with gaps
const cols = [
{ ts: 2, name: 'two' },
{ ts: 4, name: 'four' },
{ ts: 11, name: 'thirtyone' },
]
const step = 1
// The first and last element for being much more readable
@balintsera
balintsera / higher order function.js
Created September 11, 2017 17:54
higher order function created by balintsera - https://repl.it/Kwbw/1
var snakify = function(text) {
return text.replace(/millenials/ig, "Snake People");
};
console.log(snakify("The Millenials are always up to something."));
var hippify = function(text) {
return text.replace(/baby boomers/ig, "Aging Hippies");
};
console.log(hippify("The Baby Boomers just look the other way."));
@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"}';
}
@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 / 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 / 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 / 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 / .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 / 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 / result.json
Last active November 11, 2018 18:05
Example dynamoDB description
{
"Table": {
"AttributeDefinitions": [
{
"AttributeName": "label",
"AttributeType": "S"
},
{
"AttributeName": "listID",
"AttributeType": "S"