Skip to content

Instantly share code, notes, and snippets.

View malkia's full-sized avatar

Dimiter 'malkia' Stanev malkia

View GitHub Profile
@malkia
malkia / cdef-sample.lua
Created January 12, 2012 20:23
idea: extend luajit's ffi.cdef so that it can return introspection information
-- Something like (ZeroMQ in this case)
return {
typedefs = {
functions = {
zmq_free_fn = { "void", "data", "hint" },
},
structs = {
zmq_pollitem_t = "zmq_pollitem_t"
},
@malkia
malkia / platforms.txt
Created January 21, 2012 05:07
Platforms: Hosts and Targets, Tools and SDKs
Terminology
===========
1. Platform - The combination of Operating System, Kernel, Tools and Runtime, and/or specific hardware device.
2. Desktop Platform - Typical computer with mouse & keyboard
3. Mobile Platform - Cell Phone, Touch Pad or other similar portable device
4. Host Platform - The platform on which the product is built.
5. Target Platform - The platform on which the product runs.
6. Target Runtime Library - The main "C" library for which the product is compiled.
@malkia
malkia / bo.faq
Created February 3, 2012 05:28
bo faq
Q1: What is BO?
A1: BO is a luajit distribution targeting desktop computers and mobile devices.
Q2: Why BO?
A2: With BO you can edit and run lua code straight on the target.
Q3: Batteries included?
A3: Yes. BO comes with ffi bindings for several popular libraries and frameworks.
Q4: What is ffi?
@malkia
malkia / bo-tools.md
Created February 3, 2012 06:57
bo tools

BO should come with certain unix related tools

Candidates: Busybox: - One executable. There is a w32 port, trying it out now on OSX It's also good candidate for library

Alternative: Apache Apr - not the same - it's "portable library", but not executables

@malkia
malkia / bolo-stack.md
Created February 28, 2012 01:52
bolo stack

BOLO runtime stack.

  • luajit
  • Some windowing lib (SDL, GLFW, SFML, etc.)
  • pixman
  • cairo
  • freetype2
  • zlib
  • bz2
  • png
@malkia
malkia / luajit.lib.build
Created March 20, 2012 15:50
build script
+ffi="Enable he FFI extension. Disabling it would reduce the size of the LuaJIT executable. But please consider that the FFI library is compiled-in, but NOT loaded by default. It only allocates any memory, if you actually make use of it"
-lua52compat="Enable some upwards-compatible features from Lua 5.2 that are unlikely to break existing code (e.g. __pairs). Note that this does not provide"
+jit="Enable the JIT compiler, disabling it would turn LuaJIT into a pure interpreter"
+sse2="x86 only: use SSE2 instead of x87 instructions in the interpreter"
+cmov="Enable the use of CMOV and FCOMI*/FUCOMI* instructions in the interpreter. Disable it only if you intend to use REALLY ANCIENT CPUs (before Pentium Pro, or on the VIA C3). This generally slows down the interpreter. Don't bother if your OS wouldn't run on them, anyway."
+nummode1="Some architectures (e.g. PPC) can use either single-number (+nummode1) or dual-number (+nummode2) mode. Please see LJ_ARCH_NUMMODE in lj_arch.h for details."
+nummode2=-nummode1
-s
@malkia
malkia / ten20.txt
Created March 27, 2012 02:09
ten20 examples
+webos.pre lib
+webos.pixi lib
+webos.emul lib
# ten20 sample +webos.pre
# Pre-Build (p4 edit, other)
# Build
# Post-Build (copy, post build)
@malkia
malkia / platforms.build
Created March 31, 2012 09:37
another build primer
+win # MSVC Compilers
-host.win ERROR="No cross compiling possible outside Windows (yet there is some WINE stuff..."
+host.win
+host.win.vs2005 +host.win.vs2008 +host.win.vs2010 +host.win.vs2011
INIT="c:/Prorams Files/.../setvars32.cmd"
+host.win.sdk ERROR="Not Finished yet"
+host.win.wdk
WDK=`wdk-location.cmd`
CL=${WDK}/bin/cl.exe
@malkia
malkia / hack.sh
Created April 1, 2012 04:25 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@malkia
malkia / tenzo.lua
Created April 11, 2012 18:50
tenzo
-- Reads a dotted key from t
local function read(t, key)
local b,s,l = string.byte,string.sub,1
for i=1, key:len()+1 do
local c = b(key, i)
if c==nil or c==46 then
if l==i then
error( "Invalid key: [" .. tostring(key) .. "] at character position: " .. tostring(l) )
end
t,l = type(t)~="table" and nil or t[s(key, l, i-1)],i+1