Skip to content

Instantly share code, notes, and snippets.

Fleutot fab13n

Block or report user

Report or block fab13n

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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()
@fab13n
fab13n / gist:1301283
Created Oct 20, 2011
metalua/treequery/walk.mlua
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{
@fab13n
fab13n / gist:1301275
Created Oct 20, 2011
metalua/treequery.mlua
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
@fab13n
fab13n / gist:1264752
Created Oct 5, 2011
TreeQuery prototype visitor
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
@fab13n
fab13n / gist:1264745
Created Oct 5, 2011
TreeQuery prototype
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]
You can’t perform that action at this time.