Instantly share code, notes, and snippets.

View elorn-raspi-part-1.lua
require 'sched'
require 'web.server'
require 'web.template'
require 'serial'
telnet = require 'shell.telnet'
uart = serial.open('/dev/ttyAMA0', { baudrate=19200 })
-- Read enough data from the UART to extract two consecutive frames.
function get_raw_data()
View gist:1301283
-{ extension "match" }
local M = { traverse = { }; tags = { }; debug = false }
--------------------------------------------------------------------------------
-- Standard tags: can be used to guess the type of an AST, or to check
-- that the type of an AST is respected.
--------------------------------------------------------------------------------
M.tags.stat = table.transpose{
View gist:1301275
local walk = require 'metalua.treequery.walk'
local M = { }
-- support for old-style modules
treequery = M
-- -----------------------------------------------------------------------------
-- -----------------------------------------------------------------------------
--
-- multimap helper mmap: associate a key to a set of values
View gist:1264752
-- Low level AST traversal library.
-- This library is a helper for the higher-level treequery library.
-- It walks through every node of an AST, depth-first, and executes
-- some callbacks contained in its cfg config table:
--
-- * cfg.down(...) is called when it walks down a node, and receive as
-- parameters the node just entered, followed by its parent, grand-parent
-- etc. until the root node.
--
-- * cfg.up(...) is called when it walks back up a node, and receive as
View gist:1264745
local walk = require 'metalua.treequery.walk'
local M = { }
-- support for old-style modules
treequery = M
-- multimap helper mmap: associate a key to a set of values
local function mmap_add (mmap, node, x)
if node==nil then return false end
local set = mmap[node]
View gist:1250474
require 'metalua.walk'
local M = { }
-- support for old-style modules
treequery=M
-- multimap helper mmap: associate a key to a set of values
local function mmap_add (mmap, node, x)
if node==nil then return false end
local set = mmap[node]