Skip to content

Instantly share code, notes, and snippets.

View nefftd's full-sized avatar

Anthony Eadicicco nefftd

View GitHub Profile
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
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
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)
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') ) )
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
#!/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;
#!/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;
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
;;
-- 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
-- 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