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
#!/usr/bin/lua | |
-- Brainfuck Interpreter in Lua | |
-- A result of an hour of boredom on a saturday | |
--[[ | |
Example: Hello World | |
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. |
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
--[[ | |
-- | |
-- Inny's Class Library | |
-- | |
-- Instances use classes as metatables | |
-- Subclasses are copies of parent classes (vtable style) | |
-- All classes can be instantiated through Class() or Class:new() | |
-- Class declarations can include bodies: X = class { member = value } | |
-- Classes can declare metamethods for instances | |
-- __index and __newindex are handled through getattr and setattr |
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
-- HAMURABI DOT BAS DOT LUA | |
-- Port of HAMURABI.BAS | |
-- See the wikipedia article for more information. | |
-- Use parameter -c or --color to play with ansi colors | |
random, floor, write = math.random, math.floor, io.write | |
---------------------------------------- | |
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 stride, stride_accessor, TERMINATOR | |
stride = { | |
_VERSION = "stride.lua 1.0", | |
_DESCRIPTION = [[ | |
Strided arrays are a generalized version of multi-dimensional arrays. | |
Use this instead of doing a lot of A[1+(y-1)*width+(x-1)] mayhem all over. | |
Example usage: | |
my_array = { 1, 2, 3, 4, 5, 6 } | |
view2d = stride.new(my_array, {3, 2}) |
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 lzw = {} | |
local function enc_reset(dict, size) | |
for k, _ in pairs(dict) do dict[k] = nil end | |
for i = 0, size-1 do dict[string.char(i)] = i end | |
return dict | |
end | |
local function dec_reset(dict, size) | |
for k, _ in pairs(dict) do dict[k] = nil 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 ascii = {} | |
ascii.null = 0 | |
ascii.empty_smiley = 1 | |
ascii.smiley = 2 | |
ascii.heart = 3 | |
ascii.diamond = 4 | |
ascii.club = 5 | |
ascii.spade = 6 | |
ascii.dot = 7 | |
ascii.inverse_dot = 8 |
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
-- Funky.lua, collection of functional tools | |
local _ENV = setmetatable({}, {__index = _ENV or _G}) | |
if setfenv then setfenv(1, _ENV) end | |
unpack = unpack or table.unpack | |
local __ = {} | |
do | |
-- We need a fast way to check for placeholders. All funkier libraries | |
-- will need to register themselves as a funky placeholder. |
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
" Header --------------------------------------------------------------------- | |
filetype on | |
call pathogen#infect() " Load Scripts from .vim/bundle | |
call pathogen#helptags() | |
set nocompatible | |
" Basic Options -------------------------------------------------------------- | |
filetype plugin indent on | |
syntax on | |
set encoding=utf-8 |
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
GIMP Palette | |
Name: HuePalSorted | |
Columns: 5 | |
# | |
53 11 11 H0 S66 L12 | |
106 21 21 H0 S66 L25 | |
159 32 32 H0 S66 L37 | |
212 43 43 H0 S66 L50 | |
223 96 96 H0 S66 L62 | |
53 32 11 H30 S66 L12 |
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 complex = { | |
__tostring = function(self) return ("(% .5f % .5fi)"):format(self[1], self[2]) end | |
} | |
local A = -2 * math.pi | |
local function C(t) return setmetatable(t, complex) end | |
local function cexp(x) | |
local er = math.exp(x[1]) | |
return C{ er*math.cos(x[2]), er*math.sin(x[2]) } | |
end |
OlderNewer