Skip to content

Instantly share code, notes, and snippets.

@xxuejie
xxuejie / rubykaigi.scss
Created May 27, 2013 13:38
Reveal.js template for Rubykaigi 2013. The design credit belongs to Rubykaigi 2013 Team
/**
* A simple theme for reveal.js presentations, similar
* to the default theme. The accent color is darkblue.
*
* This theme is Copyright (C) 2012 Owen Versteeg, https://github.com/StereotypicalApps. It is MIT licensed.
* reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se; so is the theme - beige.css - that this is based off of.
*/
// Default mixins and settings -----------------
@xxuejie
xxuejie / clang.out
Created May 14, 2013 07:00
va_arg bug
$ clang vatest.c
$ ./a.out
Type is 0
Value is 5
Type is 1
Value is 12
Type is 2
Value is 19
Type is 3
Value is 26
Entering: _mrb_run: 104,5521416,5666064,1484
Calling setjmp in run curr: 0x400, prev: (nil)!
Entering: _stack_extend: 5521416,5,5
Exiting: _stack_extend
Entering: _mrb_realloc: 5521416,0,44
Entering: _allocf: 5521416,0,44,0
Entering: _realloc: 0,44
Entering: _malloc: 44
Exiting: _malloc
Exiting: _realloc
@xxuejie
xxuejie / clang.out
Created January 18, 2013 02:53
__builtin_bswap64 bug
$ clang swap64.c
$ ./a.out
72057594037927936
@xxuejie
xxuejie / asmjs-test.c
Created January 1, 2013 18:24
Module.ccall also does not work in asm.js
#include <stdio.h>
#include <emscripten/emscripten.h>
int EMSCRIPTEN_KEEPALIVE c_func_calling_from_js() {
printf("This is a c function calling from js!");
return 0;
}
@xxuejie
xxuejie / asmjs-test.c
Created January 1, 2013 18:19
js->c calling bugs in ASM_JS mode
#include <stdio.h>
#include <emscripten/emscripten.h>
void EMSCRIPTEN_KEEPALIVE c_func_calling_from_js() {
printf("This is a c function calling from js!");
}
extern void js_func();
$ # testing syro
$ wrk -t12 -c400 -d30s http://127.0.0.1:9292/foo/bar
Running 30s test @ http://127.0.0.1:9292/foo/bar
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 186.63ms 75.95ms 712.69ms 71.36%
Req/Sec 58.40 66.78 280.00 79.20%
16025 requests in 30.09s, 2.81MB read
Socket errors: connect 0, read 310, write 0, timeout 0
Requests/sec: 532.63
@xxuejie
xxuejie / cc.rb
Created December 12, 2012 17:54
wrapper for creating node-powered js "binaries" with emcc
#!/usr/bin/env ruby
# %% -*- ruby -*-
# This script adds a wrapper to emcc: when the value of -o option is an
# executable file without extensions(such as mrbc), we would first use
# emcc to generate a .js file, then adds a "#!/usr/bin/env node" line at
# the top, finally removes the extension and mark the file mode as
# executable to pretend creating a binary file.
WEBRUBY_ROOT = File.join(File.dirname(__FILE__), '..')
@xxuejie
xxuejie / clang-O2.out
Created December 8, 2012 23:27
setjmp testcase compiled with -O2 option
$ clang -O2 setjmp-twice.c
$ ./a.out
Normal execution path of first function!
Exception execution path of first function!
Exception execution path of first function!
Calling longjmp the second time!
@xxuejie
xxuejie / clang.out
Created December 8, 2012 03:37
Cannot call longjmp twice on the same jmp_buf
$ clang setjmp-twice.c
$ ./a.out
Normal execution path of first function!
Exception execution path of first function!
Exception execution path of first function!
Calling longjmp the second time!