Skip to content

Instantly share code, notes, and snippets.

Avatar

rubenwardy rubenwardy

View GitHub Profile
View LuaSecurity.cpp
#include <fstream>
#include <scripting/ModException.hpp>
#include <sanity.hpp>
#include "LuaSecurity.hpp"
using namespace scripting;
namespace {
void copyAll(sol::environment &env, const sol::global_table &globals,
View discord_bt.txt
(gdb) thread apply all bt
Thread 34 (Thread 0x7fffe3fe7700 (LWP 4588)):
#0 0x00007ffff781ccf5 in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0
#1 0x0000555558b06b0b in ()
#2 0x0000555558ad9100 in ()
#3 0x0000555558d50400 in ()
#4 0x00000327f38604a2 in ()
#5 0x000024d200000101 in ()
#6 0x7fffffffffffffff in ()
View DropShadow.cpp
#include "DropShadow.hpp"
#include <cassert>
#include <cmath>
#include <memory>
using namespace sfext;
namespace {
std::unique_ptr<sf::Shader> shadowShader;
View keybase.md

Keybase proof

I hereby claim:

  • I am rubenwardy on github.
  • I am rubenwardy (https://keybase.io/rubenwardy) on keybase.
  • I have a public key ASBExTr0_r9rJ7-9Tt46Dt6-SzPEiwihDVWqfz-wI3Gp0wo

To claim this, I am signing this object:

@rubenwardy
rubenwardy / sol_JSON.cpp
Last active Mar 2, 2020
Sol3 Read/parse JSON from file or string
View sol_JSON.cpp
#include <json/json.h>
#include <fstream>
#include <sstream>
namespace {
sol::object json_to_lua(Json::Value value, sol::this_state state) {
switch (value.type()) {
case Json::nullValue:
return sol::nil;
View pipeline.lua
-- Run a series of functions as a pipeline - each returning the next's arguments.
--
-- The first function will be ran immediately
--
-- @param interval Time between pipelines
-- @param funcs A list of functions, each one of the form function(...)
-- where ... is returned by the previous function.
-- @param params Optional, a list of arguments to pass to the first function
local function pipeline(interval, funcs, params)
if funcs[1] ~= nil then
@rubenwardy
rubenwardy / runserver.sh
Last active May 21, 2018
Auto-restart, log per season, email on crash
View runserver.sh
#!/bin/bash
cd ~/.minetest
mkdir -p logs_ctf
function mailme() {
echo "To: rw@rubenwardy.com" > mail.txt
echo "Subject: CTF server crashed" >> mail.txt
echo "From: minetest@rubenwardy.com" >> mail.txt
echo "" >> mail.txt
View lua_console.lua
-- First check to see if it can be evaluated as an expression,
-- then fallback to executing it raw
local func, error = loadstring("return (" .. param .. ")")
if not func then
func, error = loadstring(param)
if not func then
return false, "E " .. error
end
end
View init.lua
function wrapRegisterCall(name, func)
for key, v in pairs(minetest["registered_" .. name .. "s"]) do
func(key, v)
end
local old = minetest["register_" .. name]
minetest["register_" .. name] = function(name, def)
func(name, def)
old(name, def)
end
You can’t perform that action at this time.