Skip to content

Instantly share code, notes, and snippets.

View Pelirrojo's full-sized avatar
🤷‍♂️
Somewhere I have to keep my test code

Manuel Eusebio de Paz Carmona Pelirrojo

🤷‍♂️
Somewhere I have to keep my test code
View GitHub Profile
@Pelirrojo
Pelirrojo / README-armagedocker.md
Last active March 11, 2025 15:43
An script to clean all docker/podman stuff in your laptop

Are you ready for more action?

  chmod +x armagedocker
  sudo mv armagedocker /usr/local/bin/
  armagedocker.sh
@Pelirrojo
Pelirrojo / podman-ubuntu-nvidia-gpu-setup.sh
Last active March 1, 2025 10:01
Podman, GPU, Ubuntu, Nvidia, CDI Setup
# Enable debug?
#sudo nano /etc/nvidia-container-runtime/config.toml
# Install Nvidia container toolkit
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo apt install --reinstall nvidia-compute-utils-560 # https://forums.developer.nvidia.com/t/nvidia-smi-really-slow-to-execute/165429/3
# Check drivers & Cuda
nvidia-smi
@Pelirrojo
Pelirrojo / razer_ultra_type_pro_setup_ubuntu.sh
Created January 23, 2025 11:05
Razer Pro Type Ultra Keyboard: How to use function keys without holding down fn key? (Ubuntu)
# Reference: https://unix.stackexchange.com/questions/693846/razer-pro-type-ultra-keyboard-how-to-use-function-keys-without-holding-down-fn
# Save the following lines at /etc/udev/hwdb.d/50-razer-pro-type-ultra.hwdb
evdev:input:b*v1532p027B*
KEYBOARD_KEY_c00e2=f1
KEYBOARD_KEY_c00ea=f2
KEYBOARD_KEY_c00e9=f3
KEYBOARD_KEY_c018a=f4
KEYBOARD_KEY_c0227=f5
@Pelirrojo
Pelirrojo / restriction.sh
Created December 28, 2024 22:25
Kids restrictions on Linux
# https://snapcraft.io/install/snap-store/ubuntu ---------------------------------
sudo apt update
sudo apt install snapd
sudo snap install snap-store
# https://www.baeldung.com/linux/limit-user-computer-time -------------------------
sudo add-apt-repository ppa:mjasnik/ppa
sudo apt update
sudo apt install timekpr-next
@Pelirrojo
Pelirrojo / S3-report-bucket-detail-and-cost.py
Created November 11, 2024 20:05
Informe detallado de S3 con coste y detalle del contenido para cada bucket.
#!/usr/bin/env python3
import boto3
import datetime
from pathlib import Path
from typing import Dict, List, Tuple
import humanize
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
@Pelirrojo
Pelirrojo / clean_dev_temp_files.sh
Created November 11, 2024 18:38
Script para limpiar node_modules y ipynb_checkpoints del directorio actual e hijos
#!/bin/bash
# Nombre del script: cleanup.sh
# Descripción: Elimina recursivamente directorios .ipynb_checkpoints y node_modules
# Colores para mensajes
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
@Pelirrojo
Pelirrojo / evereven_AWS_CW_put-metric-alarm.sh
Created October 30, 2024 14:42
Phase 0 | Initial Detection with CloudWatch Alarms
# A vantablack friday: How to be prepared to stop DDoS Attacks after Halloween
# https://blog.evereven.tech
# Create a cloudwatch alarm
aws cloudwatch put-metric-alarm \
--alarm-name High-CPU-Utilization \
--metric-name CPUUtilization \
--namespace AWS/EC2 \
--period 300 \
--evaluation-periods 1 \
@Pelirrojo
Pelirrojo / evereven_AWS_WAF_CREATE_pattern-matching-rules.sh
Created October 30, 2024 14:32
Phase 2: Enhanced Protection | Implement Custom WAF Rules for Pattern Matching
# A vantablack friday: How to be prepared to stop DDoS Attacks after Halloween
# https://blog.evereven.tech
# Create a WebACL Group Rule (replace [SUSPICIOUS_AGENT_IN_BASE64])
aws wafv2 create-rule-group \
--name "pattern-matching-rules" \
--scope REGIONAL \
--capacity 1000 \
--visibility-config \
MetricName=DDOSRuleMetric,SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true \
@Pelirrojo
Pelirrojo / evereven_AWS_CW_put-dashboard.sh
Created October 30, 2024 14:28
Monitoring the Mitigation
# A vantablack friday: How to be prepared to stop DDoS Attacks after Halloween
# https://blog.evereven.tech
# Create a local json file with the configuration
cat > dashboard.json << 'EOL'
{
"widgets": [
{
"type": "metric",
"properties": {