Skip to content

Instantly share code, notes, and snippets.

View bananasov's full-sized avatar
🍵

bananasov

🍵
  • The Netherlands
  • 20:16 (UTC +02:00)
View GitHub Profile
@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)
@MasonGulu
MasonGulu / staple.lua
Last active March 10, 2024 17:50
Attach multiple CC monitors together in a grid
---@diagnostic disable: duplicate-set-field
-- Modern recreation of stitch
-- This can be used as a library or as a command-line tool
-- Scrolling requires buffering to be enabled, pass layout.buffer = true
-- This significantly slows down staple, enabling literally just wraps staple in a window
local function getNative()
local i = 1
while true do
local n, v = debug.getupvalue(peripheral.call, i)

Quick start

Tauri is shipped with state management function/feature by default.

Basic usage is quite simple: a variable of State type can be accessed on the tauri commands which you have defined; in other words, "with tauri commands, they'll magically inject state for you," so that once a variable is managed you can inject them directly as additional input when defining the command.

Example Implementation

*excerpt from slab6.txt in the SLAB6 download found at http://advsys.net/ken/download.htm#slab6 *

VOX file format

Both SLABSPRI&SLAB6(D) support a simpler, uncompressed voxel format using the VOX file extension. Here's some C pseudocode that describes the format:

long xsiz, ysiz, zsiz;          //Variable declarations
char voxel[xsiz][ysiz][zsiz];