Skip to content

Instantly share code, notes, and snippets.

View sombriks's full-sized avatar
🎧
discover new life, new galaxies, new civilizations -- [RUNNING]

Leonardo Silveira sombriks

🎧
discover new life, new galaxies, new civilizations -- [RUNNING]
View GitHub Profile
@sombriks
sombriks / docker-compose-elasticsearch.yml
Created February 20, 2024 21:29
running pelias elastic search standalone for testing purposes
version: "3.8"
services:
elasticsearch:
image: pelias/elasticsearch:7.16.1
restart: always
ports: [ "127.0.0.1:9200:9200", "127.0.0.1:9300:9300" ]
ulimits:
memlock:
soft: -1
hard: -1
@sombriks
sombriks / Logging.mjs
Created December 15, 2023 01:46
a genenral logger for koa
export class Logging {
static async generalLogger (ctx, next) {
try {
await next()
} catch (err) {
console.log(err)
ctx.throw(err)
}
}
}
@sombriks
sombriks / simple-roadmap.md
Last active October 13, 2023 02:43
roadmap for simple koa service

how to provision a node service from scratch

We're performing interactive steps adding small things one at a time!

requirements

  • node 18

minimal hello

@sombriks
sombriks / Dockerfile
Created September 16, 2023 21:27
dockerfile to package an already built jar file (src/infrastructure/Dockerfile)
# see https://gist.github.com/sombriks/c8e8979d80efaf02de6bf04ffe5805cc
FROM eclipse-temurin:17-jre-alpine
ARG SERVICE=my-service
ARG VERSION=0.0.1-SNAPSHOT
ENV SERVICE=$SERVICE
ENV VERSION=$VERSION
# for gradle
@sombriks
sombriks / publish_tag_as_image.yml
Last active September 16, 2023 21:27
build and publish docker image on ECR on tag push
name: Publish git tag as ECR image
on:
push:
tags:
- '*'
env:
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
{
"serviceName": "log-broker-service",
"cluster": "log-broker-cluster",
"taskDefinition": "log-broker-task:8",
"desiredCount": 1,
"launchType": "FARGATE",
"platformVersion": "LATEST",
"networkConfiguration": {
"awsvpcConfiguration": {
"subnets": [
{
"family": "teste",
"containerDefinitions": [
{
"name": "kafka",
"image": "public.ecr.aws/bitnami/kafka:3.5",
"cpu": 0,
"portMappings": [
{
"name": "kafka-9092-tcp",
@sombriks
sombriks / .eleventy.js
Last active March 21, 2023 21:17
custom eleventy filter to count posts by year #eleventy #ssg
//...
eleventyConfig
.addFilter('yearTags', posts => {
const yearsList = posts.map(p => p.data.date.getFullYear())
const yearsCount = {}
yearsList.forEach(y => {
if (!yearsCount[y]) yearsCount[y] = 1
else yearsCount[y]++
});
return Object.keys(yearsCount)
@sombriks
sombriks / .eleventy.js
Created February 16, 2023 19:10
support for webc and avoiding to copy prism themes directly to source code
const pluginWebc = require("@11ty/eleventy-plugin-webc");
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy({
"src/assets": "assets",
// "node_modules/prism-themes/themes/prism-a11y-dark.min.css": "assets/prism-theme.css"
// "node_modules/prism-themes/themes/prism-atom-dark.min.css": "assets/prism-theme.css"
// "node_modules/prism-themes/themes/prism-base16-ateliersulphurpool.light.min.css": "assets/prism-theme.css"
@sombriks
sombriks / s3deploy.mjs
Created February 15, 2023 17:37
poorman s3 deploy
// very hacky
// not production-ready by any means
import fs from "fs"
import AWS from "aws-sdk"
import mime from "mime-types"
import {exec} from "child_process"
if(!process.env.AWS_BUCKET_NAME
|| !process.env.HQ_DIST_SITE_FOLDER
|| !process.env.AWS_REGION