Skip to content

Instantly share code, notes, and snippets.

@LeZuse
LeZuse / microgpt.py
Created February 19, 2026 18:35 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and run inference for 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
@LeZuse
LeZuse / sim.cc
Created August 12, 2025 21:24 — forked from bwasti/sim.cc
/*
sim.cc
Compile:
g++ sim.cc -std=c++11 -lpheval -O3 -o sim -IPokerHandEvaluator/cpp/include -LPokerHandEvaluator/cpp/build
./sim
Run: (all arguments are optional, defaults to 9 player full runouts)
./sim [number of other players 1-8] [cards on the board 3-5] [top % highlighted] [number of runouts per hand]
e.g.
@LeZuse
LeZuse / psql.sh
Created April 4, 2023 13:43
Quickly start psql REPL with a fresh PostgreSQL instance
# 1. Launch Docker Desktop
# 2. Verify it is running:
docker ps
# 3. Start up a postgres instance and grab the container ID:
container_id=$(docker run -e POSTGRES_PASSWORD=mysecretpassword -d postgres)
# 4. Connect using psql:
docker exec -it "$container_id" psql -h localhost -U postgres
# 5. After doing your business, exit psql and shutdown the instance:
docker stop $container_id
# 6. Cleanup if you won't be using the instance anymore
@LeZuse
LeZuse / howto.md
Last active July 7, 2025 01:18
Disable Docker for Mac auto-update

Docker downloads all updates into a directory in /Users/$USER/Library/Caches/com.docker.docker/org.sparkle-project.Sparkle Let's make this directory inaccessible to the user under which Docker is going to run (you).

Switch to root user:

  sudo su

Change directory ownership and prevent access to other users:

@LeZuse
LeZuse / howto.md
Created March 30, 2021 13:31
Kubernetes context in iTerm status bar
@LeZuse
LeZuse / 00_README.md
Last active October 29, 2025 12:26
Install node on Apple Silicon M1 both ARM and x86 (Rosetta)

Node.js on Apple Silicon

Node Version Manager (https://github.com/nvm-sh/nvm) works perfectly across native node installations as well as emulated Rosetta installations. The trick I am using here is to install one LTS version of node under Rosetta and another stable version as native binary.

TODO

  • find a way how to run the same node version on both platforms
@LeZuse
LeZuse / analytics.bash
Last active November 16, 2020 17:32
Bash history logging into Google Analytics
#!/bin/bash
# Install
# Option 1: Install iTerm Bash integration
# https://www.iterm2.com/documentation-shell-integration.html
# Option 2: bash-preexec
# https://github.com/rcaloras/bash-preexec/blob/master/README.md#install
# Then source this file into your .bash_profile or equivalent:
# source "$HOME/analytics.bash"
@LeZuse
LeZuse / nx-completion.bash
Last active December 12, 2025 14:28
Bash completion for Nx – Extensible Dev Tools for Monorepos
#/usr/bin/env bash
# Bash completion for nx.dev project
# Inspired by https://github.com/jukben/fish-nx/blob/master/completions/nx.fish
# Prerequisites:
# brew install jq fzf
# Installation
# Source this file in your .bash_profile:
@LeZuse
LeZuse / tailscale
Created October 5, 2020 16:13
Tailscale CLI alias
#!/bin/bash
# Installation:
# Move this file into /usr/local/bin and make it executable:
# chmod +x /usr/local/bin/tailscale
# https://tailscale.com/kb/1080/cli#using-the-cli
/Applications/Tailscale.app/Contents/MacOS/Tailscale $@
@LeZuse
LeZuse / gitlab-env-copy.sh
Last active April 22, 2020 19:05
Copy ENV vars from one GitLab project to another
GL_TOKEN=xxxxxxx-xxxxxxx
ID_FROM=00001
ID_DESTINATION=00002
PREFIX=
[ "$1" == "--dry-run" ] && PREFIX=echo
download_page () {
DATA=`curl --header "PRIVATE-TOKEN: $GL_TOKEN" "https://gitlab.com/api/v4/projects/$ID_FROM/variables?per_page=100&page=$c"`