Skip to content

Instantly share code, notes, and snippets.

View operator-DD3's full-sized avatar
:octocat:
solo artist

Jacob Gardner operator-DD3

:octocat:
solo artist
  • banishing dirgist
View GitHub Profile
@operator-DD3
operator-DD3 / xsadb.lua
Last active August 29, 2015 14:27
[Lua] XSA Database v1.0
-- XSA DATABASE (XSADB)
-- Copyright 2015
-- XOUT SECURITY AGENCY (XSA)
function wrap(str, limit, indent, indent1) indent = indent or "" indent1 = indent1 or indent limit = limit or 72 local here = 1-#indent1 return indent1..str:gsub("(%s+)()(%S+)()", function(sp, st, word, fi) if fi-here > limit then here = st - #indent return "\n"..indent..word end end) end
function uuid()
my_uuid = ""
t = {[0] = '0', [1] = '1', [2] = '2', [3] = '3', [4] = '4', [5] = '5', [6] = '6', [7] = '7', [8] = '8', [9] = '9', [10] = 'a', [11] = 'b', [12] = 'c', [13] = 'd', [14] = 'e', [15] = 'f'}
for i = 1, 32 do
@operator-DD3
operator-DD3 / editor.html
Created August 11, 2015 03:21
A simple DATA:URI editor
<html> <head> <style> h1 { background-color: black; color: white; } </style> <script> function myfunc() { document.getElementById("myP").innerHTML = "<A HREF=data:text/html;charset=utf-8," + encodeURI(document.getElementById("text1").value) + ">output</a>" } </script> </head> <h1><center>Data:URI Editor</center></h1> <textarea id="text1" cols="80" rows="12"></textarea> <br> <button type="button" onclick="myfunc()">Create URI</button> <p id="myP"></p> </html>
@operator-DD3
operator-DD3 / stackVM.lua
Created August 11, 2015 03:04
A stack machine emulator created in Lua.
local txt="0 33 100 108 114 111 87 32 44 111 108 108 101 72 debug if outputascii fi"
io.write("Welcome to SuperStack!\nEnter your 'name':")
user = io.read()
io.write("\n" .. user .. "@superstack: ")
local txt = io.read()
--program=program.." "
txt=txt.." "
@operator-DD3
operator-DD3 / fs.lua
Created August 11, 2015 02:36
A fake operating system created in Lua.
FOS = {}
-- serialize functions
local function char(c) return ("\\%3d"):format(c:byte()) end
local function szstr(s) return ('("%s")'):format(s:gsub("[^ !#-~]", char)) end
local function szfun(f) return "loadstring"..szstr(string.dump(f)) end
function hex_dump(buf) for i=1,math.ceil(#buf/16) * 16 do if (i-1) % 16 == 0 then io.write(string.format('%08X ', i-1)) end io.write( i > #buf and ' ' or string.format('%02X ', buf:byte(i)) ) if i % 8 == 0 then io.write(' ') end if i % 16 == 0 then io.write( buf:sub(i-16+1, i):gsub('%c','.'), '\n' ) end end end
-- Root directory
FOS["/"] = {"bin", "home"}
@operator-DD3
operator-DD3 / date.lua
Created July 24, 2014 01:14
Lua Date Problem. These values, I thought, should be equal. 'a' is 6 hours behind 'b'.
local a = os.date('%c')
local b = os.date('!%a %b %d %H:%M:%S %Y')
print('Date: ' .. a)
print('UTC: ' .. b)
@operator-DD3
operator-DD3 / execute.lua
Created July 20, 2014 08:40
Execute command
function os.capture(cmd, raw)
local f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*a'))
f:close()
if raw then return s end
s = string.gsub(s, '^%s+', '')
s = string.gsub(s, '%s+$', '')
s = string.gsub(s, '[\n\r]+', ' ')
return s
end
@operator-DD3
operator-DD3 / tableRemDup.lua
Created July 18, 2014 08:17
Table Remove Duplicates
local test = {1,2,4,2,3,4,2,3,4,"A", "B", "A"}
local hash = {}
local res = {}
for _,v in ipairs(test) do
if (not hash[v]) then
res[#res+1] = v
hash[v] = true
end
end
@operator-DD3
operator-DD3 / string2table.lua
Created July 18, 2014 07:49
String to Table
local str = "text"
local t = {}
for i = 1, #str do
t[i] = str:sub(i, i)
end