Skip to content

Instantly share code, notes, and snippets.

View yano3's full-sized avatar
❄️
NO SNOW, NO LIFE.

Teppei Yano yano3

❄️
NO SNOW, NO LIFE.
View GitHub Profile
diff --git src/http/ngx_http_mruby_filter.c src/http/ngx_http_mruby_filter.c
index 91e8e00..e90642d 100644
--- src/http/ngx_http_mruby_filter.c
+++ src/http/ngx_http_mruby_filter.c
@@ -34,7 +34,7 @@ static mrb_value ngx_mrb_set_filter_body(mrb_state *mrb, mrb_value self)
body = mrb_funcall(mrb, body, "to_s", 0, NULL);
}
- ctx->body = (u_char *)mrb_str_to_cstr(mrb, body);
+ ctx->body = (u_char *)RSTRING_PTR(body);
diff --git a/build_config.rb b/build_config.rb
index 13751f2..9faddba 100644
--- a/build_config.rb
+++ b/build_config.rb
@@ -8,6 +8,10 @@ MRuby::Build.new('host') do |conf|
cc.flags << ENV['NGX_MRUBY_CFLAGS'] if ENV['NGX_MRUBY_CFLAGS']
end
+ conf.linker do |linker|
+ linker.option_library << ' -lstdc++'
==> Downloading https://homebrew.bintray.com/bottles/bison-3.0.4.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring bison-3.0.4.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
Some formulae require a newer version of bison.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
@yano3
yano3 / gist:aea70b83a7789479839de0b4c12d7d71
Created February 2, 2017 03:52
brew install docker-machine-driver-xhyve
This driver requires superuser privileges to access the hypervisor. To
enable, execute
sudo chown root:wheel /usr/local/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chmod u+s /usr/local/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
@yano3
yano3 / fix_vboxsf.md
Created October 4, 2017 06:09
fix vboxsf error when updating kernal
sudo /opt/VBoxGuestAdditions-5.0.16/init/vboxadd setup

on older box

sudo /etc/init.d/vboxadd setup
$ gcc -c -fPIE -fPIC fuga.c -v
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
COLLECT_GCC_OPTIONS='-c' '-fPIC' '-v' '-mtune=generic' '-march=x86-64'
$ gcc -c -fPIE -fPIC fuga.c -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
COLLECT_GCC_OPTIONS='-c' '-fPIE' '-fPIC' '-v' '-mtune=generic'
 /usr/libexec/gcc/x86_64-redhat-linux/4.4.7/cc1 -quiet -v fuga.c -quiet -dumpbase fuga.c -mtune=generic -a
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -g -O2 -fdebug-prefix-map=/usr/local/src/nginx-1.13.10=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC -I src/c
ore -I src/event -I src/event/modules -I src/os/unix -I /usr/local/src/ngx_mruby/mruby/src -I /usr/local/src/ngx_mruby/mruby/include -I -g -I -std=gnu99 -I -O3 -I -Wall -I -Werror-implicit-function-declaration -I -Wdeclaration-after-statement -I -Wwrite-strings -I -fPIE -
I -I/usr/local/src/ngx_mruby/mruby/include -I -I/usr/local/src/ngx_mruby/mruby/build/mrbgems/mruby-pointer/include -I -I/usr/local/include -I /usr/local/src/ngx_mruby/dependence/ngx_devel_kit/objs -I objs/addon/ndk -I objs -I src/http -I src/http/modules -I src/http/v2 -I
/usr/local/src/ngx_mruby/dependence/ngx_devel_kit/src -I src/mail -I src/stream \
convert orig_2560_1280.png -alpha activate -virtual-pixel transparent -distort arc "32 0 5000 3773" out.png
==> Caveats
You need to manually run setup_dirs to create directories required by nodebrew:
/usr/local/opt/nodebrew/bin/nodebrew setup_dirs
Add path:
export PATH=$HOME/.nodebrew/current/bin:$PATH
To use Homebrew's directories rather than ~/.nodebrew add to your profile:
export NODEBREW_ROOT=/usr/local/var/nodebrew