Skip to content

Instantly share code, notes, and snippets.

@gzmask
gzmask / gist:1001404
Created May 31, 2011 22:21
crash without warning
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main() {
string xbn_filename;
string line_str;
string block_str;
// this function happens on the thread pool
// doing v8 things in here will make bad happen.
static int DoSomething (eio_req *req) {
struct simple_request * sr = (struct simple_request *)req->data;
//sleep(2); // just to make it less pointless to be async.
//req->result = sr->x + sr->y;
req->result = bayesian_test(sr->x, sr->y, sr->name);
return 0;
}
ips = Array.new
ips.push '192.168.13.201'
ips.push '192.168.13.202'
ips.push '192.168.13.206'
ips.push '192.168.13.205'
ips.push '192.168.13.211'
ips.push '192.168.13.209'
ips.push '192.168.13.210'
ips.push '192.168.13.217'
ips.push '192.168.13.216'
@gzmask
gzmask / Makefile
Created March 11, 2010 21:18
OpenGL cross platform makefile
# Linux (default)
EXE = hello
LDFLAGS = -lGL -lGLU -lglut
# Windows (cygwin)
ifeq ($(OS), "Windows_NT")
EXE = hello.exe
LDFLAGS = -lopengl32 -lglu32 -lglut32
endif
@gzmask
gzmask / Each.go
Created February 25, 2010 20:59 — forked from divoxx/gist:315024
each function
package main;
import "fmt"
func Each(arr []int, iterator func(int)) {
for i := range arr {
iterator(i)
}
}
@gzmask
gzmask / file_Read.go
Created February 25, 2010 16:19
golang strange syntax errors
package main
import "fmt"
import "os"
func main() {
file, _ := os.Open("list.txt", os.O_RDWR, 0644)
var b [40000] byte
file.Read(&b)
fmt.Print(len(&b))
@gzmask
gzmask / Chrome.html
Created February 25, 2010 15:29
Chrome src vs firefox src
<html>
<head>
<title></title>
<style type="text/css">
<!--
.Style1 {
font-family: "Courier New", Courier, mono;
font-size: small;
}
-->