Skip to content

Instantly share code, notes, and snippets.

View ldm0's full-sized avatar
🌴
On vacation

Donough Liu ldm0

🌴
On vacation
View GitHub Profile
@huonw
huonw / blackmagic.rs
Created January 15, 2014 12:42
do-while loops in Rust
while {
let x = foo();
bar(x);
x != 0
} {}
@karpathy
karpathy / min-char-rnn.py
Last active July 22, 2024 04:44
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@kubadlo
kubadlo / smoothstep.swift
Last active August 31, 2019 11:49
SmoothStep implementation in Apple Swift
// SmoothStep implementation in Apple Swift
// Based on Wikipedia page https://en.wikipedia.org/wiki/Smoothstep
import Foundation
// Returns the input value clamped to the lower and higher limits
func clamp<T: Comparable>(value: T, low: T, high: T) -> T {
return min(max(value, low), high)
}
@superboum
superboum / benchmark-base.md
Last active July 24, 2024 02:05
Benchmark your disk with FIO

Install FIO on Ubuntu/Debian:

sudo apt update
sudo apt install -y fio lshw

Install FIO on Fedora: