Skip to content

Instantly share code, notes, and snippets.

View pingbird's full-sized avatar
🌺

ping pingbird

🌺
View GitHub Profile
@pingbird
pingbird / gist:6895559
Last active December 25, 2015 01:29
a faster version of base64
local _tob64={
[0]="A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",
"0","1","2","3","4","5","6","7","8","9","+","/"
}
function tob64(stxt)
local txt=tostring(stxt)
if not txt then
error("string expected, got "..type(stxt),2)
end
@pingbird
pingbird / gist:7777388
Last active December 30, 2015 04:39
improved serialization
local _tob64={
[0]="A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",
"0","1","2","3","4","5","6","7","8","9","+","/"
}
function tob64(stxt)
local txt=tostring(stxt)
if not txt then
error("string expected, got "..type(stxt),2)
end
@pingbird
pingbird / encryptall
Created January 4, 2014 22:04
crack it please ^_^
local tob64,unb64,genkey,new,serialize
do -- i like keeping functions i copy from my utility api in a do statement, so i can collapse it
local _tob64={
[0]="A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",
"0","1","2","3","4","5","6","7","8","9","+","/"
}
function tob64(stxt) -- hex was not intimidating enough
local txt=tostring(stxt)
if not txt then
@pingbird
pingbird / decryptall
Created January 4, 2014 22:08
crack it please ^_^
local tob64,unb64,genkey,new,serialize
do -- i like keeping functions i copy from my utility api in a do statement, so i can collapse it
local _tob64={
[0]="A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",
"0","1","2","3","4","5","6","7","8","9","+","/"
}
function tob64(stxt) -- hex was not intimidating enough
local txt=tostring(stxt)
if not txt then
local err,res=xpcall(function()
end,debug.traceback)
if not err then
pcall(function()
res=res:gsub("\t"," ")
local file=io.open("system/crash.txt","w")
file:write(res)
file:close()
local gpu=component.gpu
@pingbird
pingbird / brainf^vk
Last active September 10, 2016 09:40
brainfuck IRC bot
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-
----.------.++++++++.-------------------------------------------.+++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++.-----------
------.++++++++.+++++.--------.--------.++++++++++++++++++++++++.-----------.[-]
++++++++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++.--.--------------.+++++++++++++.----------------------------
----------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++.++++++++++++++++.-----------------.++++++++.+++++.--------.--------.++
++++++++++++++++++++++.-----------.---------------------------------------------
------------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++
@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