Skip to content

Instantly share code, notes, and snippets.

View malkia's full-sized avatar

Dimiter 'malkia' Stanev malkia

View GitHub Profile
;; Lispworks 6.00 required and p4 executable
;; Tested only under Vista 64 bit with Lispworks Professional 32-bit
;;
(defpackage "P4BEE" (:use "CL"))
(in-package "P4BEE")
(eval-when (:compile-toplevel :load-toplevel :execute)
(let ((dir (or *compile-file-truename* *load-truename* *default-pathname-defaults*)))
(format t "*compile-file-truename* = ~A~&" *compile-file-truename*)
(format t "*load-truename* = ~A~&" *load-truename*)
@malkia
malkia / nan.c
Created March 17, 2011 03:47
This examples show how floating point numbers that are NaN are always different even if they are the same binary identity
#include <stdio.h>
/*
malkia ~/p $ gcc nan.c
nan.c: In function ‘print_range’:
nan.c:15: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘unsigned int’
nan.c:15: warning: format ‘%p’ expects type ‘void *’, but argument 3 has type ‘unsigned int’
nan.c:15: warning: format ‘%p’ expects type ‘void *’, but argument 4 has type ‘unsigned int’
malkia ~/p $ ./a.out
[0x7f800001 .. 0x7fffffff], total of 0x7fffff (8388607)
@malkia
malkia / em.bat
Created March 22, 2011 19:05
My batch file that starts emacs. It's located in c:\emacs-22.3\bin
@start /B /MAX %~dp0\emacs -g 216x69+0+0 %*
@malkia
malkia / wraplib
Created April 1, 2011 13:49
The goal is to wrap the ffi symbols and new ones in one table
local ffi = require( "ffi" )
local function wraplib( lib, options )
local function LOG(...)
if options.verbose then
print(...)
end
end
return setmetatable (
{},
LuaJIT 2.0.0-beta6 -- Copyright (C) 2005-2011 Mike Pall. http://luajit.org/
JIT: ON CMOV SSE2 SSE3 fold cse dce fwd dse narrow loop abc fuse
>
1
2
__index: importing from library <userdata: 0x0004f2e0>
into table <table: 0x0004f398>
the symbol curl_easy_init = cdata<void **()>: 0x00043820
@malkia
malkia / test.cs
Created April 26, 2011 19:39
some test
// x64
//
using System;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
namespace GenericSpeedTest
{
@malkia
malkia / fileinfo.c
Created August 15, 2011 22:41
Low level directory reading on Windows
#include <windows.h>
#include <stdio.h>
// to compile:
// cl fileinfo.c setargv.obj
void fileinfo(const char*name);
int main( int argc, const char* argv[] )
{
int i;
@malkia
malkia / chess.txt
Created August 23, 2011 01:43
chess
8x8
1K
1Q
2r
2k
2b
8p
1+1+2+2+2+8
@malkia
malkia / maglev.c
Created October 3, 2011 17:14
maglev - malkia's GL extension vectors - a very tiny (and not full) glee/gl3w/glew/etc. replacement
// maglev -- malkia's GL extension vectors
// For more complete options, look at:
// GL3W, GLEW and GLEE
//
// Dimiter "malkia" Stanev
// malkia@gmail.com
//
// To use it, just compile it like "cl -c maglev.c", and then link the .obj file with your stuff
//
#define WIN32_LEAN_AND_MEAN 1
@malkia
malkia / fileinfo.c
Created December 16, 2011 18:54
Win32: Reading directory in one kernel call
// Not sure whether it's faster than FindFirstFile, etc. - but it does it in one kernel call
#include <windows.h>
#include <stdio.h>
// to compile:
// cl fileinfo.c setargv.obj
void fileinfo(const char*name);
int main( int argc, const char* argv[] )