Skip to content

Instantly share code, notes, and snippets.

View bortels's full-sized avatar

Tom Bortels bortels

View GitHub Profile
@bortels
bortels / decodea.pl
Created December 2, 2011 07:57
Decode a .codea rtfd file
#!/usr/bin/perl
# Tom's nasty and ugly .codea (rtfd) decoder
# I release this bad boy to the public domain, you can't stop me!
$debug=1;
$f = shift @ARGV || "Font.codea";
open ($fh, $f);
@bortels
bortels / Base64.lua
Created December 6, 2011 05:56
Base64 encode/decode for Codea (Lua)
-- Lua 5.1+ base64 v3.0 (c) 2009 by Alex Kloss <alexthkloss@web.de>
-- licensed under the terms of the LGPL2
-- character table string
local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
-- encoding
function enc(data)
return ((data:gsub('.', function(x)
local r,b='',x:byte()
@bortels
bortels / tom.uu
Created December 6, 2011 18:27
uuencoded pnm of tomfezicon
begin 644 tom.pnm
M4#8*-C0@-C0*,C4U"@P3&28]0Q9!2``Q.`4P.0`5(A(;+`8'&0\-&Q,0&1@6
M&R$>)2@G-1$:*R$Y10\P.2$9+BD7+1T+(146*`DD-0`C/P,=0@H9.@L6*!8@
M*4A15DM55S9"0@$0#0D1%`T-&2DB*@T*$187&Q$6&08+#@D-$`D-$`D,$189
M(!L>)2`C+!P?*!T@)Q$9'`\9&Q8B(AHA*QX@+!T@*1D=(!PB(BHN,3Y!2$U2
M5E!96%5;6UQ;85U;8%I<655<5%5;5U58720I+3U,4R`[1`HL-00E+@08(P\6
M)@D(&`L+%QL:(!43&!T:(Q06(Q`<*B(X11$N-BD5+C$9,R$*)!H;+P8A-``C
M/0`>00`9-P89*A,A*DA26TU47#I"10T5%Q$1&1<.'R@G+0X-$Q85&B@I+0T.
M$A(1%A(0%1`/%1H=)`<.%`<0%PD0%@P1%Q07'!@=(1<?(1DB*1D@*AD=)APD
M)Q@B(Q8=(QD@*!XE*RTV-4I04%M:7U]=8E-55$U33TE244E06#M!04-(3D)*
@bortels
bortels / tomfezicon.b64
Created December 6, 2011 19:43
base 64 encoded tomfezicon.pnm
UDYKNjQgNjQKMjU1CgwTGSY9QxZBSAAxOAUwOQAVIhIbLAYHGQ8NGxMQGRgWGyEeJSgnNREaKyE5
RQ8wOSEZLikXLR0LIRUWKAkkNQAjPwMdQgoZOgsWKBYgKUhRVktVVzZCQgEQDQkRFA0NGSkiKg0K
ERYXGxEWGQYLDgkNEAkNEAkMERYZIBseJSAjLBwfKB0gJxEZHA8ZGxYiIhohKx4gLB0gKRkdIBwi
IiouMT5BSE1SVlBZWFVbW1xbYV1bYFpcWVVcVFVbV1VYXSQpLT1MUyA7RAosNQQlLgQYIw8WJgkI
GAsLFxsaIBUTGB0aIxQWIxAcKiI4RREuNikVLjEZMyEKJBobLwYhNAAjPQAeQQAZNwYZKhMhKkhS
W01UXDpCRQ0VFxERGRcOHygnLQ4NExYVGigpLQ0OEhIRFhIQFRAPFRodJAcOFAcQFwkQFgwRFxQX
HBgdIRcfIRkiKRkgKhkdJhwkJxgiIxYdIxkgKB4lKy02NUpQUFtaX19dYlNVVE1TT0lSUUlQWDtB
QUNITkJKVUFSWjlOUzdGTTA2QistOiMmLzg7QCsqLy0sNBMXIgQSHSk9SA8lMCkMKDYZNRwIIxcZ
LgciNwAlPgAlQgAeNQEYKBclME1VYE5SXjk8QxUWGxAKFhgJHhkeIg8QFRMRFiMeJBMRFhYRFxgR
GBgRGSsrMxMcIRQjJgsWGgcKEQwLERcWHBwgIxkkJhojKBskKRYhIxclJhsmKhskLRojKBUfID9I
@bortels
bortels / tomfezicon.hex
Created December 7, 2011 00:03
tomfezicon.jpg in pnm format, hex
P3
4040
ff
0c1319263d43164148003138053039001522121b2c060719
0f0d1b13101918161b211e25282735111a2b2139450f3039
21192e29172d1d0b2115162809243500233f031d420a193a
0b16281620294851564b555736424201100d0911140d0d19
29222a0d0a1116171b111619060b0e090d10090d10090c11
1619201b1e2520232c1c1f281d202711191c0f191b162222
1a212b1e202c1d2029191d201c22222a2e313e41484d5256
@bortels
bortels / jpeg2hex.pl
Created December 7, 2011 19:04
convert jpg to hex pnm
#!/usr/bin/perl
$f = shift @ARGV || die "syntax: jpg2hex FILENAME\n";
open($fh, "jpegtopnm tomfezicon.jpeg | pnmtoplainpnm |");
$x = <$fh>; print $x;
while (<$fh>) {
@r = split(/\s+/);
foreach $h (@r) { printf("%02x", $h); }
print "\n";
}
@bortels
bortels / dkjson
Created March 25, 2012 22:40
json encode/decode in lua
--[==[
David Kolf's JSON module for Lua 5.1/5.2
========================================
*Version 2.1*
This module writes no global values, not even the module table.
Import it using
@bortels
bortels / sphere.lua
Created May 3, 2012 20:36
Sphere in Codea
-- Use this function to perform your initial setup
function setup()
    local vertex = {}
vertex[1] = vec3(0.382683, 0.923880, 0.00000e+0)
vertex[2] = vec3(0.353553, 0.923880, 0.146447)
vertex[3] = vec3(0.270598, 0.923880, 0.270598)
vertex[4] = vec3(0.146447, 0.923880, 0.353553)
vertex[5] = vec3(2.34318e-17, 0.923880, 0.382683)
vertex[6] = vec3(-0.146447, 0.923880, 0.353553)
@bortels
bortels / mvc
Created October 2, 2012 17:02
minecraft control script using screen
#! /bin/sh
### BEGIN INIT INFO
# Provides: minecraft_server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Minecraft Server control script.
# Description: Minecraft Server control script.
# Options
@bortels
bortels / ply
Created November 2, 2012 04:05
PLY loading class for Codea
-- minor modifications from https://dl.dropbox.com/u/80475380/CodeaForumPictures/Main.lua
--
-- call with m = PLY:parsePLY(string)
PLY = class()
function PLY:readLine()
-- Read one line of ply string. Return without \n. Return nil, if end is reached.
local endLine = false