Skip to content

Instantly share code, notes, and snippets.

View args.cgi
#!/usr/bin/perl
use strict;
use Data::Dumper;
print "Content-Type: text/plain\n\n";
print Dumper(\@ARGV);
@fujiwara
fujiwara / bench.rb
Last active Aug 29, 2015
benchmark of fluent-plugin-parser time_parse cache
View bench.rb
#!/usr/bin/env ruby
start = Time.now
`cat access.log.ltsv | fluent-agent-lite accesslog - 127.0.0.1`
puts "elapsed #{(Time.now - start)*1000} ms"
@fujiwara
fujiwara / main.go
Created May 31, 2014
consul-catalogを使って監視しているserviceのNode自体に変更があったことを検知する
View main.go
package main
import (
"encoding/json"
"github.com/mizzy/consul-catalog"
"log"
"os"
"reflect"
"time"
)
@fujiwara
fujiwara / ZabbixAPI.pm
Created Jun 9, 2014
Quick open to Zabbix screen by percol.
View ZabbixAPI.pm
package ZabbixAPI;
use strict;
use warnings;
use Mouse;
use Try::Tiny;
use JSON;
use HTTP::Request::Common;
use LWP::UserAgent;
View zabbix_get_eval.sh
$ zabbix_get_eval.sh system.uname agent.version '[[ $1 =~ "foo" || $2 =~ ^1\.8 ]]'
View result.txt
$ perl s.pl
keys:10000 size:1348738
keys:20000 size:2708562
keys:30000 size:3478562
keys:40000 size:5428210
keys:50000 size:6198210
keys:60000 size:6968210
keys:70000 size:10097506
keys:80000 size:10867506
keys:90000 size:11637506
@fujiwara
fujiwara / arch.txt
Created Jul 2, 2014
stud / HAProxy SSL benchmark
View arch.txt
[ client ] --> [ :8443 stud ] --> [ :8888 haproxy ] ---> [ :80 nginx ]
+---------------------------> [ :9443 haproxy ] -/
@fujiwara
fujiwara / main.go
Created Jul 15, 2014
Listen 80 and drop root privileges Go http server example
View main.go
package main
import (
"net"
"net/http"
"syscall"
"log"
)
func main() {
@fujiwara
fujiwara / Makefile
Last active Aug 29, 2015
benchmark set for packing msgpack (fluentd packed forward)
View Makefile
bench: packedforward test.log extlib
@echo "testing perl"
@cat test.log | PERL5LIB=extlib time perl ./packedforward.pl > /dev/null
@echo "testing go"
@cat test.log | time ./packedforward > /dev/null
check: packedforward test.log extlib
@head -1234 test.log | TIME=1407856567 PERL5LIB=extlib perl ./packedforward.pl | md5sum
@head -1234 test.log | TIME=1407856567 ./packedforward | md5sum
@fujiwara
fujiwara / bench.pl
Created Aug 25, 2014
Data::Validator vs Data::Util
View bench.pl
#!/usr/bin/env perl
use 5.12.1;
use Data::Validator;
use Data::Util;
use Benchmark qw/ :all /;
cmpthese 0, {
"Data::Validator" => sub {
dv(100);
},