Skip to content

Instantly share code, notes, and snippets.

View roman-orekhov's full-sized avatar

Roman Orekhov roman-orekhov

View GitHub Profile
@roman-orekhov
roman-orekhov / check-registry.lua
Created April 29, 2024 11:20
Lua script to check if Lua registry is corrupted
function check_registry()
local reg = debug.getregistry()
local s, cur, min, max = #reg + 1, 0
local ids, lst = {}, {n = 0}
while type(reg[cur]) == "number" do
if ids[cur] then return false, (table.concat(lst, "-")..": cycle "..cur) end
ids[cur] = 1
lst.n = lst.n + 1
lst[lst.n] = cur
if lst.n == 1 then
@roman-orekhov
roman-orekhov / softnet.sh
Created February 18, 2022 12:26
softnet_stat pretty printer
#!/bin/bash
# adapted from https://github.com/majek/dump/blob/master/how-to-receive-a-packet/softnet.sh
cmd="${0##*/}"
usage() {
cat >&2 <<EOI
usage: $cmd [ -h ]