Skip to content

Instantly share code, notes, and snippets.

@kaeza
kaeza / init.lua
Last active March 9, 2022 00:50
Minetest `notice` mod.
notice = { }
function notice.send(target, text)
local player = minetest.get_player_by_name(target)
if not player then
return false, ("There's no player named '%s'."):format(target)
end
local fs = { }
--[[
for _, line in ipairs(text:split("|")) do
@kaeza
kaeza / xban-grep.lua
Last active January 7, 2017 05:59
Search entries in databases for XBan2 mod for Minetest (https://github.com/minetest-mods/xban2).
#! /usr/bin/env lua5.1
local l_os, l_io, l_loadfile =
os, io, loadfile
os, io, debug, loadfile, dofile, require = nil
local function load_db(filename)
local ok, r = pcall(l_loadfile, filename)
if not ok then error(r) end
ok, r = pcall(r)
@kaeza
kaeza / mods.txt
Last active January 7, 2017 06:03
Most used mods in Minetest servers.
This is a list of most used mods, sourced from the public data in
the public server list.
Items marked with '*' are mods that are currently part of the
development version of minetest_game, so they may be ignored.
Also note that since there may be several mods sharing a name, the
numbers may be a bit skewed.
@kaeza
kaeza / bitty.lua
Last active November 18, 2021 01:38
Bitty - Implementation of bitwise operators in pure Lua
if false then -- For LuaDoc
---
-- Pure Lua implementation of bitwise operations.
-- Not suitable for time critical code. Intended as fallback
-- for cases where a native implementation is unavailable.
-- Further optimization may be possible.
-- @version 0.1
-- @author kaeza <https://github.com/kaeza>
module "bitty"
---
-- Table serialization with minification.
--
-- This module contains functions to serialize tables to strings, and
-- deserialize these strings back to a table.
--
-- The serialized string is a representation of the table in Lua code.
-- The module does its best to generate the most compact code possible.
--
@kaeza
kaeza / texutil.lua
Last active March 9, 2022 00:43
Minetest - texutil.lua
---
-- Work with textures as if they were objects.
--
-- All methods sanitize its arguments and perform any kind of
-- escaping needed.
--
-- A simple example:
--
-- local tex = texutil.new("foo.png"):colorize("#FF0000", 255)
@kaeza
kaeza / depends.txt
Last active March 9, 2022 00:45
mt-irc grep addon
irc
@kaeza
kaeza / zpackage.lua
Created January 7, 2017 05:54
ZIP module loader for Lua.
---
-- ZIP module loader.
--
-- This is a module that contains a custom module loader that
-- loads modules from ZIP files.
--
-- Currently, only pure Lua modules are supported.
--
-- Intended usage:
#! /usr/bin/env python
# :coding=utf-8:
from __future__ import unicode_literals, print_function
import os
from Tkinter import *
from Tix import *
from tkMessageBox import showerror, showinfo