Skip to content

Instantly share code, notes, and snippets.

View SmallJoker's full-sized avatar

SmallJoker

View GitHub Profile
@SmallJoker
SmallJoker / github_cleanup_notification_window.txt
Last active October 4, 2024 15:41
Clean up the new clutter in the notifications
Filter Rules
==============
Works for:
- AdblockPlus
- ublock origin
- ??
Group by: Repository
cd irrlicht
# Fake installation dir
mkdir -p __output/include
mkdir -p __output/lib/cmake/IrrlichtMt
ln -sf ../../include __output/include/irrlichtmt
cp -f IrrlichtMt*.cmake __output/lib/cmake/IrrlichtMt/
cp -fP lib/Linux/libIrrlichtMt* __output/lib/
cp -fr CMakeFiles/Export/lib/cmake __output/lib/
local ft = {}
ft.__index = ft
function FSTile(w, h)
local self = {}
setmetatable(self, ft)
-- init stuff here
self.containers = {}
self.width = w
self.height = h
@SmallJoker
SmallJoker / v3s16_optimization.cpp
Last active October 1, 2022 07:00
v3s16_optimization.cpp
#include <iostream>
#include <stdint.h>
#include <vector>
#include "vector3d.h"
using u8 = unsigned char;
using s16 = int16_t;
using u16 = uint16_t;
using v3s16 = irr::core::vector3d<s16>;
@SmallJoker
SmallJoker / ptrlock_macro.cpp
Last active December 29, 2023 18:52
C++ RAII mutex locking, bound to userdata
// Auto-unlock wrapper for larger operations
/*
Exmaple usage:
struct MyStruct {
PtrLock<decltype(m_value)> getValues()
{
return PtrLock<decltype(m_value)>(m_lock, &m_value);
}
@SmallJoker
SmallJoker / autonullptr.cpp
Created October 7, 2024 18:37
Re-inventing std::weak_ptr
#include <set>
#include <stdexcept> // std::runtime_error
#include <stdio.h>
#define DO_ERROR() do { throw std::runtime_error("fault"); } while(0)
class PtrAutoNullOMatic {
public:
PtrAutoNullOMatic() = default;
~PtrAutoNullOMatic()
@SmallJoker
SmallJoker / xdg-grep.sh
Created December 30, 2024 19:14
grep + xdg-open to open files based on text contents from your terminal
#!/usr/bin/env bash
# "xdg-grep" script for $HOME/.local/bin/
set -e
if [ -z "$1" ]; then
echo "Missing keyword"
exit 0
fi
@SmallJoker
SmallJoker / Luanti_lua_api_to_CudaText_ACP.lua
Created April 20, 2025 11:52
Luanti: Convert lua_api.md to the CudaText format for autocompletion
-- Copyright (C) SmallJoker 2022 - 2025
-- License: MIT
-- This script imports the lua_api.md file from Luanti/Minetest to CudaText for
-- auto-completion. Tested with LuaJIT and a Luanti 5.12.0-dev file.
-- Usage:
-- 1. $ luajit THIS_SCRIPT.lua /path/to/lua_api.md
-- 2. Append the generated file to $HOME/.config/cudatext/data/autocomplete/Lua.acp
-- 3. Restart CudaText