Skip to content

Instantly share code, notes, and snippets.

Avatar

Dimiter 'malkia' Stanev malkia

View GitHub Profile
View Simple go runner
/*
# Makefile for go.go
all: install
include $(GOROOT)/src/Make.$(GOARCH)
TARG = go
GOFILES = $(TARG).go
View beer.lisp
;; beer.lisp
;; simple opengl playground
;; Load this in Lispworks, or Lispworks Personal, and type Ctrl+Shift+B
;; malkia@gmail.com
(eval-when (:compile-toplevel :execute :load-toplevel)
(let ((lwdir (concatenate 'string (namestring *lispworks-directory*) "lib/6-0-0-0/")))
(load (concatenate 'string lwdir "examples/opengl/defsys"))
(load (concatenate 'string lwdir "examples/opengl/examples/defsys"))
(compile-system 'opengl :load t :force nil)
View nu
The NU project.
Two Applications:
- The Editor
- The Player
Command Line Tool:
- The Convertor - Builds assets continuously - should be able to parallelize with IncrediBuild, ElectricFence, ccache/distcc, SN-DBS, etc.
Editor:
View badif.lua
-- run with luajit (www.luajit.org)
-- LuaJIT 2.0.0-beta4 commit 926f688cd0cc177a779ee3bdb2c6a346383dd8e4 Thu May 20 00:40:51 2010 +0200
--
-- Results on my Windows Vista Professional x64 machine: http://browse.geekbench.ca/geekbench2/view/229361
-- ../luajit/src/luajit badif.lua
-- (i & 0x80000000) == 0 time: 1.043
-- (i & 0xFFFFFFFF) == 0 time: 0.699
-- (i & 0x00000001) == 0 time: 3.684
-- (i & 0x00000003) == 0 time: 5.337
-- (i & 0x00000002) == 0 time: 3.684
View badif.lisp
; Under Lispworks 6.01 32-bit Windows Vista
;
; CL-USER 100 > (test-fun)
; (i & 0x80000000) == 0 time: 0.717
; (i & 0xFFFFFFFF) == 0 time: 0.671
; (i & 0x00000001) == 0 time: 0.718
; (i & 0x00000003) == 0 time: 0.795
; (i & 0x00000002) == 0 time: 0.827
; (i & 0x00000004) == 0 time: 0.78
; (i & 0x00000008) == 0 time: 0.811
View gist:414091
/*
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
C:\> cl -O2 badif.c
C:\> badif
(i & 0x80000000) == 0 time: 0.674000
(i & 0xFFFFFFFF) == 0 time: 0.677000
(i & 0x00000001) == 0 time: 0.677000
(i & 0x00000003) == 0 time: 0.674000
(i & 0x00000002) == 0 time: 0.691000
(i & 0x00000008) == 0 time: 1.051000
View lua-editor.lua
Editor = {
"1. First Line",
"2. Second Line",
"3. Third Line",
"4. Fourth Line",
"5. Fifth Line",
}
function timeit(fun,info)
info = info or ""
View array-ops.lua
function DeleteArrayElements( array, index, count )
-- Deletes one or more (count) array elements from the specified index.
-- Returns an undo function, which if called would revert the operation.
local deletedElements = {}
assert( index >= 1 and index <= #array, "index=" .. index .. " must be >= 1 and <= " .. #array .. " (#array)" )
assert( count >= 1 and count <= #array - index + 1, "count=" .. count .. " must be >= 1 and <= " .. #array - index + 1 .. " (#array - index + 1) where #array=" .. #array .. " and index=" .. index)
for i = 0, count - 1 do
View install-sdk
#!/bin/sh
SDK=`dirname $0`
SCRIPT=`basename $0`
SDKPARENT=`dirname $SDK`
PLATFORM=`uname -sp`
if [ "$PLATFORM" = "Darwin i386" -o "$PLATFORM" = "Darwin x86_64" ]; then
echo "iPhone Toolchain installer script by rpetrich"
echo ""
View hex.c
#include <stdio.h>
char hex( char h )
{
signed char xa = '0' - h;
signed char xb = h - ('9' + 1);
signed char ya = ('A' - 1) - h;
signed char yb = h - ('F' + 1);
signed char za = ('a' - 1) - h;
signed char zb = h - ('f' + 1);