Skip to content

Instantly share code, notes, and snippets.

View valarpirai's full-sized avatar

Valar valarpirai

View GitHub Profile
@valarpirai
valarpirai / byte-buddy-guide.md
Last active May 26, 2026 07:18
Byte Buddy: A Practical Guide to Java Bytecode Instrumentation

Byte Buddy: A Practical Guide to Java Bytecode Instrumentation

Byte Buddy lets you create and modify Java classes at runtime without a compiler. You can add methods, intercept calls, inject fields, and rewrite bytecode — all after the JVM has started.

This guide walks through every major strategy with working examples, failure cases, and real-world parallels.


Table of Contents

A Shared Gradle Build System for Multi-Repo Platforms

Large Java platforms often span dozens of repositories — each with its own build files, dependency declarations, and tooling configuration. Without a unified approach, version drift creeps in, build logic gets duplicated, and a routine dependency upgrade turns into a multi-repo coordination nightmare.

This post walks through an architecture pattern that solves this using Gradle: a dedicated shared-build repository that acts as the single source of truth for build logic, dependency versions, and project conventions across every repo in the platform.


Key Principles

@valarpirai
valarpirai / ticket-booking-system-design-summary.md
Created April 22, 2026 12:50
Summary of system design round summary

Here's a clean, concise summary of the key steps to design a Ticket Booking System (like BookMyShow or Ticketmaster) in a system design interview:

1. Clarify Requirements (5–8 mins)

  • Functional: Browse/search events by city/date/category → View seat map → Select & hold seats → Make payment → Confirm booking → View/cancel bookings.
  • Non-Functional: Handle high concurrency (flash sales), prevent double-booking (strong consistency for seats), low latency, high availability (99.99%), scalability to 10k–100k+ RPS at peak.
  • Ask about scale, payment integration, cancellation rules, admin features.

2. Back-of-the-Envelope Estimation

Estimate:

  • Daily active users, peak RPS during sales.
@valarpirai
valarpirai / Build-A-Programming-Language.md
Last active May 9, 2026 15:31
How to build a programming language. Step by step guide

How to Build a Simple Programming Language

A step-by-step guide grounded in the Aether language — a complete tree-walking interpreter written in Rust.


For Beginners: Where to Start

Prerequisites

@valarpirai
valarpirai / multi-agent.md
Last active April 8, 2026 05:43
AI Agent integration with Slack bot

Product Requirements Document (PRD)

Product Name: Multi-Agent Slack Bot (OpsBot / AgentHub)
Version: 1.1
Date: April 08, 2026
Author: Grok – AI Agentic Engineer
Status: Revised & Consolidated

1. Executive Summary

@valarpirai
valarpirai / claude_god.md
Last active March 22, 2026 16:46
Claude Code God PROMPT
  • Analyse the @docs dir and claude.md
  • What can be improved in the doc files so that claude code can work better?
  • After the doc changes, review it
  • Don't try to create large files at single shot instead create them step by step

Sophisticated AI-augmented development workflow:

🛤️ End-to-End AI-Assisted Flow (what actually happens)

  1. 🎯 Start with strong written thinking
    → RFC / Proposal → Full system design & architecture → Integration map

  2. 👥 Design review with senior engineers

  3. ✅ Approved? → Deep subsystem specs & interface contracts

@valarpirai
valarpirai / get_body_echo.py
Created January 28, 2026 03:36
Here's a simple Python script that creates a tiny HTTP server and echoes back any payload/body sent in a GET request (even though this is very non-standard and most real APIs reject it).
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
class GetBodyEchoHandler(BaseHTTPRequestHandler):
def do_GET(self):
# Read the raw body (if any was sent)
content_length = int(self.headers.get('Content-Length', 0))
body = self.rfile.read(content_length) if content_length > 0 else b''
# Prepare response
@valarpirai
valarpirai / ConfigController.java
Created January 16, 2026 06:56
Controller without error handling
import org.springframework.web.bind.annotation.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.sql.*;
@RestController
@RequestMapping("/api/config")
public class ConfigController {
private static final String DB_URL = "jdbc:mysql://localhost:3306/mydb";
private static final String DB_USER = "admin";
@valarpirai
valarpirai / ConfigController-withErrorHandling.java
Last active January 16, 2026 06:56
Error Handling code snippet
// ConfigController with proper error handling
import org.springframework.web.bind.annotation.*;
import org.springframework.http.*;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.dao.*;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.validation.Valid;