This file contains hidden or 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
for dir in package.path:gmatch([^;]+) do | |
dir = dir:gsub('%?.*$','') | |
for file in lfs.dir(dir) do | |
print(file) | |
end | |
end | |
for dir in package.cpath:gmatch([^;]+) do | |
dir = dir:gsub('%?.*$','') | |
for file in lfs.dir(dir) do |
This file contains hidden or 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
do | |
local function _ffa(func,key) | |
local nextv | |
key,nextv = next(_G,key) | |
while nextv ~= nil do | |
if nextv == func then | |
return key,_ffa(func,key) | |
end | |
key,nextv = next(_G,key) | |
end |
This file contains hidden or 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 characters_to_array(str, length) | |
-- Returns an array where every (length) character are split into a new field | |
-- of said array. | |
if #str == 0 then return {} end | |
local a,i = {},1 | |
repeat | |
a[i] = str:sub(1,length) |
This file contains hidden or 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 function cleverinsert(tbl, a, b, ...) | |
if a == nil then return tbl end | |
tbl[a] = b | |
return cleverinsert(tbl, ...) | |
end | |
print( unpack( cleverinsert({}, 1,'a', 2,'b', 3,'c') ) ) |
This file contains hidden or 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
Falskaar | |
Konahrik's Accoutrements - Dragon Priest Armory | |
Luftahraan - Heimfeigr | |
Moon and Star | |
The Bottomless Pit | |
The Lost Wonders of Mzark | |
The Wheels of Lull | |
Undeath | |
Wyrmstooth |
This file contains hidden or 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
#!/bin/bash | |
# I only care about tmux session management, and don't care about | |
# nested sessions. Here's a little wrapper to singicantly ease | |
# session management at the expense of tmux's more powerful | |
# features. | |
usage() { | |
echo "usage: tm ACTION [name]" 1>&2; | |
echo "Available actions are:" 1>&2; |
This file contains hidden or 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
#!/bin/bash | |
# I only care about tmux session management, and don't care about | |
# nested sessions. Here's a little wrapper to singicantly ease | |
# session management at the expense of tmux's more powerful | |
# features. | |
usage() { | |
echo "usage: tm ACTION [name]" 1>&2; | |
echo "Available actions are:" 1>&2; |
This file contains hidden or 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
d) | |
OUT="$(tmux detach 2>&1)" | |
if [[ "$OUT" =~ ^(failed to connect to server) ]]; then | |
echo "tm: tmux server not active" 1>&2; | |
ERRCODE = 1 | |
elif [[ $? != 0 ]]; then | |
[[ -z "$OUT" ]] && echo $OUT 1>&2; | |
ERRCODE = 1 | |
fi | |
;; |
This file contains hidden or 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
-- Implementations | |
local impl = {} | |
impl[1] = function(size) | |
local c,r = string.char,math.random | |
local str = {} | |
for i = 1,size do | |
str[i] = c(r(0,255)) | |
end |
This file contains hidden or 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
-- Implementations | |
local function randstring_1(size) | |
local c,r = string.char,math.random | |
local str = {} | |
for i = 1,size do | |
str[i] = c(r(0,255)) | |
end | |
return table.concat(str) | |
end |