Skip to content

Instantly share code, notes, and snippets.

View castocolina's full-sized avatar

Casto Colina castocolina

  • Santiago, Chile
View GitHub Profile
@castocolina
castocolina / statusline.sh
Created March 31, 2026 10:19
Claude snippets
#!/bin/bash
# Claude Code StatusLine Script
# Receives JSON metadata via stdin and displays dynamic status information
# Read JSON input from stdin
input=$(cat)
# ─── Terminal dimensions ───────────────────────────────────────────────────────
# stty size reads from the controlling TTY even when stdin is piped (JSON input)
if _sz=$(stty size </dev/tty 2>/dev/null); then
@castocolina
castocolina / .zshrc
Last active March 18, 2026 17:27
My aliases
# Docker compose ps with watch alias/function
watch-compose-ps() {
watch 'docker compose ps --format "table {{.Label \"com.docker.compose.service\"}}\t{{.CreatedAt}}\t{{.Status}}" | sed "1s/service/SERVICE/"'
}
alias docker-memory='docker stats --format "table {{.Name}}\t{{.MemUsage}}\t{{.MemPerc}}"'
# Only upgrade packages that have updates available
alias apt-upgrade='sudo apt install --only-upgrade $(apt list --upgradeable 2>/dev/null | grep -v "Listing" | cut -d/ -f1 | tr "\n" " ")'
name reviewing-plans
description Use when a plan, spec, or design document has been produced and needs review before implementation — or when reviewing existing planning documents for consistency and completeness. Also use when documents exist in docs/plans/, docs/superpowers/specs/, or ~/.claude/plans/.

Reviewing Plans

@castocolina
castocolina / config
Created March 11, 2026 11:47
.ssh/config
# ============================================
# Corresponding SSH Configuration (~/.ssh/config)
# ============================================
# This SSH config is to use different SSH keys for different contexts
# # Ignore UseKeychain on systems that don't support it (Linux)
# IgnoreUnknown UseKeychain
#
# # Global configuration - store passphrases in macOS Keychain
# Host *
@castocolina
castocolina / .gitconfig
Last active March 11, 2026 11:45
Git SSH artificial host to apply different rules
# ============================================
# Main Git Configuration File (~/.gitconfig)
# ============================================
# This file demonstrates how to use conditional includes to automatically
# apply different Git configurations based on repository context.
# Perfect for managing multiple identities (work/personal) across different
# organizations and platforms.
# --------------------------------------------
# Core Git Behavior
@castocolina
castocolina / test.cpp
Created March 9, 2025 02:49
ESP32-c3 Supermini OLED test
#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>
// there is no 72x40 constructor in u8g2 hence the 72x40 screen is mapped in the middle of the 132x64 pixel buffer of the SSD1306 controller
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE, 6, 5);
int width = 72;
int height = 40;
int xOffset = 30; // = (132-w)/2
int yOffset = 12; // = (64-h)/2
void setup(void)
@castocolina
castocolina / esp32.cpp
Last active March 9, 2025 02:48
ESP32 chinp info
Serial.begin(115200);
while (!Serial) {
delay(10); // wait for serial port
}
Serial.println("SETUP ESP32:::");
Serial.println(ESP.getChipModel());
Serial.println(ESP.getChipRevision());
Serial.println(ESP.getChipCores());
Serial.println();
@castocolina
castocolina / export-dot-file.bash
Created March 4, 2025 23:56
Find .dot files in diagrams folder & export .png files
#!/bin/bash
find diagrams -name "*.dot" | while read file; do
filename=$(basename "$file" .dot)
dot -Tpng "$file" -o "diagrams/${filename}.png"
done
@castocolina
castocolina / arduino-cli-install.sh
Last active January 28, 2025 00:15
Arduino CLI install Ubuntu
#!/bin/zsh
# Define installation directory
INSTALL_DIR="$HOME/opt/arduino-cli"
# Create the installation directory if it doesn't exist
mkdir -p $INSTALL_DIR
# Fetch the latest release info from GitHub
echo "Fetching the latest Arduino CLI release..."
@castocolina
castocolina / arduino-ide-install.sh
Last active January 11, 2025 20:35
Arduino IDE 2.x install Ubuntu
#!/bin/bash
# Function to check if a command exists, and install it if not
install_if_missing() {
command -v "$1" >/dev/null 2>&1 || {
echo "$1 is not installed. Installing..."
sudo apt install -y "$2"
}
}