Skip to content

Instantly share code, notes, and snippets.

View andersonbosa's full-sized avatar
🥑

Anderson Bosa andersonbosa

🥑
View GitHub Profile
@andersonbosa
andersonbosa / url_interceptor.user.js
Created April 20, 2025 13:26
TamperMonkey Script to intercept all urls
// ==UserScript==
// @name Flexible URL Interceptor
// @description Intercepta URLs experadas e executa ação
// @author https://github.com/andersonbosa
// @version 1.0.0
// @namespace http://tampermonkey.net/
// @grant none
// @match https://*/*
// ==/UserScript==
FROM node:18 AS builder
ARG TARGETPLATFORM
ARG CHANNEL
ARG VERSION
ARG GIT_REMOTE_PROJECT
WORKDIR /tmp/node_app
ENV NODE_ENV=development
class Queue<T> {
private items: { [key: number]: T } = {}
private frontIndex: number = 0
private backIndex: number = 0
enqueue (item: T): void {
this.items[this.backIndex] = item
this.backIndex++
}
#!/bin/bash
create_domain_structure() {
local domain_name=$1
mkdir -p ${PROJECT_NAME}/src/modules/${domain_name}/application/{commands,queries,services}
touch ${PROJECT_NAME}/src/modules/${domain_name}/application/{commands,queries,services}/index.ts
mkdir -p ${PROJECT_NAME}/src/modules/${domain_name}/domain/{entities,value-objects,repositories,events}
touch ${PROJECT_NAME}/src/modules/${domain_name}/domain/{entities,value-objects,repositories,events}/index.ts

🚗 Como o Uber funciona por trás das cortinas?

Se você está estudando para entrevistas técnicas, aprendendo arquitetura ou é curioso sobre como grandes plataformas como Uber funcionam, confere minhas notas!

Eu fiz um passo a passo SIMPLES de como você pode realizar um System Design de um sistema como UBER. Também deixei provocações importantes que surgem durante o processo.

Se minhas notas te ajudarem de alguma forma, me fala aqui nos comentários ;)

Essa é uma v0 que fiz com que eu tinha em mente, as minhas notas pessoais são incrementais e eu compartilho com meus mentorados, se quiser mais informações me chama no privado ;)

package main
import (
"errors"
"fmt"
"regexp"
)
type ValidatorFunc func(value string) (bool, error)
// ==UserScript==
// @name Anti-Close, Anti-Redirect, Anti-Back & Anti-Clear
// @namespace http://tampermonkey.net/
// @version 2025-03-09
// @description Impede que a página se feche, redirecione, volte ou limpe o console
// @author Você
// @match https://*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant none
// ==/UserScript==
@andersonbosa
andersonbosa / read_csv.php
Created February 28, 2025 19:09 — forked from selwynpolit/read_csv.php
Php code to read a csv file of any size without exhausting memory and let you process it in chunks
/*
Reads a CSV file in chunks of 10 lines at a time
and returns them in an array of objects for processing.
Assumes the first line of the CSV file has headings
that will be used as the object name for the item you are
processing. i.e. the heading is CurrentURL then refer to
$item->CurrentURL
@andersonbosa
andersonbosa / profit_calc.go
Created February 23, 2025 22:39
Calcular retorno de lucro em BTC usando Golang.
package main
import (
"fmt"
"os"
"strconv"
)
func main() {
if len(os.Args) != 5 {
@andersonbosa
andersonbosa / add exception handler to spring boot.md
Last active February 14, 2025 18:26
add exception handler to spring boot

file: infra/GlobalExceptionHandler.java

@ControllerAdvice
public class GlobalExceptionHandler {

 @ExceptionHandler(MethodArgumentNotValidException.class)
    public ResponseEntity<?> handleJakartaValidations(MethodArgumentNotValidException e, HttpServletRequest r) {
 Map errors = new HashMap&lt;&gt;();