Skip to content

Instantly share code, notes, and snippets.

@crimsonwoods
crimsonwoods / fib39_mt.rb
Created April 19, 2014 05:53
perform fib39 concurrently
# Fib 39
def fib n
return n if n < 2
fib(n-2) + fib(n-1)
end
t1 = Thread.new do
fib(39)
end
@crimsonwoods
crimsonwoods / LGL25_Fx0_config.txt
Created December 29, 2014 13:12
Kernel configuration for LGL25 named as Fx0
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 3.4.0 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_ARM_HAS_SG_CHAIN=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
CONFIG_GENERIC_CLOCKEVENTS=y
@crimsonwoods
crimsonwoods / build_config.rb
Created February 20, 2015 09:07
Sample build script for custom mruby based on "1.1.0" (multi-threading supported version)
MRuby::Build.new do |conf|
# load specific toolchain settings
# Gets set by the VS command prompts.
if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
toolchain :visualcpp
else
toolchain :gcc
end
@crimsonwoods
crimsonwoods / hmidump.c
Created October 12, 2012 08:07
dump HMI
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <dlfcn.h>
#include <unistd.h>
#include <stdint.h>
struct hw_module_t;
struct hw_device_t;
@crimsonwoods
crimsonwoods / mruby_alloc_debug.patch
Created April 13, 2013 08:43
A path to add debug information to mruby memory allocation.
diff --git build_config.rb build_config.rb
index 424f9d0..890173a 100644
--- build_config.rb
+++ build_config.rb
@@ -59,7 +59,8 @@ MRuby::Build.new do |conf|
# C compiler settings
- # conf.cc do |cc|
+ conf.cc do |cc|
ALLOCATE: 0x24f9010 1216 state.c 29 (mrb_open_allocf)
ALLOCATE: 0x24f94e0 49200 gc.c 306 (add_heap)
ALLOCATE: 0x2505520 64 symbol.c 35 (kh_init_n2s_size)
ALLOCATE: 0x2505570 8 symbol.c 35 (kh_alloc_n2s)
ALLOCATE: 0x2505590 512 symbol.c 35 (kh_alloc_n2s)
ALLOCATE: 0x25057a0 64 symbol.c 35 (kh_alloc_n2s)
ALLOCATE: 0x25057f0 64 class.c 18 (kh_init_mt_size)
ALLOCATE: 0x2505840 8 class.c 18 (kh_alloc_mt)
ALLOCATE: 0x2505860 64 class.c 18 (kh_alloc_mt)
ALLOCATE: 0x25058b0 256 class.c 18 (kh_alloc_mt)
@crimsonwoods
crimsonwoods / mruby_leak_detection.patch
Created April 13, 2013 16:47
a patch to add memory leak detection.
diff --git src/state.c src/state.c
index 0b6c755..528143e 100644
--- src/state.c
+++ src/state.c
@@ -55,17 +55,124 @@ filename(char const *path)
}
return path;
}
+
+typedef struct alloc_header_t {
@crimsonwoods
crimsonwoods / mruby-uv-fix-memory-corruption.patch
Last active December 20, 2015 01:09
This patch fixes memory corruption in mruby-uv.
diff --git a/src/mrb_uv.c b/src/mrb_uv.c
index b7d16d2..46d2620 100644
--- a/src/mrb_uv.c
+++ b/src/mrb_uv.c
@@ -1230,7 +1230,8 @@ _uv_getaddrinfo_cb(uv_getaddrinfo_t* req, int status, struct addrinfo* res)
c = mrb_class_new_instance(mrb, 0, NULL, _class_uv_addrinfo);
mrb_iv_set(mrb, c, mrb_intern(mrb, "context"), mrb_obj_value(
Data_Wrap_Struct(mrb, mrb->object_class,
- &uv_addrinfo_type, (void*) res)));
+ &uv_addrinfo_type, (void*) addr)));
@crimsonwoods
crimsonwoods / kosenconf-100tokyoの交通費等支援の募集要項.md
Last active December 21, 2015 15:26
Kosenconf-100tokyoの交通費等支援の募集要項

KCFunds ってなに?

高専カンファレンスとお酒が大好きな人達がはじめた個人的なプロジェクトです。KCFundsでは、経済的困難などの問題により、関東での高専カンファレンスに参加できない学生さんを支援します。

更新情報

  • 第一回目の応募を締め切りました。
  • 第二回目の応募も締め切りました。
  • 高専カンファレンス100 in 東京は無事に終了いたしました。
@crimsonwoods
crimsonwoods / setup_jamruby.sh
Created September 14, 2013 01:46
build script for jamruby.
#!/bin/bash
GITHUB_URL_JAMRUBY=git@github.com:jamruby/jamruby.git
GITHUB_URL_JAMRUBYAPP=git@github.com:jamruby/JamrubyApp.git
GITHUB_URL_MRUBY=https://github.com/mruby/mruby.git
JAMRUBY_MRUBY_BUILD_CONFIG=jamruby_build_config.rb
UPDATE_REPOSITORIES=0
ANDROID_TARGET_JAMRUBY=`cat jamruby/project.properties | grep -P "target\s*\=\s*android\-" | sed -e "s/target\=\(.*\)/\\1/"`
ANDROID_TARGET_JAMRUBYAPP=`cat JamrubyApp/project.properties | grep -P "target\s*\=\s*android\-" | sed -e "s/target\=\(.*\)/\\1/"`