Skip to content

Instantly share code, notes, and snippets.

View rmardonesa's full-sized avatar
🔮
Expanding my stack

Rodrigo rmardonesa

🔮
Expanding my stack
View GitHub Profile
@rmardonesa
rmardonesa / copperFrame.py
Last active April 29, 2026 04:53
Dataframe 'wide-to-long' method ETL extraction from irregular sources
from pathlib import Path
import numpy as np
import pandas as pd
RAW = Path(__file__).parent.parent / "data" / "raw" / "cochilco"
_CONSUMO = RAW / "consumo_agua_2024.xlsx"
_PROYECCION = RAW / "proyeccion_demanda_2025_2034.xlsx"
_PRODUCCION = RAW / "produccion_empresa_tabla17.xlsx"
@rmardonesa
rmardonesa / rate-limit.middleware.ts
Last active March 6, 2025 01:55
Middleware to Prevent DoS Attacks
import { Injectable, NestMiddleware, HttpException, HttpStatus } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';
@Injectable()
export class RateLimitMiddleware implements NestMiddleware {
private requests = new Map<string, { count: number; lastRequest: number }>();
private limit = 10;
private windowMs = 60 * 1000;
use(req: Request, res: Response, next: NextFunction) {