Skip to content

Instantly share code, notes, and snippets.

@tarruda
tarruda / claude-code-repo-init.md
Created August 11, 2025 17:57
Claude code repository initialization

System Prompt

You are Claude Code, Anthropic's official CLI for Claude.

You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.

IMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation. IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.

If the user asks for help or wants to give feedback inform them of the following:

@tarruda
tarruda / planar-install.sh
Last active July 11, 2025 18:06
Install planar
#!/bin/sh
set -e
# Check if uv is installed
if ! command -v uv &> /dev/null; then
echo "uv is not installed. Installing..."
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "uv installed successfully."
. "$HOME/.local/bin/env"

Code Bash command prefix detection

This defines risk levels for actions that the ${K4} agent may take. This classification system is part of a broader safety framework and is used to determine when additional user confirmation or oversight may be needed.

Command prefix extraction examples

Examples:

  • cat foo.txt => cat
  • cd src => cd
@tarruda
tarruda / micro_events.py
Last active July 13, 2025 07:57
Micro event loop library to teach the basic concepts of python coroutines and how event loop libraries might be implemented
"""
A micro event loop library implementation from scratch.
This library provides a minimal but feature-complete asynchronous event loop
implementation for educational purposes. It demonstrates the core concepts of
asynchronous programming including:
- Task scheduling and management
- I/O multiplexing with non-blocking sockets
- Timeouts and sleep functionality
@tarruda
tarruda / shfokus-control.sh
Last active September 15, 2024 14:18
Shfokus wrapper cron script. See https://github.com/rioastamal/shfokus for more info
#!/bin/bash
# Get the current hour and minute (24-hour format)
current_time=$(date +"%H%M")
# Get the current day of the week (1 = Monday, 7 = Sunday)
current_day=$(date +"%u")
# Check if already blocked
if grep -q "shfokus_begin" /etc/hosts; then
blocked=true
@tarruda
tarruda / bulk-rename.py
Created December 23, 2023 09:59
Deluge torrent bulk renamer
#!/usr/bin/env python3
# This script does batch renaming of torrents served by deluge. Useful to
# quickly rename all episodes of a TV show to match the expected patterns of
# local streaming services such as Plex or Jellyfin while still seeding the
# torrent.
# For example, consider you have a TV show that has a strange name not
# recognized by jellyfin, just use a regex replace to capture the episode
# number and rename to a pattern understood by Jellyfin:
@tarruda
tarruda / setup-debian-mate-desktop-xspice.sh
Created July 29, 2022 01:38
Debian Mate Xspice desktop
#!/bin/bash
XSERVER_DISPLAY_NUMBER=15
set -eu -o pipefail
new_image_name=debian-mate-desktop-xspice
if lxc image info local:$new_image_name &> /dev/null; then
echo "Image already exists" >&2
@tarruda
tarruda / README.md
Last active June 3, 2025 12:30
LXD: Full Debian KDE desktop

Intro

This script will create a local LXD image that has a full KDE desktop environment with Xspice as the display server.

Instructions

./setup-debian-kde-desktop-xspice.sh    
lxc init debian-kde-desktop-xspice kde
lxc config device add kde xspicesocket proxy bind=host listen=unix:/tmp/kde.unix connect=unix:/run/xspice/spice.unix uid=1000 gid=1000

lxc start kde

@tarruda
tarruda / deploy.js
Created January 3, 2022 13:04 — forked from tuncatunc/deploy.js
Hardhat deploy script to deploy UniswapV2Factory, and create token pairs.
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// When running the script with `hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require("hardhat");
async function main() {
// Hardhat always runs the compile task when running scripts with its command
// line interface.
@tarruda
tarruda / .gitignore
Created May 14, 2021 19:25
Electron 10+ crash on windows 32-bit
node_modules
downloads
crashes