Skip to content

Instantly share code, notes, and snippets.

View SmallJoker's full-sized avatar

SmallJoker

View GitHub Profile
Values below show absolute/relative times spend per server step by the instrumented function.
A total of 8885 samples were taken
instrumentation | min µs | max µs | avg µs | min % | max % | avg %
-------------------------------------------------------- | --------- | --------- | --------- | ----- | ----- | ------
mesecons: | 1 | 161770 | 86 | 0.0 | 99.1 | 3.3
- globalstep[1] ..................................... | 1 | 161768 | 84 | 0.0 | 99.0 | 2.5
- on_placenode[1] ................................... | 17 | 25 | 21 | 2.5 | 6.3 | 4.8
- on_dignode[1] ..................................... | 13 | 49 | 21 | 0.6 | 10.3 | 6.2
@SmallJoker
SmallJoker / network_sqrt_log2.cpp
Last active July 25, 2018 18:39
Test script to measure different methods of eoncoding and decoding floats over the network
#include <cmath>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <chrono>
#include <cassert>
typedef uint8_t u8;
typedef int8_t s8;
@SmallJoker
SmallJoker / MT-replace-deprecated.sh
Last active March 9, 2022 00:54
Minetest - Replace deprecated function calls
#!/bin/bash
# License: CC0
# How to use:
# 1) Open the terminal in the target mod directory
# 2) Call the script
files=$(find . -name "*.lua")
ref_call()
@SmallJoker
SmallJoker / Data_RW.cs
Last active October 3, 2015 13:48
Code to serialize and deserialize a world
/*
Code to serialize and deserialize a world
Copyright (C) 2015 Krock/SmallJoker <mk939@ymail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
@SmallJoker
SmallJoker / itemdrop_whatever_again.lua
Created May 19, 2014 18:11
An other item drop thingie
-- collect items (based on PilzAdam's item_drop mod)
local ttime = 0
minetest.register_globalstep(function(dtime)
ttime = ttime + dtime
if ttime < 1 then return end
ttime = 0
for _,player in ipairs(minetest.get_connected_players()) do
if player:get_hp() > 0 and not player:get_player_control().LMB then