Skip to content

Instantly share code, notes, and snippets.

View MCJack123's full-sized avatar
๐Ÿ’š
Go Green!

JackMacWindows MCJack123

๐Ÿ’š
Go Green!
View GitHub Profile
@MCJack123
MCJack123 / mpi.lua
Created March 11, 2025 01:15
Multi-precision integer library for Lua 5.2/5.3+, with functions for RSA encryption
---@class MultiPrecisionInteger
---@field sign boolean|nil
local mpi = {}
mpi.__mt = {__index = mpi, __name = "MultiPrecisionInteger"}
local floor = math.floor
mpi.zero = setmetatable({0}, mpi.__mt)
mpi.one = setmetatable({1}, mpi.__mt)
@MCJack123
MCJack123 / create-scheduler.lua
Last active October 24, 2024 22:20
DSL for Create train schedules
--[[
Train schedule DSL by JackMacWindows
Example:
cyclic
to "Station 1" {
wait 5m, powered
time = 14:00 daily
}
@MCJack123
MCJack123 / vericode2.lua
Last active March 17, 2025 10:13
VeriCode 2 - Easy code signing for ComputerCraft
--- VeriCode 2 - Easy code signing for ComputerCraft
-- By JackMacWindows
--
---@module vericode
--
-- Code signing uses encryption and hashes to easily verify a) that the sender of
-- the code is trusted, and b) that the code hasn't been changed mid-transfer.
-- VeriCode applies this concept to Lua code sent over Rednet to add a layer of
-- security to Rednet. Just plainly receiving code from whoever sends it is
-- dangerous, and invites the possibility of getting malware (in fact, I've made
@MCJack123
MCJack123 / firefox-kde-appmenu-wayland.patch
Created June 25, 2024 20:24
Firefox patch to use (old) KDE appmenu protocol on Wayland if xdg-dbus-annotation fails
--- /dev/null
+++ b/widget/gtk/wayland/kwin-appmenu-v1-client-protocol.h
@@ -1,0 +1,189 @@
+/* Generated by wayland-scanner 1.23.0 */
+
+#ifndef APPMENU_CLIENT_PROTOCOL_H
+#define APPMENU_CLIENT_PROTOCOL_H
+
+#include <stdint.h>
+#include <stddef.h>
@MCJack123
MCJack123 / taskmaster.lua
Last active December 29, 2024 21:57
Taskmaster: A simple and highly flexible task runner/coroutine manager for ComputerCraft
-- Taskmaster: A simple and highly flexible task runner/coroutine manager for ComputerCraft
-- Supports adding/removing tasks, early exits for tasks, event white/blacklists, automatic
-- terminal redirection, task pausing, promises, and more.
-- Made by JackMacWindows
-- Licensed under CC0 in the public domain
--[[
Examples:
- Run three functions in parallel, and wait for any to exit.
@MCJack123
MCJack123 / css-discord.cpp
Last active June 17, 2024 00:13
Counter-Strike Source Discord RPC program (probably VAC safe, Linux only)
#include <discord.h>
#include <iostream>
#include <fstream>
#include <string>
#include <filesystem>
#include <thread>
#include <chrono>
namespace fs = std::filesystem;
@MCJack123
MCJack123 / toml.lua
Created January 23, 2024 00:29
TOML parser for CC Lua
-- TOML library for Lua/CC
-- From Phoenix libsystem serialization.toml
--
-- MIT License
--
-- Copyright (c) 2024 JackMacWindows
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
@MCJack123
MCJack123 / mmfs.c
Created December 29, 2023 04:33
Memory-Mapped Filesystem for ESP32: A performance-oriented filesystem driver designed for read-only partitions.
/**
* Memory-Mapped Filesystem for ESP32
* A performance-oriented filesystem driver designed for read-only partitions.
*
* Copyright (c) 2024 JackMacWindows. Licensed under the Apache 2.0 license.
*/
#include <errno.h>
#include <fcntl.h>
#include <esp_partition.h>
@MCJack123
MCJack123 / bfcompile.lua
Created October 30, 2023 00:34
AOT Brainfuck compiler to bytecode for Lua 5.1
--[[
registers: 0 = data table, 1 = data pointer, 2 = function temp, 3 = current data (4 total)
expects `get(): number` and `put(n: number)` global functions
init code
GETGLOBAL R(0), K("setmetatable")
NEWTABLE R(1), 0, 0
NEWTABLE R(2), 0, 1
CLOSURE R(3), KP(0)
SETTABLE R(2), K("__index"), R(3)
@MCJack123
MCJack123 / deflate-ans.lua
Last active July 1, 2024 00:29
A variant of DEFLATE using tabled asymmetrical numeral systems
-- DEFLATE-ANS: A variant of DEFLATE that uses asymmetrical numeral systems
-- instead of Huffman coding, increasing decompression speed with similar
-- compression ratios.
--
-- The block format matches RFC 1951 DEFLATE, with some minor adjustments:
-- * Bit fields are always stored most significant bit first, and bytes are
-- stored most significant byte first. This is for convenience in the bit
-- decoder.
-- * Huffman-encoded blocks are replaced with tANS-encoded blocks. These blocks
-- start with an initial X value (which is R bits long), followed by the codes