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
# Script correlating to tutorial at http://ebens.me/post/install-lamp-stack-ubuntu | |
# Even though you probably could, don't run it all at once | |
# new user | |
adduser new_user | |
usermod -a -G sudo new_user | |
su - new_user | |
# new repos |
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/env lua | |
function exit(msg, code) | |
print(msg) | |
os.exit(code or 1) | |
end | |
function main() | |
if #arg < 4 then exit("Please provide a magnitude and angle for two polar vectors") end | |
local m1, a1, m2, a2 = unpack(arg) |
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
Tilemap = class("Tilemap") | |
Tilemap._mt = {} | |
function Tilemap._mt:__index(key) | |
return rawget(self, "_" .. key) or self.class.__instanceDict[key] | |
end | |
Tilemap:enableAccessors() | |
function Tilemap:initialize(img, fw, fh, width, height) |
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
Sheet = class("Sheet") | |
function Sheet:initialize(img, tileWidth, tileHeight) | |
self.x = 0 | |
self.y = 0 | |
self.image = img | |
self.tw = tileWidth | |
self.th = tileHeight | |
self.quads = {} | |
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
extern float factor = 1; | |
extern float addPercent = 0.1; | |
extern float clamp = 0.85; | |
// from http://www.ozone3d.net/blogs/lab/20110427/glsl-random-generator/ | |
float rand(vec2 n) | |
{ | |
return 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233))) * 43758.5453); | |
} |
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
postfx = {} | |
postfx.all = {} | |
postfx.active = true | |
local PixelEffect = class("PixelEffect") | |
function PixelEffect:initialize(effect) | |
self.effect = effect | |
self.active = true | |
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
// adapted from http://www.youtube.com/watch?v=qNM0k522R7o | |
extern vec2 size; | |
extern int samples = 5; // pixels per axis; higher = bigger glow, worse performance | |
extern float quality = 2.5; // lower = smaller glow, better quality | |
vec4 effect(vec4 colour, Image tex, vec2 tc, vec2 sc) | |
{ | |
vec4 source = Texel(tex, tc); | |
vec4 sum = vec4(0); |
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
require("list") | |
local a = { 3 } | |
local b = { 4 } | |
local l = list({ 2 }, a, b, { 5 }) | |
l:pop() | |
l:shift() | |
l:push({ 6 }) | |
l:unshift({ 7 }) |
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
Spritemap = class("Spritemap") | |
Spritemap._mt = {} | |
function Spritemap._mt:__index(key) | |
return rawget(self, "_" .. key) or self.class.__instanceDict[key] | |
end | |
Spritemap:enableAccessors() | |
function Spritemap:initialize(img, fw, fh, complete, ...) |
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
-- returns nil if there's no movement | |
function getDirection() | |
local xAxis = input.axisDown("left", "right") | |
local yAxis = input.axisDown("up", "down") | |
local xAngle = xAxis == 1 and 0 or (xAxis == -1 and math.tau / 2 or nil) | |
local yAngle = yAxis == 1 and math.tau / 4 or (yAxis == -1 and math.tau * 0.75 or nil) | |
if xAngle and yAngle then | |
-- x = 1, y = -1 is a special case the doesn't fit; not sure what I can do about it other than this: | |
if xAxis == 1 and yAxis == -1 then return yAngle + math.tau / 8 end |
NewerOlder