Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SwiGLU 2D Activation</title>
<style>
* {
margin: 0;
padding: 0;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@NTT123
NTT123 / benchmark_matmul.py
Created October 3, 2025 10:58
Benchmark pytorch matrix multiplication with locked GPU clock for stable performance.
"""
Benchmark matrix multiplication with locked GPU clock for stable performance.
Requires: pip install nvidia-ml-py torch numpy
"""
import pynvml
import torch
import random
import os
import numpy as np
from torch.profiler import profile, ProfilerActivity, schedule
@NTT123
NTT123 / print-cute-tv-layout.ipynb
Created September 27, 2025 09:12
print-cute-tv-layout.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@NTT123
NTT123 / llm-play-chess.html
Created August 5, 2025 16:33
llm-play-chess.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Chess Arena - Gemini API Chess Battle</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0 auto;
Caffeine, a methylxanthine alkaloid, stands as the most widely consumed psychoactive substance on the planet. Its presence is woven into the daily rituals of billions, found in coffee, tea, chocolate, and an ever-expanding universe of energy drinks, sodas, and dietary supplements. Consumers turn to it for its well-documented ability to promote wakefulness, enhance cognition, and boost physical performance. For many, it is an indispensable tool for navigating the demands of modern life. Yet, for a significant portion of these users, the benefits of caffeine come with a familiar list of drawbacks: anxiety, jitters, digestive upset, and disrupted sleep.
Into this landscape has emerged paraxanthine, a compound fascinating yet unfamiliar to most people. Scientifically known as 1,7-dimethylxanthine, paraxanthine is not an obscure molecule from a remote plant but is, in fact, the principal metabolite produced by the human body after caffeine is consumed. When an individual drinks a cup of coffee, their liver rapidly
@NTT123
NTT123 / Paraxanthine.html
Last active July 3, 2025 16:17
Paraxanthine vs. Caffeine
<!DOCTYPE html>
<html lang="en" class="scroll-smooth">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Paraxanthine Versus Caffeine: An Evidence-Based Evaluation</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,[email protected],400;8..60,600;8..60,700&family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
@NTT123
NTT123 / llama3_model.py
Created April 22, 2025 01:25
Llama3 model from scratch
import json
from dataclasses import dataclass
from pathlib import Path
from typing import Optional, Tuple, Union
import torch
import torch.nn.functional as F
from torch import nn
@NTT123
NTT123 / memory_efficient_adamw.py
Last active April 18, 2025 11:14
Memory Efficient AdamW optimizer that offloads optimizer states to CPU memory
import math
import torch
from torch.optim import AdamW
class MemoryEfficientAdamW(AdamW):
"""
Memory Efficient AdamW optimizer that keeps parameters and gradients on GPU
but optimizer states on CPU when enabled.
"""
This script fetches download statistics for major LLM provider packages (OpenAI, Anthropic, Claude) from PyPI Stats API
and generates an HTML visualization showing the relative market share across different operating systems.
The visualization consists of three pie charts displaying the percentage of downloads for each package on:
- Windows
- MacOS (Darwin)
- Linux
Each chart shows: