This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- JSON parser originally from qjson.lua | |
local function decode(json --[[@param json string]]) ---@return table | |
local ptr = 0 | |
local function consume(pattern --[[@param pattern string]]) ---@return string? | |
local start = json:find("^%S", ptr) | |
if start then ptr = start end | |
local start, finish, match = json:find(pattern, ptr) | |
if start then | |
ptr = finish + 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rgx = /virtual\s+(\w+)\s*\*?\s+\*?(\w+)\(([^)]+)\)/g; | |
const foo = document.getElementById("area"); | |
const textarea = document.getElementById("code"); | |
const btn = document.getElementById("btn"); | |
btn.onclick = function() { | |
const code = textarea.value; | |
let submissions = code.matchAll(rgx); | |
const outputs = []; | |
let ind = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
args=args or{...}local a;local setmetatable=setmetatable;local assert=assert;local error=error;local bit=bit;local math=math;local b=bit.tobit;local c=bit.arshift;local d=bit.rshift;local e=bit.lshift;local f=bit.band;local g=bit.bor;local h=bit.bxor;local i=bit.ror;local j=bit.rol;local k=math.huge;local l=math.floor;local m=math.ceil;local n=math.abs;local o=math.max;local p=math.min;local q=math.pow;local r=math.sqrt;local s=math.ldexp;local t=math.frexp;local u=math.log;if jit and jit.version_num<20100 then function t(v)local w=n(v)if v~=0 and w~=k then local x=o(-1023,l(u(w,2)+1))local y=w*q(2,-x)if v<0 then y=-y end;return y,x end;return v,0 end end;local function z(A)if A>=0 then return l(A)end;return m(A)end;local function B(C,D)return (setmetatable({C,D},a))end;local function E(A)local D=b(l(A/2^32))local C=b(A%2^32)return (setmetatable({C,D},a))end;_G.__LONG_INT__=B;_G.__LONG_INT_N__=E;local F={}local G={}local H=setmetatable({},{__mode="k"})local I={}local J={}local K={}local L={arrays={},ptrArrays |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@name Streamcore Replacement with WebAudio Backend | |
@persist WSTRCORE_TBL:table | |
function streamHelp() {} | |
function number streamCanStart() { return webAudioCanCreate() } | |
function entity:streamStart(Index, Url:string) { | |
local Wa = webAudio(Url) | |
Wa:setParent(This) | |
Wa:play() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Burst Limit for Garrysmod/Wiremod | |
local Burst = setmetatable({}, { | |
__call = function(self, max, regen_time) | |
return setmetatable({ | |
max = max, -- Will start full. | |
regen = regen_time, | |
tracker = WireLib.RegisterPlayerTable() | |
}, self) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function error_fmt(level, msg, ...) | |
error( string.format(msg, ...), level + 1 ) | |
end | |
local function checkargtype(val, argnum, func_name, ...) | |
local expected_msg = {} | |
local t = type(val) | |
local count = select('#', ...) | |
for i = 1, count do | |
local expected = select(i, ...) or "nil" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local MaxConcurrent = 512 -- Max concurrent active streams | |
local TopID = 0 -- Current top-most id. | |
local IsSequential = true -- Boost for initial creation when no IDs have been dropped. | |
local OccupiedCount = 0 | |
local Occupied = {} | |
local function register(id) | |
Occupied[id] = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local MaxConcurrent = 512 -- Max concurrent active objects | |
local TopID = 0 -- Current top-most id. | |
local OccupiedCount = 0 | |
local Occupied = {} | |
local function allocID(n) | |
if OccupiedCount >= MaxConcurrent then return end | |
local new = (n or TopID) % MaxConcurrent + 1 | |
if Occupied[new] then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function addModule(name, exec) | |
if not SF.Modules then error("SF Modules table doesn't exist!") end | |
SF.Modules[name] = { | |
["injected"] = {init = exec()} | |
} | |
end | |
local function reloadSFEditor() | |
pcall(function() | |
if SF.Editor.initialized then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Requires winapi-rs. | |
// Accidentally made this instead of a getOpenPrograms function so just putting it as a gist so it doesn't go to waste. | |
use winapi::{ | |
um::winuser::{EnumWindows, GetWindowTextW} | |
}; | |
static mut windows: Vec<String> = Vec::new(); // Use a static because local variables aren't sent to non-closure functions. | |
unsafe fn getOpenWindows() -> bool { |
NewerOlder