Spinalshock Documentation

website·Indexed 29 days ago

https://spinalshock.github.io

A personal knowledge base and technical documentation site covering backend development with Go, frontend notes on React and JavaScript, homelab configurations involving LXC and Tailscale, terminal setup for Ghostty and Tmux, and AI tool workflows including Cursor and Claude.

Tokens
33.5K
Snippets
176
Records
239
Agent score
75%

What's inside Spinalshock Docs

  1. Overview of Statistical Foundations for Machine Learning

    Foundational statistical concepts are essential for understanding data distribution and the behavior of ML algorithms. Key concepts include:

    • Variance: A statistical measure of data dispersion used to understand how spread out the data is.
    • Normal Distribution: A bell-shaped probability distribution that serves as a fundamental assumption for many ML algorithms.
    • Measures of Central Tendency: Includes Mean, Median, and Mode, used to characterize the center of a dataset.
  2. Understand Neural Network Architectures

    Neural networks vary in architecture depending on the type of data they process:

    • Perceptron: The most basic building block of a neural network.
    • Convolutional Neural Networks (CNNs): Optimized for image processing using convolution and pooling layers.
    • Recurrent Neural Networks (RNNs) & LSTMs: Designed for sequential data; LSTMs specifically handle long-term dependencies.
    • Transformers: An attention-based architecture that allows for parallel processing, revolutionizing Natural Language Processing (NLP).
    • Generative Adversarial Networks (GANs): Uses a generator and discriminator in adversarial training to generate new data.
    • Variational Autoencoders (VAEs): A probabilistic approach to encoding and generating data.
  3. Build a YouTube Transcript MCP Server in Go

    To provide AI assistants with YouTube context without relying on shared infrastructure (which often faces IP bans), you can build a local MCP server using Go and yt-dlp. This architecture allows for local execution, custom rate limiting, and zero dependency on official YouTube Data API keys.
    ┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
    │   Claude/AI     │◄──►│   MCP Server    │◄──►│    yt-dlp       │
    │                 │    │   (Go Binary)   │    │  (External CLI) │
    └─────────────────┘    └─────────────────┘    └─────────────────┘
                                   │
                                   ▼
                           ┌─────────────────┐
                           │ Web Scraping    │
                           │ (Video Metadata)│
                           └─────────────────┘
  4. Use Firenvim to edit browser textareas with Neovim

    Firenvim is a browser plugin that allows you to use a full Neovim GUI over any web-based textarea. It functions by launching a Neovim instance in the background and acting as a remote UI client, enabling the use of custom keymaps and plugins directly within the browser.
  5. Understand Vite build tool internals

    Vite uses esbuild for development builds to ensure speed and Rollup for production builds to optimize the final bundle. It is planned to be replaced by Rolldown, a Rust-based build tool.
  6. Understand the disk storage hierarchy

    Disk storage is organized in four primary layers. Understanding this hierarchy is essential for managing data and performing recovery or wiping operations:

    1. Physical Disk: The actual hardware storage medium.
    2. Partition Table: A map (e.g., GPT or MBR) that defines storage sections on the physical disk.
    3. Filesystem: The organization system (e.g., ext4) that manages files within a specific partition.
    4. Files: The actual data stored within the filesystem.
  7. Implement a layered architecture for Go backend services

    To maintain a clean separation of concerns, organize the codebase into distinct layers. A key constraint is to avoid mixing tags: DB models must only use gorm tags, and domain models must only use json tags. JSONB fields in DB models should be treated as write-only from the application's perspective; data is marshalled for storage but not unmarshalled back into the API layer, as the service should return the domain model already held in memory.
    | Layer         | Location                    | Purpose                                                                           |
    | ------------- | --------------------------- | --------------------------------------------------------------------------------- |
    | DB models     | internal/database/models.go | GORM structs — talk to PostgreSQL                                                 |
    | Domain models | internal/models/            | Business logic structs — returned from services, serialised in API responses      |
    | Service       | internal/service/           | Business logic, orchestration. Returns domain models. DB save is internal detail. |
    | Handlers      | internal/api/               | HTTP request/response. Calls service, returns domain models as JSON.              |
    | Providers     | internal/providers/         | External loan provider integrations (VoltMoney, Quicklend)                        |
    | Clients       | internal/client/            | Internal microservice HTTP clients                                                |
  8. Simplify API caching with Tanstack Query

    Use Tanstack Query (formerly React Query) to handle API request caching, automatic cache expiry, hydration, and precaching, removing the need for manual caching logic.
  9. Implement clickable actions using <button>

    Always use the <button> element for clickable actions instead of <div> or <span>. The <button> element provides native keyboard navigation, screen reader support, focus management, and correct cursor behavior.
    <button onclick="doSomething()">Click me</button>
    <button type="submit">Submit</button>
  10. Install and initialize Zstd in a React project

    Use the @oneidentity/zstd-js package to provide JavaScript bindings for Zstd. Since Zstd uses asynchronous WebAssembly, it must be initialized before use, typically within a useEffect hook.
    npm install @oneidentity/zstd-js
    import { useState, useEffect } from "react";
    import { ZstdInit } from "@oneidentity/zstd-js";
    
    const Paste = () => {
      const [zstdModule, setZstdModule] = useState(null);
      const [isZstdReady, setIsZstdReady] = useState(false);
    
      useEffect(() => {
        async function initZstd() {
          try {
            const module = await ZstdInit();
            setZstdModule(module);
            setIsZstdReady(true);
          } catch (error) {
            console.error("Zstd initialization failed", error);
          }
        }
        initZstd();
      }, []);
    };
  11. Install NeoMutt on macOS and Arch Linux

    NeoMutt can be installed using the following package managers depending on your operating system.
    # macOS
    brew install neomutt
    
    # Arch Linux
    pacman -Syu neomutt
  12. Implement Algolia DocSearch in Docusaurus

    To integrate Algolia DocSearch into a Docusaurus site, follow these high-level steps:

    1. Apply for DocSearch access via the official application process.
    2. Add the required Algolia configuration to your docusaurus.config.js file.
    3. Complete the domain verification process to prove ownership of the site.
    4. Deploy the site and wait 24-48 hours for the initial indexing to complete.