This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Apache.rputs("hello mod_mruby world!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb)); | |
| mrb_gc_arena_restore(mrb, ai); | |
| if (mrb->exc) | |
| ap_mrb_raise_file_error(mrb, mrb_obj_value(mrb->exc), r, mruby_code_file); | |
| (snip) | |
| mrb->irep_len = n; | |
| if (!(mrb->irep[n]->flags & MRB_ISEQ_NO_FREE)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $cat mrbgems/g/mruby-zabbix/example/zabbix-api-client.rb | |
| config = { | |
| :url => "http://127.0.0.1/zabbix/api_jsonrpc.php", | |
| :ua => "mruby-zabbix", | |
| :user => "api-admin", | |
| :pass => "api-admin", | |
| } | |
| z = Zabbix::Client.new(config) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set -e | |
| git clone git://github.com/mruby/mruby.git | |
| cd mruby/mrbgems/g/ | |
| git clone git://github.com/mattn/mruby-uv.git | |
| git clone git://github.com/mattn/mruby-http.git | |
| git clone git://github.com/mattn/mruby-json.git | |
| git clone git://github.com/matsumoto-r/mruby-redis.git | |
| git clone git://github.com/matsumoto-r/mruby-simplehttp.git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // gcc -o uv_resolv uv_resolv.c -luv -lpthread -ldl -lrt -lm | |
| // | |
| #include <uv.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| uv_loop_t *loop; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| desc "view mruby-config" | |
| task :view_mruby_config do | |
| all_mruby_libs, all_mruby_ldflags, all_mruby_cflags, all_mruby_includes = [], [], [], [] | |
| MRuby.targets.each do |t| | |
| t.gems.map do |g| | |
| all_mruby_libs << g.mruby_libs | |
| all_mruby_ldflags << g.mruby_ldflags | |
| all_mruby_cflags << g.mruby_cflags | |
| all_mruby_includes << g.mruby_includes | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CONSUMER_KEY = '' | |
| CONSUMER_SECRET = '' | |
| ACCESS_TOKEN = '' | |
| ACCESS_TOKEN_SECRET = '' | |
| GET_API_URL = 'http://api.twitter.com/1/statuses/home_timeline.json?count=' | |
| tweet_num = 10 | |
| interval = 60 | |
| twitter = OAuth.new(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| c = Capability.new | |
| cap = [Capability::CAP_SETUID, Capability::CAP_SETGID] | |
| c.set Capability::CAP_PERMITTED, cap | |
| pid = Process.fork { | |
| loop do | |
| c.get_proc | |
| c.set Capability::CAP_EFFECTIVE, cap | |
| sleep 2 | |
| uid = Random::rand 1000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // gcc -lmicrohttpd mhd.c | |
| // | |
| #include <string.h> | |
| #include <sys/types.h> | |
| #include <sys/select.h> | |
| #include <sys/socket.h> | |
| #include <microhttpd.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Flat profile: | |
| Each sample counts as 0.01 seconds. | |
| % cumulative self self 合計 | |
| time seconds seconds calls ms/call ms/call 名前 | |
| 78.45 43.33 43.33 385 112.55 126.32 mrb_run | |
| 5.08 46.13 2.81 204668409 0.00 0.00 kh_get_mt | |
| 4.16 48.44 2.30 204668365 0.00 0.00 mrb_method_search_vm | |
| 4.06 50.68 2.25 mrb_class | |
| 3.50 52.62 1.94 cipush |