Skip to content

Instantly share code, notes, and snippets.

@evaporei
evaporei / main.odin
Last active May 16, 2025 18:42
smol odin executable
// 3.5KiB
package hellope
foreign import "system:Kernel32.lib"
foreign Kernel32 {
OutputDebugStringA :: proc "stdcall" (cstring) ---
}
main :: proc() {
@evaporei
evaporei / main.c
Created April 26, 2025 00:40
List all entries of dir using win32
#include <windows.h>
#include <stdio.h>
int main() {
WIN32_FIND_DATA findFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
LPCSTR directoryPath = "C:\\Users\\myusername\\Downloads\\*";
hFind = FindFirstFile(directoryPath, &findFileData);
@evaporei
evaporei / main.c
Last active April 24, 2025 21:16
scandir example
#include <dirent.h>
#include <stdlib.h>
#include <stdio.h>
int main(void) {
struct dirent **namelist;
int n = scandir(".", &namelist, NULL, alphasort);
if (n < 0) {
perror("scandir");
} else {
@evaporei
evaporei / small_array.rs
Last active April 12, 2025 00:07
Odin's Small_Array in Rust
pub struct SmallArray<const N: usize, T> {
data: [T; N],
count: usize,
}
impl<const N: usize, T> Default for SmallArray<N, T> {
fn default() -> Self {
Self {
data: std::array::from_fn(|_| unsafe { std::mem::zeroed() }),
count: 0,
@evaporei
evaporei / rust_good_bad_ugly.md
Created March 20, 2025 18:51
Rust: The Good. The Bad. And The Ugly

Rust: The Good. The Bad. And The Ugly

I have been programming Rust for 6 years now (since 2018 edition). I have also done professional work with it for 4 companies at this point: one for “embedded” (payment terminal protocol), blockchain, web backend services and also video/audio streaming (WebRTC).

I reached a point where the honey moon phase is over, and I have a more holistic view on this programming language.

The Good

Let’s start with the good stuff. Rust has great learning material and it has a rich ecosystem of libraries at this point, covering the most common developer use cases. It is usually a great experience to build and run Rust projects. You can clone a repository, and cargo will do everything for you. 97% of the time you don’t have to deal with linking issues,Makefile s etc, that usually happen in the C/C++ world.

@evaporei
evaporei / dump_tables.lua
Created July 26, 2024 17:43
dump tables love2d
local Game = require('game')
local game = Game.new()
local function count_all(f)
local seen = {}
local count_table
count_table = function(t)
if seen[t] then return end
f(t)
@evaporei
evaporei / rabbit.py
Created July 4, 2024 17:54
Fox/Rabbit in a hole problem
from random import randint
holes = 100
# rabbit jump (pulo do gato)
def step(prev_pos: int) -> int:
if prev_pos == 0:
return prev_pos + 1
elif prev_pos == (holes - 1):
return prev_pos - 1
@evaporei
evaporei / bst_traversals.py
Created June 24, 2024 18:34
bst traversals
from collections import deque
class TreeNode[T]:
val: 'T'
left: 'TreeNode | None'
right: 'TreeNode | None'
def __init__(self, val: T, left=None, right=None):
self.val = val
self.left = left
self.right = right
@evaporei
evaporei / config
Created April 13, 2024 21:19
ghostty config copying kitty
# good defaults coming from Kitty + MacOS
theme = "Pro"
# https://sw.kovidgoyal.net/kitty/conf/#the-color-table
# https://l0go.github.io/ghostty-base16-converter/
font-family = "monospace"
font-size = 22
font-thicken = true
@evaporei
evaporei / tutorial.md
Created September 24, 2023 17:41
ssh mac (host) into linux (remote) in the same network (eg: wifi)

Linux

  1. Get your local IP address
$ ip route
default via IP1 dev wlan0 proto dhcp src IP2 metric 600 
IP3/24 dev wlan0 proto kernel scope link src IP2 metric 600