Skip to content

Instantly share code, notes, and snippets.

A metatable in Lua defines various extraneous behaviors for a table when indexed, modified, interacted with, etc. They are Lua's core metaprogramming feature; most well known for being useful to emulate classes much like an OOP language.

Any table (and userdata) may be assigned a metatable. You can define a metatable for a table as such:

-- Our sample table
local tab = {}
-- Our metatable
local metatable = {
 -- This table is then what holds the metamethods or metafields
@braindevices
braindevices / #btrfs benchmark for daily used desktop OS
Last active March 24, 2026 20:39
which file sytem to use for daily work? should we turn on btrfs compression?
#btrfs benchmark for daily used desktop OS
@brayevalerien
brayevalerien / monokai.md
Last active January 16, 2026 21:59
Monokai theme color codes

Monokai theme color codes

Intro

This document lists the colors used in the Monokai Pro theme with the Classic filter. Please check the Monokai Pro website for more informations.

Colors

Monokai Pro with Classic filter colors:

Preview Hexadecimal RGB
Activity Bar Background activity bar background preview #272822 (39, 40, 34)
Activity Bar Foreground activity bar foreground preview #f8f8f2 (248, 248, 242)
@mkpolkowski
mkpolkowski / CountYoutubeVideosTime.js
Last active February 12, 2025 18:00 — forked from RafalJDev/CountYoutubeVideosTime.js
Count all videos time duration on youtube channel
//You need to run this in javascript console inside chrome
//Assumptions:
//1. Will count only "expanded" videos on page, you may first need to run script to scroll to last video or do it manually
//2. Tested on chrome, ubuntu, 2019
//3. Time format: hh:mm:ss
// Assuming you have your domlists as an array-like object
const domlists = document.querySelectorAll("ytd-rich-item-renderer");
@GingerGraham
GingerGraham / bash_logging.md
Last active February 14, 2026 11:59
Bash Logging

Bash Logging Module

A flexible, reusable logging module for Bash scripts that provides standardized logging functionality with various configuration options.

Important

This version of the bash logging module is now deprecated and the gist is no longer maintained. Please see the full release bash-logger

Note

This deprecated version has been left for reference purposes only.

From 52d57cf70ca70f55378112f6eeb5708fb7680a6b Mon Sep 17 00:00:00 2001
From: stephematician <steph.fn.contact@proton.me>
Date: Wed, 19 Mar 2025 13:59:21 +1100
Subject: [PATCH] linux-v4l2: Fix virtual camera start failure
Add function that tries to reset v4l2loopback output for module versions
from 0.12.5 to 0.12.7. If successful, then set flag that STREAMON and
STREAMOFF are necessary each time the device is opened/closed.
---
plugins/linux-v4l2/v4l2-output.c | 57 ++++++++++++++++++++++++++++++--
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef uint8_t u8;