Skip to content

Instantly share code, notes, and snippets.

@Mozles
Mozles / fan.sh
Created April 29, 2026 18:01
fan speed changer for https://github.com/tangalbert919/gigabyte-laptop-wmi. you can bind shortcut to this script and call it from kde for example
#!/bin/bash
fan_speed_path="/sys/bus/platform/devices/aorus_laptop/fan_custom_speed"
fan_mode_path="/sys/bus/platform/devices/aorus_laptop/fan_mode"
current_speed=$(cat $fan_speed_path)
if [[ $1 == "perms" ]]; then
chmod o+w $fan_mode_path
chmod o+w $fan_speed_path
fi
@Mozles
Mozles / simple_list_array.c
Created December 20, 2025 19:01
imagine not having generic types in c
#define List(type) struct List_##type {\
type *data;\
size_t cap;\
size_t size;\
}
// inspired by Tsoding
#define da_append(arr, obj) do {\
if ((arr).cap == 0) {\
(arr).cap = 256;\
@Mozles
Mozles / funny list.c
Created April 3, 2025 16:18
funny list implementation
#include <stdio.h>
#define List(type) struct { \
int len; \
int cap; \
typeof(type) contents; \
}
// struct List;