Skip to content

Instantly share code, notes, and snippets.

@netmarkjp
netmarkjp / gist:1795838
Created February 11, 2012 03:39
fluentd output error and exit loop
2012-02-11 12:29:47 +0900: plugin/in_tail.rb:65:rescue in run: unexpected error error="\"\\xE3\" from ASCII-8BIT to UTF-8"
2012-02-11 12:29:47 +0900: plugin/in_tail.rb:66:rescue in run: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.6/lib/fluent/plugin/out_file.rb:72:in `encode'
2012-02-11 12:29:47 +0900: plugin/in_tail.rb:66:rescue in run: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.6/lib/fluent/plugin/out_file.rb:72:in `to_json'
2012-02-11 12:29:47 +0900: plugin/in_tail.rb:66:rescue in run: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.6/lib/fluent/plugin/out_file.rb:72:in `format'
2012-02-11 12:29:47 +0900: plugin/in_tail.rb:66:rescue in run: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.6/lib/fluent/output.rb:420:in `block in emit'
2012-02-11 12:29:47 +0900: plugin/in_tail.rb:66:rescue in run: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.6/lib/fluent/event.rb:107:in `call'
2012-02-11 12:29:47 +0900: plugin/in_tail.rb:
@netmarkjp
netmarkjp / gist:1796717
Created February 11, 2012 05:29
Exceded maximum insert size of 16,000,000 bytes
installed version
----------------------
fluent-plugin-mongo (0.6.3)
fluent-plugin-td (0.10.2)
td-agent.conf
----------------
<match dak.app>
type mongo
@netmarkjp
netmarkjp / gist:1798102
Created February 11, 2012 09:15
td-agent
install
------------
yum -y install td-agent
/usr/lib64/fluent/ruby/bin/fluent-gem update fluentd
/usr/lib64/fluent/ruby/bin/fluent-gem update fluent-plugin-mongo
/usr/lib64/fluent/ruby/bin/fluent-gem install bson_ext
@netmarkjp
netmarkjp / gist:2881651
Created June 6, 2012 12:53
fluentd qmail log parser(tcpserver)
<source>
type tail
format /^(?<time>[^ ]* *[^ ]* [^ ]*) (?<host>[^ ]*) qmail: (?<unixtime>[^ ]*) (?<event>[^ ]*) msg (?<msg>[^ ]*)$/
time_format %b %d %H:%M:%S
path /tmp/maillog
pos_file /tmp/fluentd.pos.1
tag maillog.qmail
</source>
<source>
@netmarkjp
netmarkjp / gist:2910399
Created June 11, 2012 14:41
Emacs24.1 Compilation on MacOSX(Snow Lepard)
curl -O http://ftp.jaist.ac.jp/pub/GNU/emacs/emacs-24.1.tar.gz
tar zxf emacs-24.1.tar.gz
cd emacs24.1
./configure --with-ns --without-x
make bootstrap
make install
mv /Applications/Emacs.app ~/Desktop/.
cp -rp nextstep/Emacs.app /Applications/.
@netmarkjp
netmarkjp / gist:3279296
Created August 6, 2012 23:02
idm2keepassx.rb error
/Users/baba/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/rexml/parsers/treeparser.rb:95:in `rescue in parse': #<REXML::ParseException: No close tag for /idmData/folder[4]/folder[5]/folder[2]/folder[2]/item/comment> (REXML::ParseException)
/Users/baba/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/rexml/parsers/treeparser.rb:28:in `parse'
/Users/baba/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/rexml/document.rb:230:in `build'
/Users/baba/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/rexml/document.rb:43:in `initialize'
/Users/baba/bin/idm2keepassx.rb:13:in `new'
/Users/baba/bin/idm2keepassx.rb:13:in `initialize'
/Users/baba/bin/idm2keepassx.rb:96:in `new'
/Users/baba/bin/idm2keepassx.rb:96:in `<main>'
...
No close tag for /idmData/folder[4]/folder[5]/folder[2]/folder[2]/item/comment
sed 's/encoding="shift-jis"/encoding="cp932"/' in.xml | idm2keepassx.rb >out.xml
@netmarkjp
netmarkjp / screenshot.py
Created September 14, 2012 14:46
screenshot by selenium
#!/usr/bin/env python
#coding: utf-8
import selenium
from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
def main():
profile=FirefoxProfile()
profile.set_preference("general.useragent.override",
@netmarkjp
netmarkjp / gist:3958509
Created October 26, 2012 12:32
code template for EBean ORM (PlayFramework2) [Eclipse > Editor > Template]
public static Finder <${id_class:var}, ${enclosing_type}> find = new Finder<${id_class}, ${enclosing_type}>(${id_class}.class,${enclosing_type}.class);
@netmarkjp
netmarkjp / gist:3962597
Created October 27, 2012 01:34
code template for WS HTTP call (PlayFramework2) [Eclipse > Editor > Template]
return async(play.libs.WS
.url(${var:url})
.get()
.map(new play.libs.F.Function<play.libs.WS.Response, play.mvc.Result>() {
public play.mvc.Result apply(play.libs.WS.Response response) {
return TODO;
}
}));