LLM CODING SHOWCASE

Qwen3.8 Flash-Next
Generated In Code

Every snippet below was written by the Flash-Next model running on llama.cpp. Styling & palette fronted by the same model.

model Qwen3.8-Flash-Next
runtime llama.cpp
backend 192.168.10.198:8081
host ka308.com

Python — Algorithms

Typed, documented, O(n).

merge_sortedpython
def merge_sorted(a: list[T], b: list[T]) -> list[T]:
    """Merge two sorted lists into one sorted list in O(n)."""
    result: list[T] = []
    i = j = 0
    while i < len(a) and j < len(b):
        if a[i] <= b[j]:
            result.append(a[i]); i += 1
        else:
            result.append(b[j]); j += 1
    result.extend(a[i:]); result.extend(b[j:])
    return result
LRUCachepython
from collections import OrderedDict
from typing import Generic, TypeVar, Optional

K = TypeVar("K"); V = TypeVar("V")

class LRUCache(Generic[K, V]):
    """LRU cache with O(1) get/put."""
    def __init__(self, capacity: int) -> None:
        if capacity <= 0: raise ValueError("capacity must be > 0")
        self.capacity = capacity
        self._cache: OrderedDict[K, V] = OrderedDict()

    def get(self, key: K) -> Optional[V]:
        if key not in self._cache: return None
        self._cache.move_to_end(key)
        return self._cache[key]

    def put(self, key: K, value: V) -> None:
        if key in self._cache: self._cache.move_to_end(key)
        self._cache[key] = value
        if len(self._cache) > self.capacity:
            self._cache.popitem(last=False)

JavaScript — Utilities

Debounce.

debouncejs
const debounce = (fn, delay = 100) => {
  let t;
  return (...args) => {
    clearTimeout(t);
    t = setTimeout(() => fn(...args), delay);
  };
};

React — Component

Function component with useState.

Counterreact
import { useState } from 'react';

export default function Counter() {
  const [count, setCount] = useState(0);

  return (
    <div>
      <h1>Count: {count}</h1>
      <button onClick={() => setCount(c => c - 1)}>-</button>
      <button onClick={() => setCount(c => c + 1)}>+</button>
    </div>
  );
}

SQL — Query

Top 5 most-purchased products.

top_productssql
SELECT oi.product_id, SUM(oi.quantity) AS total_quantity
FROM order_items oi
JOIN orders o ON o.order_id = oi.order_id
GROUP BY oi.product_id
ORDER BY total_quantity DESC
LIMIT 5;

Shell — Bash

Largest file in a tree.

largest_filebash
largest_file() {
  find "${1:-.}" -type f -printf '%s\t%p\n' \
    | sort -nr | head -n1 | cut -f2
}