Skip to content

Instantly share code, notes, and snippets.

View miere's full-sized avatar
😁
Distributing data among friends

Miere Teixeira miere

😁
Distributing data among friends
View GitHub Profile

Poor's man, Stress Tester

Here's a simplistic stress tester that bursts a given service multiple times in parallel.

Disclaimer: This script was designed to be a stress test tool and must be used with extreme care. Use it at your own discretion but warned that the author won't be responsible for any damage it might cause your targetted service. Therefore, be conservative with the numbers or you might put your services down.

How to install

Copy the below script into your Mac or Linux machine and save it as deny-the-service.sh. (Yeah, you might not have the tools available on your Windows, but you can give it a try if you want.)

How to find the nearest Airport to a Wind Turbine?

Requirements

Install pandas and geopy on your machine.

pip3 install pandas geopy

How to compute the distance between two geo-locations?

https://stackoverflow.com/a/43211266

@miere
miere / SecurityConfig.kt
Created June 6, 2022 00:44
JWT with Kos + Vert.x
package nct.engineering.security
import injector.Exposed
import kos.api.WebServerEventListener
import org.slf4j.LoggerFactory
@Exposed
class SecurityConfig: WebServerEventListener {
private val logger = LoggerFactory.getLogger(javaClass)

Sim, o dia das mães é em dois dias e nesse dia ligarei para a minha amada mãe para deseja-la tudo de melhor, por os papos em dia, dizer que a amo e tudo mais. Mas hoje, eu queria poder homenagear aquela que fez dos meus filhos os herois que eles se tornaram. Ninguém nessa família teria chegado onde chegou sem a ajuda da mais linda, despojada e bem articulada mãe que já conheci: @pmoraest. Esse fim de semana é teu, Moris.

Quem escolhe seguir com a maternidade sabe que não é uma tarefa fácil. As mães não nascem sabendo tudo. Mas a Polianna, sempre criativa, sempre achou meios de encontrar forças para aprender a criá-los e prepará-los para o mundo que eles viverão. Como te admiro por ser esse rio de paciência, cuidando deles como se nada

Useful Git Aliases

Here are a few aliases that I use on my daily routine. I'm sharing this as it might be helpful for other developers, too.

The Script

#!/bin/sh

# Push configuration will always assume same branch name in the given remote repository
# If only one remote location exists, it won't ask it.
git config --global push.default current

Meta-Programming Challenge

This is an experiment to practice Meta-Programming skills in JavaScript.

Acceptance Criteria

  • Create a generic Repository implementation (from the Repository Pattern)
  • It should be able to 'create', 'update' or 'delete' objects from a MySQL database
  • It should not rely on any other parameter aside of the persisted object itself (as an ORM might do).

Sample Code

@miere
miere / SourceCodeGuide.md
Last active May 15, 2020 06:39
An hypothetical document to exemplify how a "Source Code Guide" might look like.

Source Code Guide

This is a guide to aims to provide to our developers the directions needed to deal with the source of this service.

Requirements

To run this project you need the following tools and SDKs installed on your Operating System:

  • Java Development Kit 13 or superior
  • Rust 1.33 or superior
  • Docker 18 or superior
  • Bash-compatible shell
@miere
miere / ArchitectureDecisionsGuideline.md
Last active May 15, 2020 08:02
An hypothetical document to exemplify how an "Architecture Decisions Guideline" might look like. The content must adapter to match the requirements of your projects.

Architecture Decisions Guideline

This is a guide to help our developers to understand the decisions made in the past that might affect Pull Request Reviews when they contribute to our services.

1. Glossary

Before we proceed we should understand a few concepts that will be widely used in this small doc or in further diagrams.

  • Domain: is the problem you're a trying to solve, like notification, basic entity management operations (aka CRUD) or face recognition. Although

Consuming SSM Parameter Store from Docker image

This example is based on NodeJs 10.

Requirements

In the following example you gonna need the following env vars defined:

  • APP_NAME: the application name.
  • AWS_REGION: region where the parameters has been stored

Building the image

RPC Style Request Mapping

Assuming you have the following model for a user.

data class User(
  val id: UUID = UUID.randomUUID(),
  val name: String,
  val username: String,
  val password: String
)