Skip to content

Instantly share code, notes, and snippets.

View hishamhm's full-sized avatar

Hisham Muhammad hishamhm

View GitHub Profile
@hishamhm
hishamhm / gist:1298641
Created October 19, 2011 15:31
Attempt at a sane design for module() for Lua 5.2 - Take 5
local lua_libs = {}
for k,v in pairs(package.loaded._G) do
lua_libs[k] = v
end
local function loader(name, modpath)
local mod, env = {}, {}
env.module = function (name)
mod._NAME = name
setmetatable(env, { __index = function(t,k) return rawget(mod, k) or rawget(lua_libs, k) end, __newindex = mod })
@hishamhm
hishamhm / loader5.lua
Created October 19, 2011 15:33
Attempt at a sane design for module() for Lua 5.2 - Take 5
-- Attempt at a sane design for module() for Lua 5.2 - Take 5
local lua_libs = {}
for k,v in pairs(package.loaded._G) do
lua_libs[k] = v
end
local function loader(name, modpath)
local mod, env = {}, {}
env.module = function (name)
@hishamhm
hishamhm / loader5.lua
Created October 19, 2011 15:34
Attempt at a sane design for module() for Lua 5.2 - Take 5
-- Attempt at a sane design for module() for Lua 5.2 - Take 5
local lua_libs = {}
for k,v in pairs(package.loaded._G) do
lua_libs[k] = v
end
local function loader(name, modpath)
local mod, env = {}, {}
env.module = function (name)
@hishamhm
hishamhm / 01-Ideas.md
Created November 12, 2011 19:38 — forked from fowlmouth/01-Ideas.md
Path to 015

Path to Gobo 015

I'm going to use this gist as a scratch pad for ideas for continuing GoboLinux. Feel free to add ideas, questions, quandaries, etc. -fowl

Come lurk in IRC at irc.freenode.net #gobolinux

The Process

This should get you to a 014.10 system from 014.01 in the safest way possible. This guide was written in mind from a fresh 014.01 minimal install, but you should be

@hishamhm
hishamhm / luarocks-2.0.8-rc1-simplify_detection_of_bins.diff
Created February 19, 2012 18:56
LuaRocks 2.0.8-rc1: Simplify detection of binary files for determining arch suffix of packed rocks
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua
index 979fd16..88bafaf 100644
--- a/src/luarocks/fs/unix.lua
+++ b/src/luarocks/fs/unix.lua
@@ -71,30 +71,16 @@ function is_actual_binary(filename)
return false
end
local file = io.open(filename)
- if file then
- local found = false
#!/usr/bin/env lua
local arg = { ... }
local function read_file(filename)
local result = {}
local chunk, err
if setfenv then -- Lua 5.1
chunk, err = loadfile(filename)
if chunk then
@hishamhm
hishamhm / lua-5.1.5-notailcalls.diff
Created September 27, 2013 21:11
Build a modified version of Lua 5.1.5 without tail calls
diff -ur lua-5.1.5/src/lparser.c lua-5.1.5-notailcalls/src/lparser.c
--- lua-5.1.5/src/lparser.c 2011-10-21 17:31:42.000000000 -0200
+++ lua-5.1.5-notailcalls/src/lparser.c 2013-09-27 17:44:56.000000000 -0300
@@ -1248,7 +1248,7 @@
if (hasmultret(e.k)) {
luaK_setmultret(fs, &e);
if (e.k == VCALL && nret == 1) { /* tail call? */
- SET_OPCODE(getcode(fs,&e), OP_TAILCALL);
+ SET_OPCODE(getcode(fs,&e), OP_CALL);
lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar);
@hishamhm
hishamhm / lua-5.2.2-notailcalls.diff
Created September 27, 2013 21:12
Build a modified version of Lua 5.2.2 without tail calls
diff -ur lua-5.2.2/src/lparser.c lua-5.2.2-notailcalls/src/lparser.c
--- lua-5.2.2/src/lparser.c 2013-02-06 11:37:39.000000000 -0200
+++ lua-5.2.2-notailcalls/src/lparser.c 2013-09-27 18:04:20.000000000 -0300
@@ -1505,7 +1505,7 @@
if (hasmultret(e.k)) {
luaK_setmultret(fs, &e);
if (e.k == VCALL && nret == 1) { /* tail call? */
- SET_OPCODE(getcode(fs,&e), OP_TAILCALL);
+ SET_OPCODE(getcode(fs,&e), OP_CALL);
lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar);
diff -ur lua-5.2.3/src/lapi.c lua-5.2.3-new/src/lapi.c
--- lua-5.2.3/src/lapi.c 2013-04-12 15:48:47.000000000 -0300
+++ lua-5.2.3-new/src/lapi.c 2014-03-24 19:00:42.000000000 -0300
@@ -345,6 +345,19 @@
}
}
+LUA_API lua_Number lua_tonumberx2 (lua_State *L, int idx, int *isnum) {
+ TValue n;
+ const TValue *o = index2addr(L, idx);
devpts on /dev/pts type devpts (rw)
debugfs on /sys/kernel/debug type debugfs (rw)
none on /System/Kernel/Config type configfs (rw)
none on /dev/shm type tmpfs (rw)
/dev/sda1 on /System/Kernel/Boot type ext2 (rw,noatime)
/dev/sda4 on /Mount/FAT1 type vfat (rw,noatime,umask=000)
/dev/sda3 on / type ext3 (rw,noatime)
unionfs on /.union_mp.tmp.4U4USYl46xx/Programs type fuse.unionfs (rw,nosuid,nodev,default_permissions)
unionfs on /.union_mp.tmp.4U4USYl46xx/System type fuse.unionfs (rw,nosuid,nodev,default_permissions)
unionfs on /.union_mp.tmp.4U4USYl46xx/Data type fuse.unionfs (rw,nosuid,nodev,default_permissions)