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 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++'
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);
2016/12/16 01:01:37 [error] 3153#3153: *1 mrb_run failed: return 500 HTTP status code to client: error: /etc/nginx/conf.d/filter.rb:3: string contains null byte (ArgumentError), client: 10.0.2.2, server: _, request: "GET /filter HTTP/1.1", host: "localhost:20080"
2016/12/15 11:40:34 [error] 4579#4579: *1 mrb_run failed: return 500 HTTP status code to client: error: /etc/nginx/conf.d/nigari.rb:12: string contains null byte (ArgumentError) while sending to client, client: 10.0.2.2, server: _, request: "GET /nigari?4 HTTP/1.1", upstream: "http://127.0.0.1:80/orig?4", host: "localhost:20080"
@yano3
yano3 / server.rb
Last active October 31, 2016 03:28
{
nginx_version: Server::server_version,
mruby_version: MRUBY_VERSION,
ngx_mruby_version: Server::module_version,
}

moved to https://github.com/yano3/kankara/blob/master/elasticsearch/monitoring.md

Monitoring Elasticsearch

APIs

  • Elasticsearch の様子を知るのに便利な様々な API がある。
  • これらを参照する Elasticsearch プラグインや各種モニタリングツール (mackerel, munin, etc.) のプラグインが開発されている。
  • API 間で重複する内容があったり、似ているようで異なるものがあったりするので使い分けに注意。
@yano3
yano3 / about_elasticsearch_cluster.md
Last active September 28, 2020 07:52
Elasticsearch クラスタ概説
@yano3
yano3 / gist:4f0d258f260a30992639
Created December 16, 2015 07:27
brew install elasticsearch
$ brew install elasticsearch                                                                                                                                                                                  (git)-[master]
==> Downloading https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.1.0/elasticsearch-2.1.0.tar.gz
######################################################################## 100.0%
==> Caveats
Data:    /usr/local/var/elasticsearch/elasticsearch_xxxxxxxxxx/
Logs:    /usr/local/var/log/elasticsearch/elasticsearch_xxxxxxxxxx.log
Plugins: /usr/local/Cellar/elasticsearch/2.1.0_1/libexec/plugins/
Config:  /usr/local/etc/elasticsearch/
@yano3
yano3 / gist:9568e6a4f730a04f854b
Created March 25, 2015 03:19
brew install tuntap
$ brew install tuntap
==> Downloading https://homebrew.bintray.com/bottles/tuntap-20111101.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring tuntap-20111101.mavericks.bottle.tar.gz
==> Caveats
In order for TUN/TAP network devices to work, the tun/tap kernel extensions
must be installed by the root user:
sudo cp -pR /usr/local/Cellar/tuntap/20111101/Library/Extensions/tap.kext /Library/Extensions/
sudo cp -pR /usr/local/Cellar/tuntap/20111101/Library/Extensions/tun.kext /Library/Extensions/
@yano3
yano3 / gist:6d5c33bfe9bde4c4e8d7
Created January 6, 2015 10:04
nokogiri on Mac
bundle config build.nokogiri --use-system-libraries
@yano3
yano3 / gist:4a8630946ef7f68c7ac2
Created June 26, 2014 09:11
brew install redis
$ brew install redis
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/redis-2.8.11.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring redis-2.8.11.mavericks.bottle.tar.gz
==> Caveats
To have launchd start redis at login:
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
Then to load redis now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
Or, if you don't want/need launchctl, you can just run: