Skip to content

Instantly share code, notes, and snippets.

View ashkangoleh's full-sized avatar
🎯
Focusing

Ashkan Golehpour ashkangoleh

🎯
Focusing
View GitHub Profile
@ashkangoleh
ashkangoleh / microgpt.py
Created February 12, 2026 13:22 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and inference a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@ashkangoleh
ashkangoleh / groups.sql
Created November 7, 2023 06:00 — forked from EcZachly/groups.sql
How to write an algorithm to group people in optimized groups based on timezone and track
-- first query all the users
WITH offsets AS (SELECT a.*,
EXTRACT(hour FROM ptn.utc_offset) AS utc_offset
FROM bootcamp.attendees a
JOIN pg_timezone_names ptn ON a.timezone = ptn.name
WHERE a.bootcamp_version = 3
AND a.timezone IS NOT NULL
AND a.content_delivery = 'Live'::text
),
-- then aggregate the users by track and offset, we want matching timezones to fill up first