Skip to content

Instantly share code, notes, and snippets.

View remogatto's full-sized avatar

Andrea Fazzi remogatto

View GitHub Profile
package z80
import (
"container/vector"
"fmt"
)
/* The flags */
const FLAG_C = 0x01
@remogatto
remogatto / gist:425217
Created June 4, 2010 09:42
PI parallel computation
// Parallel algorithm for PI calculation
//
// Sources of inspiration:
//
// * https://computing.llnl.gov/tutorials/parallel_comp/#ExamplesPI
// * http://dos.iitm.ac.in/Vishwa/GCCourse/suneetha/picalc.html
//
// Thanks to aht for fixing the random generator issue:
// http://groups.google.com/group/golang-nuts/browse_thread/thread/f5c12ca69b46a931
package makengo
import (
"os"
"exec"
"bytes"
"io"
"strings"
)
[random:uniform(2) - 1 || X <- lists:seq(1,10)].
require 'rubygems'
require 'ffi'
class Info
extend FFI::Library
BOOT_TIME = 2
attach_function :setutxent, [], :void
attach_function :getutxent, [], :pointer
require 'ffi-inliner'
module MyLib
extend Inliner
inline <<-c
void say_hello(char* name) { printf("Hello, %s\n", name); }
c
end
MyLib.say_hello('boys')
module H5
extend FFI::Library
H5_CLEAR_MEMORY = 1
H5_CONVERT_DENORMAL_FLOAT = 1
H5_DEV_T_IS_SCALAR = 1
H5_FP_TO_INTEGER_OVERFLOW_WORKS = 1
H5_FP_TO_ULLONG_ACCURATE = 1
H5_GETTIMEOFDAY_GIVES_TZ = 1
H5_HAVE_ALARM = 1
# This binding is generated against libSDL 1.2.13 headers.
require 'rubygems'
require 'ffi'
module SDL
extend FFI::Library
ffi_lib "/usr/local/lib/libSDL.so"
SDL_INIT_TIMER = 0x00000001
SDL_INIT_AUDIO = 0x00000010
module GL
extend FFI::Library
ffi_lib '/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib'
end
module GLU
extend FFI::Library
ffi_lib '/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib'
end
module GLUT
extend FFI::Library
require 'rubygems'
require 'nokogiri'
@indent = ' ' * 2
@typedefs = {}
doc = Nokogiri::XML(File.open(ARGV[0]))
def get_symname(node)
node.xpath("attributelist/attribute[@name='sym_name']").first['value']