Skip to content

Instantly share code, notes, and snippets.

View ColonelThirtyTwo's full-sized avatar

Alex Parrill ColonelThirtyTwo

View GitHub Profile
@ColonelThirtyTwo
ColonelThirtyTwo / oop.lua
Created November 10, 2013 17:55
Simple OOP library for Lua
--[[
Basic OOP library for Lua
Supports classes with single inheritance. Example usage:
local oop = require "oop"
-- Create the class and gets a superclass variable.
-- oop.Class() can take a superclass as an argument.
@ColonelThirtyTwo
ColonelThirtyTwo / example_tokenizer.rs
Last active September 24, 2023 22:08
Rusqlite FTS5 tokenizer module
use any_ascii::any_ascii_char;
use unicode_normalization::UnicodeNormalization;
use unicode_segmentation::UnicodeSegmentation;
use crate::sqlite3_fts5::Tokenizer;
/// My own tokenizer
///
/// The operations the tokenizer performs, in order:
/// 1. Splits data on Unicode-defined words (`UnicodeSegmentation::unicode_word_indices`).
@ColonelThirtyTwo
ColonelThirtyTwo / FakeMatrixStack.lua
Created August 11, 2012 00:03
GMod Real Matrix Stack (if VMatrix:Copy() is implemented)
local FakeMatrixStack = {}
FakeMatrixStack.m = Matrix()
function FakeMatrixStack:push()
local m = self.m
cam.PushModelMatrix(m)
self[#self+1] = m:Copy()
end
@ColonelThirtyTwo
ColonelThirtyTwo / quaternions.lua
Created February 4, 2012 05:11
Quaternions for GLua
-- faster access to some math library functions
local abs = math.abs
local Round = math.Round
local sqrt = math.sqrt
local exp = math.exp
local log = math.log
local sin = math.sin
local cos = math.cos
local sinh = math.sinh
local cosh = math.cosh
@ColonelThirtyTwo
ColonelThirtyTwo / clipper.c
Last active January 2, 2016 00:59
Updated C/LuaJIT bindings for Clipper
#include "clipper.cpp"
using namespace ClipperLib;
#ifdef __MINGW32__
#define export extern "C" __declspec (dllexport)
#else
#define export extern "C"
#endif
local tinsert = table.insert
local tsort = table.sort
--- Recursively dumps a table's contents (sorted by the keys) to a file.
local function dumpTable(tbl, fname)
local out = assert(io.open(fname, "w"))
local visited = {}
local function sortKey(a,b)
local at, bt = type(a), type(b)
@ColonelThirtyTwo
ColonelThirtyTwo / boostShoes.lua
Created October 25, 2013 00:46
"Boost Shoes" Item for Cobalt
hook.add("gameInit", function()
localize.set(localize.language, "item_boostShoes", "Boost Shoes")
ITEMS.boostShoes = {
rechargeTime = 3,
jumpPower = 30,
jetTime = 0.3,
ai = {},
#!/usr/bin/env python3
import json
import subprocess
import os
import cgi
import cgitb
from time import asctime as curtime
cgitb.enable(display=0, logdir="/var/log/cgitb", format="text")
@ColonelThirtyTwo
ColonelThirtyTwo / e2ffi.lua
Created September 1, 2013 22:26
Library for calling E2 functions from Starfall. Hasn't been tested in awhile, and since it requires mocking the E2 entity, may not work with all functions.
-------------------------------------------------------------------------------
-- Expression 2 Foreign Functions Interface Library
-------------------------------------------------------------------------------
local functions_cache = setmetatable({},{__mode="v"})
local function identity(v) return v end
local lua2e2_converters = {
["number"] = identity,
class MyTest
{
public:
int a,b,c;
void test()
{
}
};