Skip to content

Instantly share code, notes, and snippets.

View Niklp09's full-sized avatar

Niklp Niklp09

  • Hesse, Germany
  • 14:28 (UTC +01:00)
View GitHub Profile
@Niklp09
Niklp09 / cdbgithosters.py
Created October 15, 2023 14:03
Script to count the git hosts used on ContentDB; tested w/ python 3.11
# Script to count the git hosts used on ContentDB; tested w/ python 3.11
import requests, json, re, time, operator
hosts = {}
pkgnum = 0
def val(key):
if key in hosts.keys():
return hosts[key]
else:
@Niklp09
Niklp09 / fs.lua
Created July 4, 2023 19:13
formspec_escape + translation
local FS = function(...) return minetest.formspec_escape(S(...)) end
@Niklp09
Niklp09 / fetch_twemoji.sh
Created May 27, 2023 13:14
fetch twemoji ttf file
pkgver=14.0.2
_fedrel=3.fc38
wget https://kojipkgs.fedoraproject.org/packages/twitter-twemoji-fonts/${pkgver}/${_fedrel}/noarch/twitter-twemoji-fonts-${pkgver}-${_fedrel}.noarch.rpm
find . -type f -iname "*.png" -exec optipng -o7 -zm1-9 -nc -strip all -clobber {} \;
-- Based on https://gitea.your-land.de/your-land/bugtracker/issues/3723 (Thanks to Alias/Bastrabun)
-- detect slow find_nodes_in_area calls
local old_find_nodes_in_area = core.find_nodes_in_area
local most_called = {}
core.find_nodes_in_area = function(pos1, pos2, nodenames, grouped)
local from = debug.getinfo(2, "nS")
local t0 = core.get_us_time()
local ret, ret2 = old_find_nodes_in_area(pos1, pos2, nodenames, grouped)
local t1 = core.get_us_time()
local spos = core.pos_to_string(vector.round(pos1)) or ""
-- Run this script via qa_block (or similar); This checks if on_rightclick crashes without a valid ItemStack
local player = minetest.get_player_by_name("Niklp") -- change this to your name
local pos = vector.new(0,0,0)
local count = 0
for _, node in pairs(minetest.registered_nodes) do
if not node.name then
minetest.log("warning", dump(node))
end
minetest.set_node(pos, {name = node.name})