Samir's Engineering Notes and Projects

website·Indexed 29 days ago

https://samir.pages.dev

A collection of technical guides and projects covering system design, operating system fundamentals, and distributed systems. Includes documentation on database schema migrations with golang-migrate, vector databases and RAG systems, Vim navigation, Git/GitHub workflows, and various Python-based tools such as a PDF compression tool and a 2D shooter game.

Tokens
50.6K
Snippets
186
Records
303
Agent score
75%

What's inside Samir's Engineering Notes

  1. Introduction to Vector Databases for AI Applications

    A vector database is a specialized system designed to store and query high-dimensional vector embeddings. Unlike traditional databases that perform exact matches, vector databases perform similarity searches to find items semantically related to a query. They are essential for AI applications to solve common LLM limitations: providing current information (overcoming knowledge cutoffs), grounding responses in factual data (reducing hallucinations), persisting context (long-term memory), and injecting specialized domain knowledge.
  2. Overview of Huffman Coding Text Compressor Web App

    The Huffman Coding Web Application is a lossless data compression tool designed to reduce the size of .txt files by approximately 35-40%. It works by assigning variable-length binary codes to characters based on their frequency of occurrence: more frequent characters receive shorter codes, and less frequent characters receive longer codes. The application is built using JavaScript, HTML5, and CSS3.
  3. Overview of the Serverless Newsletter & Contact System

    This system is designed for massive scalability (from 1 to 1M+ subscribers) using a zero-infrastructure approach. It leverages Cloudflare's global edge network (275+ locations) to provide low-latency (<50ms) email automation and contact management. Key capabilities include multi-provider email support, adaptive bot protection, and automated RSS feed processing.
  4. Overview of golang-migrate for multi-database architectures

    golang-migrate is a database-agnostic migration tool available as both a CLI and a Go library. It is suitable for microservices architectures where different database engines (e.g., PostgreSQL for transactional data and ClickHouse for analytics) are used. It provides an audit trail of schema changes and prevents race conditions and dirty states during deployment via a tracking table.
  5. Overview of the Real-Time Voice Translator (RTVT) architecture

    The Real-Time Voice Translator uses a hybrid pipeline rather than an end-to-end spectrogram model to ensure broader language support and robustness. The system follows a sequential data flow: capturing audio, converting speech to text, adapting the text via transliteration, translating the text to the target language, and synthesizing the result back into speech.
  6. Implement a context switch in x86 Assembly

    The switch_to macro performs a low-level context switch between two tasks on x86 architecture. It saves the current task's CPU state (flags, base pointer, stack pointer, and instruction pointer) into the prev thread structure and restores the state from the next thread structure to resume execution of the target task.
    // arch/x86/include/asm/switch_to.h
    #define switch_to(prev, next, last) do {
        /* Save previous task's context */
        asm volatile(
            "pushfl\n\t"              /* Save flags */
            "pushl %%ebp\n\t"         /* Save base pointer */
            "movl %%esp,%[prev_sp]\n\t" /* Save stack ptr */
            "movl %[next_sp],%%esp\n\t" /* Load next stack */
            "movl $1f,%[prev_ip]\n\t"   /* Save return IP */
            "pushl %[next_ip]\n\t"      /* Push next IP */
            "jmp __switch_to\n\t"       /* Context switch */
            "1:\t"
            "popl %%ebp\n\t"          /* Restore base ptr */
            "popfl\n"                 /* Restore flags */
            : [prev_sp] "=m" (prev->thread.sp),
              [prev_ip] "=m" (prev->thread.ip)
            : [next_sp]  "m" (next->thread.sp),
              [next_ip]  "m" (next->thread.ip),
              [prev]     "a" (prev),
              [next]     "d" (next)
            : "memory", "cc"
        );
    } while (0)
  7. Implement a basic Cloudflare Worker entry point

    Cloudflare Workers use a module-based entry point. The fetch handler is the primary way to process incoming HTTP requests. This architecture scales automatically from a single request to billions without requiring changes to the code, as Cloudflare manages the underlying V8 Isolates and global distribution.
    export default {
      async fetch(request, env) {
        // This code handles any scale automatically
        return new Response("Hello World");
      }
    }
  8. Pomodoro Timer Feature Overview

    A free, privacy-focused Pomodoro Timer designed for deep work, studying, and coding. It operates as a single HTML file with zero dependencies, requiring no account, cookies, or tracking. The tool implements the Pomodoro Technique by breaking work into focused intervals (traditionally 25-30 minutes) separated by short breaks.
  9. Access the DSAlgo Python Interview Preparation Repository

    The DSAlgo repository is a comprehensive resource for technical interview preparation (FAANG and top product companies). It contains over 3000 coding problems solved in Python, organized by data structure and algorithm type. It includes optimal solutions, complexity analysis, and curated problem lists.
    # Repository Link
    https://github.com/SamirPaulb/DSAlgo
  10. Understand V8 Isolates in Cloudflare Workers

    Cloudflare Workers use V8 Isolates instead of containers or VMs. This allows for microsecond cold starts and high memory efficiency. Each isolate provides memory and CPU isolation while sharing a single runtime process. This architecture enables the system to handle requests with minimal overhead (~0.005ms) compared to traditional FaaS containers (500-3000ms).
    // Conceptual V8 Isolate Execution Model
    class WorkerIsolate {
        constructor(code) {
            this.context = new V8.Context();  // Created in microseconds
            this.globals = this.setupGlobals();
            this.code = code;
        }
        async handleRequest(request) {
            // Worker code executes here, isolated from other workers
            return await this.code.fetch(request);
        }
    }
  11. Define the components of a Process

    A process is an active instance of a program in execution. Unlike a program (a passive file on disk), a process consists of several dynamic components:

    1. Program Code (Text Section): The actual executable instructions.
    2. Program Counter: Tracks the current instruction position.
    3. Processor Registers: Holds current state and intermediate values.
    4. Stack: Manages temporary data, local variables, and function call frames.
    5. Data Section: Stores global variables.
    6. Heap: Manages memory allocated dynamically during runtime.
  12. Understand the Git Object Model

    Git stores data as a directed acyclic graph (DAG) using four main object types. All objects are content-addressable, meaning they are identified by a unique SHA-1 hash based on their content, making history immutable and detectable if changed.

    The hierarchy is as follows:

    • Commit: Points to a tree, a parent commit, and author information.
    • Tree: Represents the directory structure.
    • Blob: Stores the actual immutable file contents.
    • Tag: An optional reference to a specific commit.