Skip to content

Instantly share code, notes, and snippets.

View ifdiego's full-sized avatar

Diego Alves ifdiego

View GitHub Profile
@ifdiego
ifdiego / export-commits.sh
Created February 13, 2026 01:17
Exports every commit in a Git repo as a separate snapshots directory.
#!/bin/bash
set -euo pipefail
OUTPUT_DIR="history"
mkdir -p "$OUTPUT_DIR"
count=1
for commit in $(git rev-list --reverse HEAD); do
mkdir "$OUTPUT_DIR/commit_$count"
git archive $commit | tar -x -C "$OUTPUT_DIR/commit_$count"
@ifdiego
ifdiego / archinstall.sh
Created July 13, 2025 14:48
Arch Linux installation script guide.
#!/bin/bash
loadkeys br-abnt2
iwctl
# [iwd] device list
# [iwd] station DEVICENAME scan
# [iwd] station DEVICENAME get-networks
# [iwd] station DEVICENAME connect NETWORKNAME
@ifdiego
ifdiego / beacompiler.ts
Created October 22, 2024 00:30
How to be* a compiler in TS
type Token = { type: "word" | "number", value: string };
type ASTNode = { type: string, body: any[] };
type SVGNode = { tag: string, attr: { [key: string]: string | number }, body: any[] };
class Compiler {
public version: string = "0.0.1";
lexer(code: string): Token[] {
return code.split(/\s+/)
.filter(token => token.length > 0)