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 / create-cluster.sh
Created June 28, 2024 16:58
docker compose for testing redis cluster
#!/bin/sh
# need to run this to have a proper local cluster
sleep 5 ; echo yes | redis-cli --cluster create redis-7003:7003 redis-7001:7001 redis-7002:7002 --cluster-replicas 0
@sombriks
sombriks / example.html
Created June 15, 2024 20:01
hx-dataset-include - keep your application state in the loop using this hacky, fast and simple extension.
<!--
Since the markup IS the application state, using data-* attributes to keep track of some specifics would be handy.
Luckily, HTMX is brutally easy to extend, so we can do that in no time!
-->
<article class="message task"
th:id="'task'+${task.id}"
th:data-task="${task.id}"
th:data-status="${task.status.id}"
th:hx-put="@{/task/{id}(id=${task.id})}"
hx-ext="hx-dataset-include"
@sombriks
sombriks / TCApplicationTests.kt
Created May 18, 2024 00:06
sample testconfiguration for spring
package sample.example
import org.hamcrest.CoreMatchers
import org.hamcrest.MatcherAssert
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.context.annotation.Import
import org.springframework.data.domain.PageRequest
@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",