Skip to content

Instantly share code, notes, and snippets.

View CapsAdmin's full-sized avatar
🌜
Lua

Elias Hogstvedt CapsAdmin

🌜
Lua
View GitHub Profile
local fireBlocks = {}
local tilesize = 8
local numberWidthBlocks = math.floor(ScrW() / tilesize)
local numberHeightBlocks = 48 -- means all the 36 colors with a little more space to remaining flames
local offsetY = ScrH() - (numberHeightBlocks * tilesize)
local colorLookup = {
Color(7,7,7),
Color(31,7,7),
Color(47,15,7),
local fireBlocks = {}
local tilesize = 8
local numberWidthBlocks = math.floor(ScrW() / tilesize)
local numberHeightBlocks = 48 -- means all the 36 colors with a little more space to remaining flames
local offsetY = ScrH() - (numberHeightBlocks * tilesize)
local colorLookup = {
Color(7,7,7),
Color(31,7,7),
Color(47,15,7),
local ffi = require("ffi")
ffi.cdef[[
char *mmap(void *addr, size_t length, int prot, int flags, int fd, long int offset);
int munmap(void *addr, size_t length);
]]
local PROT_READ = 0x1 -- Page can be read.
local PROT_WRITE = 0x2 -- Page can be written.
local PROT_EXEC = 0x4 -- Page can be executed.
local ffi = require("ffi")
ffi.cdef[[
char *mmap(void *addr, size_t length, int prot, int flags, int fd, long int offset);
int munmap(void *addr, size_t length);
]]
local PROT_READ = 0x1 -- Page can be read.
local PROT_WRITE = 0x2 -- Page can be written.
local PROT_EXEC = 0x4 -- Page can be executed.
@CapsAdmin
CapsAdmin / main.lua
Last active May 17, 2021 23:33
repat until continue goto problem
-- INPUT:
--[[
local exit = false
repeat
if exit then break end
if true then
continue
end
local callback = {}
do
local meta = {}
meta.__index = meta
meta.Type = "callback"
function meta:__tostring()
return string.format("callback: %p", self)
@CapsAdmin
CapsAdmin / repl.lua
Created October 29, 2018 05:31
lua repl using ffi, windows isn't finished/working
local ffi = require("ffi")
local start
local stop
local read
if jit.os == "Linux" then
ffi.cdef([[
struct termios
g("frame")
Size = Vec2(250, 140)
Title = "Confirm Save As"
SetupLayout("LayoutChildren", "SizeToChildrenHeight", "SizeToChildrenWidth")
local frame = self
g("base")
Style = "frame"
SetupLayout("MoveUp", "FillX", "SizeToChildrenHeight")
g("rectangle")
SetupLayout("SizeToChildren", "CenterSimple")
@CapsAdmin
CapsAdmin / ffi_sockets.lua
Created October 18, 2018 15:07
luajit ffi tcp udp unix, luasocket-like
local ffi = require("ffi")
ffi.cdef[[
typedef int SOCKET;
typedef unsigned int socklen_t;
typedef uint16_t u_short;
typedef uint32_t u_int;
typedef unsigned long u_long;
typedef unsigned char byte;
typedef unsigned long size_t;
A列車で行こう 原信夫とシャープス&フラッツ
Billie's Bounce / Charlie Parker The Savoy Recordings
Mr. DanZ - Proto Cosmos
Greg Howe - Introspection (1993 Full Album)
Extraction - Greg Howe,Victor Wooten, Dennis Chambers, Dave Cook
Herbie Hancock - Actual Proof live at Montreux
Allan Holdsworth, Anthony Crawford, Virgil Donati. Live in Netherlands, 2012
Tal Wilkenfeld Transformation
Alvin Queen: Take The Coltrane
Niacin (Billy Sheehan, John Novello, Dennis Chambers) – Live At Blue Note Tokyo