Skip to content

Instantly share code, notes, and snippets.

View navahas's full-sized avatar

navahas

  • Spain
View GitHub Profile
@navahas
navahas / ANSI.md
Created March 15, 2026 17:16 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@navahas
navahas / microgpt.py
Created February 12, 2026 17:23 — 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
@navahas
navahas / conventional-commits-cheatsheet.md
Created August 23, 2025 10:00 — forked from qoomon/conventional-commits-cheatsheet.md
Conventional Commits Cheatsheet
@navahas
navahas / bench.rs
Last active August 7, 2025 14:43
Benchmark: Indexing vs Iterator in Rust
use std::hint::black_box;
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
// Indexing approaches
pub fn sum_indexing(v: &[u64]) -> u64 {
let mut sum = 0;
for i in 0..v.len() {
sum += v[i];
}
sum
@navahas
navahas / gist:894891cccf5b8833769b13eebb5f11a0
Created March 30, 2024 22:16
Keypair ECDSA EVM compatible
const crypto = require('crypto');
// Generar la clave privada
const { privateKey } = crypto.generateKeyPairSync('ec', {
namedCurve: 'secp256k1'
});
// Exportar la clave privada como un Buffer en formato PKCS8
const privateKeyBuffer = privateKey.export({
type: 'sec1',