Skip to content

Instantly share code, notes, and snippets.

View pingbird's full-sized avatar
🌺

ping pingbird

🌺
View GitHub Profile
@pingbird
pingbird / gist:9391271
Created March 6, 2014 14:45
OC framebuffer API
local component=require("component")
local unicode=require("unicode")
local function new(mx,my,gpu)
gpu=gpu or component.gpu
local d={
mx=mx,
my=my,
t={},
b={},
f={},
@pingbird
pingbird / gist:9405952
Created March 7, 2014 05:54
holographic menger sponge
local component=require("component")
local unicode=require("unicode")
local holo=component.hologram
holo.setScale(2)
holo.clear()
local function menger(x,y)
x,y=x-1,y-1
while x>0 or y>0 do
if x%3==1 and y%3==1 then
return false
@pingbird
pingbird / gist:9406237
Last active August 29, 2015 13:57
holographic sphere
local component=require("component")
local holo=component.hologram
holo.setScale(2)
holo.clear()
local function dist(ax,ay,az,bx,by,bz)
return math.abs(math.sqrt((bx-ax)^2+(by-ay)^2+(bz-az)^2))
end
local function combine(bits)
local o=0
for k,v in pairs(bits) do
@pingbird
pingbird / gist:9458850
Created March 10, 2014 03:16
holographic text
local component=require("component")
local unicode=require("unicode")
local term=require("term")
term.clear()
local gpu=component.gpu
local holo=component.hologram
holo.setScale(2)
holo.clear()
local function bpack(bits)
local o=0
@pingbird
pingbird / gist:9476234
Created March 10, 2014 22:59
fail ircd
local socket=require("socket")
local sv=socket.bind("*",1338)
local function nxt(tbl)
local n=1
while tbl[n] do
n=n+1
end
return n
end
local function tpairs(tbl)
@pingbird
pingbird / gist:9493384
Created March 11, 2014 19:36
OC setfenv implementation
local envs=setmetatable({},{
__mode="k", -- allow loaded functions to be collected
})
local oldload=load
function load(ld,source,env)
local tbl=env or _G
local n={
__index=tbl,
__newindex=tbl,
__pairs=tbl,
@pingbird
pingbird / gist:9549828
Created March 14, 2014 15:20
WIP config parser
local lfs=require("lfs")
local ids={}
local base=[[C:\dir\to\config\folder]]
local bti={
"block",
"blocks",
"item",
"items",
'"blocks and item ids"', -- CCLights
@pingbird
pingbird / gist:9680913
Created March 21, 2014 06:50
Malbolge in LOLScript
MAH PROGRAM SHUD BE "(=<`#9]~6ZY32Vx/4Rs+0No-&Jk)\"Fh}|Bcy?`=*z]Kw%oG4UUS0/@-ejc(:'8dc"
MAH ENCOD SHUD BE {
[0] SHUD BE 57 ,109,60 ,46 ,84 ,86 ,97 ,99 ,96 ,117,89 ,42 ,77 ,75 ,39 ,88 ,126,120,68 ,
108,125,82 ,69 ,111,107,78 ,58 ,35 ,63 ,71 ,34 ,105,64 ,53 ,122,93 ,38 ,103,
113,116,121,102,114,36 ,40 ,119,101,52 ,123,87 ,80 ,41 ,72 ,45 ,90 ,110,44 ,
91 ,37 ,92 ,51 ,100,76 ,43 ,81 ,59 ,62 ,85 ,33 ,112,74 ,83 ,55 ,50 ,70 ,104,
79 ,65 ,49 ,67 ,66 ,54 ,118,94 ,61 ,73 ,95 ,48 ,47 ,56 ,124,106,115,98 ,
}
MAH OUT SHUD BE {}
MAH SOMETHING CRAZY (A,B)
i like walruses
local prg='0"!dlroW ,olleH">:#,_@'
local mem={}
local width=0
local sy=0
local stack={}
local function push(val)
table.insert(stack,1,val%256)
end
local function pop(n)
local v=stack[n or 1]