Skip to content

Instantly share code, notes, and snippets.

View rubenhortas's full-sized avatar
:octocat:

Rubén Hortas rubenhortas

:octocat:
View GitHub Profile
@rubenhortas
rubenhortas / ansi_colors.py
Created November 5, 2026 21:36
Print all the codes for standard ANSI text styles and colors, as well as those from the extended 256-color palette, in your terminal in their respective colors
#!/usr/bin/env python3
"""
Print all the codes for standard ANSI text styles (Bold, Italic, Underline,
Blink,etc.)and colors (foreground and background), as well as those from
the extended 256-color palette (using ANSI mode 38;5;n), in your terminal
in their respective colors.
"""
# Basic ANSI codes:
@rubenhortas
rubenhortas / get_architecture.py
Last active November 6, 2026 11:36
Python Project Architecture Generator
#!/usr/bin/env python3
"""
Python Project Architecture Generator
Description:
Recursively scans a Python project directory, renders its directory and file
hierarchy in a tree-like format.
It extracts and displays module-level constants, global functions,
@rubenhortas
rubenhortas / ruff.toml
Last active October 24, 2026 18:32
Ruff settings for Python projects
# File: ruff.toml
#
# Description: Configuration for Ruff (linter/formatter).
#
# Usage Options:
# 1. PROJECT: Place in the root directory of your Python project to apply these settings locally to that specific project.
#
# 2. GLOBAL FALLBACK: Place in your global configuration directory to apply as a system-wide default for all projects:
# - Linux/macOS: ~/.config/ruff/ruff.toml
# - Windows: %USERPROFILE%\.config\ruff\ruff.toml
@rubenhortas
rubenhortas / nlayer_overview.md
Last active November 9, 2026 10:47
Clean Architecture & DDD Overview

Modern Clean Architecture & DDD Overview

A modern architectural pattern based on Domain-Driven Design (DDD) and Clean Architecture. It prioritizes the Dependency Inversion Principle—ensuring that business rules remain completely independent of frameworks, databases, and external UI concerns.

Dependency Rule & Data Flow

Presentation Layer ➔ Application Layer ➔ Domain Layer ⟵ Infrastructure Layer (Dependencies point strictly inward toward the core Domain.)


@rubenhortas
rubenhortas / .clang-format
Last active March 31, 2026 18:21
Standard C style rules
# Apply to project: Place in the project root directory
# Apply globally: Place in ~/
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 120
IndentWidth: 4
TabWidth: 4
PointerAlignment: Right
AllowShortBlocksOnASingleLine: Never
AllowShortIfStatementsOnASingleLine: Never
@rubenhortas
rubenhortas / steven_black_hosts_updater.py
Last active August 18, 2026 13:59
Steven Black Hosts Updater
#!/usr/bin/env python3
"""
Steven Black Hosts Updater
This script automates the process of updating the system's hosts file using
the curated lists provided by Steven Black in https://github.com/StevenBlack/hosts
Requirements:
1. A Steven Black hosts file in /etc/hosts
@rubenhortas
rubenhortas / pyproject.toml
Last active October 24, 2026 18:31
Ruff and basedpyright rules for python projects
# File: pyproject.toml
#
# Description: Project-specific configuration shared with your team.
# Contains settings for both Ruff (linter/formatter) and Basedpyright (type checker).
#
# Location: Place in the ROOT directory of your Python project.
#
[tool.basedpyright]
typeCheckingMode = "basic"
@rubenhortas
rubenhortas / show_renamer.py
Last active November 10, 2026 08:18
Utility to normalize show filenames
#!/usr/bin/env python3
"""
Show Renamer: A utility to normalize show filenames.
This script automates the tedious process of renaming video files from messy
tracker formats (e.g., 'Show.Name.S01E01.720p.x264-Group.mkv') into a clean,
standardized structure (e.g., 'Show Name S01E01.mkv').
KEY FEATURES:
@rubenhortas
rubenhortas / gnu_linux_console_shortcuts_cheatsheet.md
Last active February 15, 2026 00:42
GNU/Linux console shortcuts cheatsheet

GNU/Linux console shortcuts

Editing

Keys Action
TAB
CTRL+i
Autocomplete
CTRL+u Delete everything from the cursor position to the beginning of the line
CTRL+k Delete everything from the cursor position to the end of the line
CTRL+w Delete the word before the cursor
@rubenhortas
rubenhortas / git_cheatsheet.md
Last active August 17, 2026 18:26
git cheatsheet

git cheatsheet

User settings

Command Description
git config --global user.name $name Configure user name
git config --global user.email $mail Configure user email

Repository