Skip to content

Instantly share code, notes, and snippets.

View CapsAdmin's full-sized avatar
🌜
Lua

Elias Hogstvedt CapsAdmin

🌜
Lua
View GitHub Profile
type IPixVis = {}
type ISensor = {}
local CLIENT = true
local SERVER = true
local MENU = true
type IBfRead = {}
type IWeapon = {}
type IVehicle = {}
type IVector = {}
type IMatrix = {}
@CapsAdmin
CapsAdmin / spleeter.cmd
Last active January 1, 2024 06:01
This makes it possible to run spleeter without having to install pyton and pip on windows. See http://github.com/deezer/spleeter for more info on what spleeter is. Usage is `.\spleeter.cmd separate -p spleeter:5stems -o amen .\amenbrother.wav`
@echo off & PowerShell -nologo -noprofile -noninteractive Invoke-Expression ('$args=(''%*'').split('' '');'+'$PSScriptRoot=(''%~dp0'');$env:GOLUWA_CURRENT_DIRECTORY=(''%cd%'');'+((Get-Content -Raw '%~dp0%~n0%~x0' ) -Replace '^.*goto :EOF')); & goto :EOF
# ^^^^^
# this is some magic to execute the rest of this cmd as powershell
# so we can run it from explorer with double click or cmd easily
function Download($url, $location) {
Write-Host -NoNewline "'$url' >> '$location' ... "
(New-Object System.Net.WebClient).DownloadFile($url, "$location")
Write-Host "OK"
<!DOCTYPE html>
<html>
<style>
body {
background-color: black;
background-size: cover;
overflow: hidden;
opacity: 1;
transition: all 300ms ease-in 200ms;
}
@CapsAdmin
CapsAdmin / csv2tbl.lua
Created July 5, 2019 10:56
csv to table
local function string_split(self, separator)
local tbl = {}
local tbl_i = 1
local last_pos = 1
local len = #separator - 1
for i = 1, #self do
if self:sub(i, i + len) == separator then
tbl[tbl_i] = self:sub(last_pos, i - len - 1)
let tbl = {
foo: [1,2,3],
bar: [4,5,6],
}
let test = function(a,b,c) {
console.log(a,b,c)
}
/*
-- these have to be sorted by longest first
local keywords = {
"function",
"then",
"end",
"if",
}
local symbols = {
local ffi = require("ffi")
local cast = ffi.cast
local ctype = ffi.typeof("float *")
local function get_num(bytes)
local res = cast(ctype, bytes)[0]
if not res then
print(res, type(res), res or 0)
res = 0
end
return res
local ffi = require("ffi")
local lua = require("luajit")
local sdl = require("SDL2")
ffi.cdef("void* malloc(size_t size); void *memcpy(void*, void*, size_t);")
local message_type = "struct {uint8_t*to_ptr; size_t to_len; uint8_t*from_ptr; size_t from_len; uint8_t from_ready;}"
local state = lua.L.newstate()
lua.L.openlibs(state)
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),