Skip to content

Instantly share code, notes, and snippets.

View SwadicalRag's full-sized avatar
👨‍⚕️
working :)

swadical SwadicalRag

👨‍⚕️
working :)
View GitHub Profile
IPFilter = {}
-- CONFIG
IPFilter.KickMessage = "Sorry %s, you have been kicked by the IP filter" -- %s = name
IPFilter.BlacklistedIPs = {
-- Lua patterns
-- "%d.%d%.%d.1",
}
@SwadicalRag
SwadicalRag / aadisasm.lua
Created September 15, 2017 12:59
quick genome disassembler i made for a quiz
local AADisasm = {}
AADisasm.StartCodons = {
"AUG",
}
AADisasm.TerminationCodons = {
UAA = true,
UAG = true,
UGA = true,
First and foremost, follow the :sparkles: ***golden rule*** :sparkles:
`"Do not do to others what you know has hurt yourself"`
-----
We're trying to maintain an inclusive environment in this discord. Please don't be an asshole.
-----
:cop: **Administration**
-----
We'll try to be as open with you as possible. We're here to help.
If you need any help, please don't hesitate to contact a @Moderator
@SwadicalRag
SwadicalRag / there-is-no-spoon-1.lua
Created January 2, 2018 21:01
CodinGame: There is no Spoon - Episode 1
-- Don't let the machines win. You are humanity's last hope...
local function debug(fmt,...)
io.stderr:write(string.format(fmt,...))
end
local function outputCoords(x1,y1,x2,y2,x3,y3)
io.write(string.format("%d %d %d %d %d %d\n",x1,y1,x2,y2,x3,y3))
end
local phonemes = {
["AA"] = "ɑ",
["AE"] = "æ",
["AH"] = "ʌ",
["AO"] = "ɔ",
["AW"] = "ɑʊ",
["AY"] = "ɑɪ",
["B"] = "b",
["CH"] = "ʧ",
["D"] = "d",
@SwadicalRag
SwadicalRag / NTMLL.md
Last active February 21, 2021 21:06
Machine Readable National Tall Man Lettering List (ASCQHC, Dec 2020)
@SwadicalRag
SwadicalRag / insulin.lua
Last active June 21, 2021 07:14
SALHN Basal Bolus Insulin Protocol
-- for use by doctors only, always clinically correlate
-- don't use this for yourself
-- you shouldn't trust strangers on the internet with your blood sugars
print("insulin calculator 3000")
local function roundEven(n,noZero)
local frac = n % 1
local base = math.floor(n)
@SwadicalRag
SwadicalRag / panasonic_trc_vm1_decoder.lua
Last active December 30, 2021 09:21
Panasonic Voice Recorder Triple Rate Codec Decoder (for VM1 files) - uses LuaJIT FFI to call native code
-- saved at 12000Hz, 16 bit PCM, little endian
local vcName = "SD_VC001"
local folder = "SD_VOICE/"..vcName
ffi=require'ffi'
ffi.cdef [[
void vInitDecoder(void);
void vDecode(uint8_t* param_1,uint8_t *param_2);
@SwadicalRag
SwadicalRag / fuzzy.lua
Created December 24, 2022 05:41
Fuzzy substring match in lua
function fuzzySubstringMatch(str,match,maxDiscrepancies)
local minIdx
local minDiscrepancies = 1 / 0
for idx=1,#str do
local curIdx = idx
local discrepancies = 0
local matchIdx = 1
while matchIdx <= #match do
local srcChar,srcCharNext = str:byte(curIdx + matchIdx - 1,curIdx + matchIdx)
local matchChar,matchCharNext = match:byte(matchIdx,matchIdx + 1)
@SwadicalRag
SwadicalRag / twowayweakmap.js
Last active June 3, 2023 12:01
Two way weak map in TypeScript
class TwoWayWeakMap {
constructor() {
this.keyToValue = new WeakMap();
this.valueToKey = new WeakMap();
this.keys = new Set();
this.values = new Set();
}
set(key, value) {
const weakValue = new WeakRef(value);