Skip to content

Instantly share code, notes, and snippets.

View RaniAgus's full-sized avatar

Agustin Ranieri RaniAgus

View GitHub Profile
@RaniAgus
RaniAgus / mvnrm.sh
Created November 15, 2025 04:25
Delete local maven dependency version
PACKAGE=${1:?}
VERSION=${2:?}
rm -rfv "~/.m2/repository/${PACKAGE}/${VERSION}"
rm -v "~/.m2/repository/${PACKAGE}/maven-metadata-local.xml"
# Example:
# rm -rfv ~/.m2/repository/org/mapstruct/*/1.7.0-SNAPSHOT
# rm -v ~/.m2/repository/org/mapstruct/*/maven-metadata-local.xml
@RaniAgus
RaniAgus / 00-readme.md
Last active February 7, 2026 05:10
Effect-like error matching with neverthrow

For context, I'm using Error as my "defect" channel and tagged types as my "error" channel.

At the moment, creating just the async version of it was enough for me, but you could create a sync matchTag and matchAllTags and then also rename these to matchTagAsync and matchAllTagsAsync.

There is also another caveat: both functions don't accept handlers that return tagged errors. For my use case, which is handling all possible errors before unwrapping a ResultAsync<T, Error>, I didn't need to handle that scenario.

Example usage:

function getUserDetails(req: Request): ResultAsync<User, NoTokenError | ExpiredTokenError | Error>;
@RaniAgus
RaniAgus / Makefile
Last active September 1, 2023 14:38
ElasticSearch Docker Env
ES != yq -r .services.es.container_name docker-compose.yml
KIB != yq -r .services.kib.container_name docker-compose.yml
all:
@echo "ES: $(ES)"
@echo "KIB: $(KIB)"
pass:
docker exec -it $(ES) /usr/share/elasticsearch/bin/elasticsearch-reset-password -bsu elastic

Guardar enteros en colecciones

Extraído de: sisoputnfrba/foro#2987 (comment)

Estoy desarrollando el modulo consola. Quiero hacer una "validación" de las instrucciones que están en el pseudocodigo, por ej: si la instrucción existe y si la cantidad de argumentos es correcta.

// ArchivoQueCreaElDiccionarioConTodaLaData.c
void inicializar_diccionario() {
 diccionario_instrucciones = dictionary_create();
@RaniAgus
RaniAgus / demo.c
Last active December 20, 2022 21:44
Numeros negativos y enteros sin signo
#include <stdint.h>
#include <commons/memory.h>
#define RUN(EXP) do { printf(#EXP); EXP; printf("\n"); } while(0)
#define EVALUATE(EXP) do { printf(#EXP " => %s\n", (EXP) ? "true" : "false"); } while(0)
int main() {
RUN(mem_hexdump(&(int){ -1 }, sizeof(int)));
RUN(mem_hexdump(&(int16_t){ -1 }, sizeof(int16_t)));
RUN(mem_hexdump(&(uint16_t){ -1 }, sizeof(uint16_t)));
@RaniAgus
RaniAgus / main.js
Last active October 14, 2022 21:00
Convertir Google Sheet a JSON
const axios = require('axios').default;
const { read, utils } = require('xlsx');
require('dotenv').config();
const getSpreadsheet = async({ id, gid = 0, index = 0 }) => {
const { data } = await axios({
method: 'get',
url: `https://docs.google.com/spreadsheets/d/${id}/export`,
responseType: 'arraybuffer',
@RaniAgus
RaniAgus / Main.java
Last active October 10, 2025 02:20
String.concat vs StringBuilder.append en Java
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Main {
public static void main(String[] args) {
List<String> pocosStrings = Arrays.asList("0", null, "2", null, null, "5");
List<String> muchosStrings = Stream.generate(() -> pocosStrings)
@RaniAgus
RaniAgus / sisoputnfrba-foro-2224.md
Created April 27, 2022 23:55
Diferencia entre "pisar" y "rellenar" un puntero

Diferencia entre "pisar" y "rellenar" un puntero

Thread original: sisoputnfrba/foro#2224 (comment)

Veamos el siguiente ejemplo:

int a = 0;
a = 1;

En este caso, yo estoy declarando una variable en 0 y luego "piso" ese valor a 1.

@RaniAgus
RaniAgus / sisoputnfrba-foro-2462.md
Last active April 27, 2022 23:56
Sobre Valgrind y "points to uninitialised byte(s)"

Sobre Valgrind y "points to uninitialised byte(s)"

Thread original: sisoputnfrba/foro#2462 (comment)

Resulta que el error de points to uninitialised byte(s) no aparece en el momento si se copia memoria sin inicializar usando memcpy, sino que lo hace recién cuando se intenta acceder, ya sea desde esa variable como de la copia.

Ejemplo:

int main() {