This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local str = "text" | |
local t = {} | |
for i = 1, #str do | |
t[i] = str:sub(i, i) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local a = os.date('%c') | |
local b = os.date('!%a %b %d %H:%M:%S %Y') | |
print('Date: ' .. a) | |
print('UTC: ' .. b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.." " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local index_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' | |
function to_binary(integer) | |
local remaining = tonumber(integer) | |
local bin_bits = '' | |
for i = 7, 0, -1 do | |
local current_power = math.pow(2, i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local index_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' | |
function to_binary(integer) | |
local remaining = tonumber(integer) | |
local bin_bits = '' | |
for i = 7, 0, -1 do | |
local current_power = math.pow(2, i) |
OlderNewer