Skip to content

Instantly share code, notes, and snippets.

@jperon
jperon / html.moon
Created June 13, 2025 09:50
html lib for Moonscript / Lua
---
-- HTML builder module.
-- Provides a function to easily create HTML tags.
-- @module html
---
:concat, :remove = table
---
-- Creates an HTML tag string.
-- The function is accessed via `html[tag_name]`.
@jperon
jperon / rcu_bug.lua
Created May 8, 2025 19:17
Lunatik bug with rcu
local lunatik = require "lunatik"
local linux = require "linux"
local rcu = require "rcu"
local runner = rcu and require "lunatik.runner"
local thread = require "thread"
local function milliseconds()
return linux.time() / 1000000
end
@jperon
jperon / msgbox.lua
Last active April 1, 2025 18:57
lunatik msgbox
local lunatik = require("lunatik")
local rcu = require("rcu")
local data = require("data")
return function(self, hsize)
hsize = hsize or 1024
local env = lunatik._ENV
local box = env[self]
@jperon
jperon / gps2droid.lua
Last active March 16, 2025 16:34
Pass gps receiver data from Linux to Waydroid
local arg = arg
local open, popen = io.open, io.popen
local execute, time = os.execute, os.time
local concat = table.concat
local map
map = function(self, f)
local i, res = 0, { }
for x in self do
i = i + 1
res[#res + 1] = f(x, i)
@jperon
jperon / gpsdbridge.sh
Created October 19, 2024 11:51
Pass gpsd data to Waydroid thanks to gpscsv
#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright 2024 Jacob D Ludvigsen (contributions@ingeniorskap.no)
# This script bridges basic geolocation info
# from GPSD running on the host system into Waydroid.
# Current location is parsed from the example "gpscsv" gpsd agent,
# and sent via adb to the mock location provider "appium"
# running in the Waydroid container.
@jperon
jperon / zz-update-lunatik
Last active September 22, 2024 19:55
Update Lunatik on Debian kernel upgrade
#!/usr/bin/env bash
# This script should be in the folder /etc/kernel/postinst.d/
# It assumes Lunatik sources are in /opt/lunatik
KERNEL_RELEASE=$(uname -r)
# This ugly hack is needed because Ubuntu has a weird kernel package versionning.
KERNEL_VERSION=$( (grep -o '[0-9.]*$' /proc/version_signature 2>/dev/null) || (uname -r | grep -o '^[0-9.]*') )
KERNEL_VERSION_MAJOR=$(echo "${KERNEL_VERSION}" | grep -o '^[0-9]*')
LUNATIK_DIR="/opt/lunatik"
@jperon
jperon / sort_ind.lua
Last active October 24, 2022 21:29
Sort .ind file (from LaTeX), with accented characters in the right place. Initially for https://github.com/LaurentClaessens/mazhe
local read, write
do
local _obj_0 = io
read, write = _obj_0.read, _obj_0.write
end
local byte, char
do
local _obj_0 = string
byte, char = _obj_0.byte, _obj_0.char
end