Skip to content

Instantly share code, notes, and snippets.

@DannyArends
DannyArends / microGPT.d
Created February 21, 2026 10:51
Andrej Karpathy's microgpt.py translated into the D programming language
/*
The most atomic way to train and run inference for a GPT in pure, dependency-free D.
This file is the complete algorithm,
Everything else is just efficiency.
@karpathy
Translation by @DannyArends
*/
import std.algorithm : countUntil, fold, joiner, map, maxElement, min, sort, sum, uniq;
"""
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
@Wasserwecken
Wasserwecken / SimpleLangChainFileLogger.py
Created May 5, 2025 14:02
Simple LangChain File Logger
from langchain_openai import ChatOpenAI
from langchain_core.messages import HumanMessage, SystemMessage, BaseMessage
from langchain_core.outputs import LLMResult
from langchain_core.callbacks import BaseCallbackHandler
from typing import Any, Dict
from pathlib import Path
from datetime import datetime
class LoggingHandler(BaseCallbackHandler):
@chhh
chhh / ArchLinuxWSL2.md
Created April 29, 2021 06:59 — forked from ld100/ArchLinuxWSL2.md
Steps for setting up Arch Linux on WSL2

Migrating from Ubuntu on WSL to ArchLinux on WSL2

Upgrading to WSL 2

  • Download WSL2 Kernel
  • run wsl --set-default-version 2 in windows command line, so that all future WSL machine will use WSL2.

Installing Arch Linux

@raysan5
raysan5 / custom_game_engines_small_study.md
Last active February 10, 2026 23:44
A small state-of-the-art study on custom engines

CUSTOM GAME ENGINES: A Small Study

a_plague_tale

WARNING: Article moved to separate repo to allow users contributions: https://github.com/raysan5/custom_game_engines

A couple of weeks ago I played (and finished) A Plague Tale, a game by Asobo Studio. I was really captivated by the game, not only by the beautiful graphics but also by the story and the locations in the game. I decided to investigate a bit about the game tech and I was surprised to see it was developed with a custom engine by a relatively small studio. I know there are some companies using custom engines but it's very difficult to find a detailed market study with that kind of information curated and updated. So this article.

Nowadays lots of companies choose engines like [Unreal](https:

@liorshk
liorshk / mlflow_gridsearch.py
Created April 22, 2020 15:24
Create MLFlow runs with Sklearn Gridsearch object
def log_run(gridsearch: sklearn.GridSearchCV, experiment_name: str, model_name: str, run_index: int, conda_env, tags={}):
"""Logging of cross validation results to mlflow tracking server
Args:
experiment_name (str): experiment name
model_name (str): Name of the model
run_index (int): Index of the run (in Gridsearch)
conda_env (str): A dictionary that describes the conda environment (MLFlow Format)
tags (dict): Dictionary of extra data and tags (usually features)
@jzakiya
jzakiya / twinprimes_ssoz.cr
Last active March 4, 2026 20:09
Twinprimes generator, multi-threaded, using SSoZ (Segmented Sieve of Zakiya), written in Crystal
# This Crystal source file is a multiple threaded implementation to perform an
# extremely fast Segmented Sieve of Zakiya (SSoZ) to find Twin Primes <= N
# for the 64-bit range 0..18,446,744,073,709,551,615 (2**64 - 1)
# Compile as: $ crystal build --release -Dpreview_mt --mcpu native twinprimes_ssoz.cr
# To reduce binary size do: $ strip twinprimes_ssoz
# Thread workers default to 4, set to system max for optimum performance.
# Single val: $ CRYSTAL_WORKERS=8 ./twinprimes_ssoz val1
# Range vals: $ CRYSTAL_WORKERS=8 ./twinprimes_ssoz val1 val2
# val1 and val2 can be entered as either: 123456789 or 123_456_789
@cashiwamochi
cashiwamochi / simple_triangulation.cc
Last active September 16, 2023 14:19
This code is used for simple triangulation. It uses findEssentialMat, recoverPose, triangulatePoints in OpenCV. For viewer, PCL is used. You can watch 3D points and 2 camera poses. I checked alcatraz2.jpg and alcatraz1.jpg in pcv_data.zip (https://www.oreilly.co.jp/pub/9784873116075/). Perhaps there is something wrong ( actually it looks working…
#include <opencv2/opencv.hpp>
#include <pcl/common/common_headers.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <Eigen/Core>
#include <Eigen/LU>
@bishboria
bishboria / springer-free-maths-books.md
Last active February 27, 2026 02:50
Springer made a bunch of books available for free, these were the direct links
@RichardBronosky
RichardBronosky / pep8_cheatsheet.py
Created December 27, 2015 06:25
PEP-8 cheatsheet
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""This module's docstring summary line.
This is a multi-line docstring. Paragraphs are separated with blank lines.
Lines conform to 79-column limit.
Module and packages names should be short, lower_case_with_underscores.
Notice that this in not PEP8-cheatsheet.py