Skip to content

Instantly share code, notes, and snippets.

View leandronsp's full-sized avatar

Leandro Proença leandronsp

View GitHub Profile
@leandronsp
leandronsp / Dockerfile
Last active July 16, 2026 08:56
A multi-threaded web server in Assembly x86
FROM --platform=linux/amd64 ubuntu
RUN apt-get update
RUN apt-get install make binutils build-essential -y
RUN apt-get install nasm gdb strace -y
WORKDIR /app
@leandronsp
leandronsp / pair.md
Created March 26, 2026 04:43
[SKILL] Pair with Claude
name pair
description TDD pair programming with mode switching. Claude can be driver (writes code) or navigator (watches, questions, provokes). Supports GitHub/Linear issues, file watching, or arbitrary prompts. Scientific TDD, baby steps, one test at a time. Trigger on phrases like "pair", "let's pair", "pair with me", "tdd", "you drive", "I'll drive", "pair program", "dojo".

Pair — TDD Pair Programming

Two modes, one skill. Switch anytime.

  • Driver mode — Claude writes code, user navigates
@leandronsp
leandronsp / init.lua
Last active August 19, 2025 11:23
My dotfiles
--[[
=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
======== .-----. ========
======== .----------------------. | === | ========
======== |.-""""""""""""""""""-.| |-----| ========
======== || || | === | ========
======== || KICKSTART.NVIM || |-----| ========
@leandronsp
leandronsp / 001-README.md
Last active August 12, 2025 15:16
OOP in Bash script

OOP in Bash script

Wait, what?

Inspired by this awesome article.

Prelude about OOP

According to wikipedia, OOP is a programming paradigm or technique based on the concept of "objects". The object structure contain data and behaviour.

Data is the object's state, which should be isolated and must be private.

@leandronsp
leandronsp / 001-server.bash
Last active May 21, 2025 10:02
A complete yet simple Web server (with login & logout system) written in Shell Script
#!/bin/bash
## Create the response FIFO
rm -f response
mkfifo response
function handle_GET_home() {
RESPONSE=$(cat home.html | \
sed "s/{{$COOKIE_NAME}}/$COOKIE_VALUE/")
}
@leandronsp
leandronsp / linked_list_queue.rs
Created July 25, 2023 02:03
a queue using singly linked list in Rust (with tail node)
struct Node<T> {
value: T,
next: Option<Box<Node<T>>>
}
impl<T> Node<T> {
fn new(value: T) -> Self {
Self { value, next: None }
}
}
@leandronsp
leandronsp / README.md
Created November 20, 2024 19:57
Reverse Polish Notation (RPN) in Assembly x86_64

RPN in ASM x86_64

nasm -f elf64 -g rpn.asm -o rpn.o
ld rpn.o -o rpn
./rpn

Output

@leandronsp
leandronsp / add-index.sql
Created June 11, 2022 02:54
Comparing B-Tree index vs CTE's
DROP INDEX IF EXISTS transfers_in, transfers_out;
CREATE INDEX transfers_in ON transfers (target_account_id);
CREATE INDEX transfers_out ON transfers (source_account_id);
@leandronsp
leandronsp / server.rb
Created February 15, 2023 11:39
HTTP server using Ractors (Ruby 3)
require 'socket'
@queue = Ractor.new do
loop do
Ractor.yield(Ractor.receive, move: true)
end
end
listener = Ractor.new(@queue) do |queue|
socket = TCPServer.new(PORT)
@leandronsp
leandronsp / leetpolvo.rb
Created April 22, 2024 21:22
LeetPolvo
# ruby 3+
# gem install test-unit
require 'test/unit/assertions'
include Test::Unit::Assertions
def balanced?(input)
delimiters = {
"(" => ")",
"{" => "}",
"[" => "]"