Skip to content

Instantly share code, notes, and snippets.

@laamalif
laamalif / keymap.c
Created September 3, 2025 14:12
QMK Keychron K6 Pro
/* Copyright 2021 @ Keychron (https://www.keychron.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#!/bin/bash
set -e
arch=$(uname -m)
apt update && apt install -y libzstd-dev liblzma-dev libbz2-dev zlib1g-dev libacl1-dev libtinfo-dev libncurses-dev libbsd-dev pkg-config cmake byacc git build-essential clang lld autoconf libtool meson flex wget curl
export CC=clang
export CXX=clang++
export LD=ld.lld
export CXXFLAGS="-std=c++17"
export LDFLAGS="-ltinfo"
@laamalif
laamalif / autoeq.lua
Last active April 8, 2025 15:52
MPV Perfect Auto EQ
local mp = require 'mp'
-- Track which EQ preset is active
local active_preset = nil
local auto_eq_mode = nil -- "bass", "treble", or nil
local volume_adaptive_enabled = false -- toggled by Ctrl+4
-- Helper function to apply an EQ preset
local function apply_eq(name, filters)
if active_preset == name then
@laamalif
laamalif / eq-switcher.lua
Created April 8, 2025 13:35
MPV Perfect EQ Script
local mp = require 'mp'
-- Track which EQ preset is active
local active_preset = nil
-- Helper function to apply an EQ preset
local function apply_eq(name, filters)
if active_preset == name then
mp.commandv("af", "clr")
mp.osd_message("🔄 EQ Reset (Flat)", 3)
@laamalif
laamalif / gs.c
Created January 16, 2025 15:52
List directories using getdents()
/*
* List directories using getdents() because ls, find and Python libraries
* use readdir() which is slower (but uses getdents() underneath.
*
* $ gcc gs.c -o gs
*/
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
@laamalif
laamalif / grm.c
Created January 16, 2025 15:49
rm with getdents
#define _GNU_SOURCE
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <string.h>
#include <limits.h>
@laamalif
laamalif / getdents.c
Created January 16, 2025 13:15
List directories using getdents()
/*
* List directories using getdents() because ls, find and Python libraries
* use readdir() which is slower (but uses getdents() underneath.
*
* Compile with
* ]$ gcc getdents.c -o getdents
*/
#define _GNU_SOURCE
#include <dirent.h> /* Defines DT_* constants */
#include <fcntl.h>
@laamalif
laamalif / getdentsfp.c
Created January 16, 2025 12:14
List directories using getdents()
/*
* List directories using getdents() because ls, find and Python libraries
* use readdir() which is slower (but uses getdents() underneath.
*
* Compile with
* ]$ gcc getdents.c -o getdents
*/
#define _GNU_SOURCE
#include <dirent.h> /* Defines DT_* constants */
#include <fcntl.h>
import logging
import base64
import getpass
import struct
from fido2.hid import CtapHidDevice
from fido2.ctap2 import CredentialManagement, Ctap2, ClientPin
from fido2.ctap2.bio import BioEnrollment
# Configure logging (only log errors and above)
logging.basicConfig(level=logging.ERROR)
@laamalif
laamalif / keymap.c
Last active March 15, 2024 00:38
QMK Keychron K6 Pro
/* Copyright 2021 @ Keychron (https://www.keychron.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the