Skip to content

Instantly share code, notes, and snippets.

@hiroyukim
hiroyukim / fluentd
Created October 30, 2012 06:05 — forked from higebu/fluentd
/etc/init.d/fluentd
#!/bin/bash
PID_FILE=/var/run/fluentd.pid
CONF_FILE=/etc/fluent/fluent.conf
LOG_FILE=/var/log/fluent/fluent.log
PSNAME="fluentd --daemon"
F_USER=fluentd
F_GROUP=fluentd
RUBY_VER="1.9.3-p194"
@hiroyukim
hiroyukim / Handler.pm
Created January 31, 2012 15:12 — forked from riywo/Handler.pm
Amon2::Plugin::DBIx::Handler
use strict;
use warnings;
use utf8;
package Amon2::Plugin::DBIx::Handler;
use DBIx::Handler;
sub init {
my ($class, $context_class, $config) = @_;
class Object
def send_through(object, *args)
object.dispatcher_for(self).call(self, *args)
end
end
module Dispatcher
class DispatcherNotFound < StandardError; end
def self.extended(klass)
@hiroyukim
hiroyukim / g91dl.rb
Created August 24, 2009 02:17 — forked from sorah/g91dl.rb
#!/usr/bin/ruby
#-*- coding: utf-8 -*-
require "rubygems"
require "mechanize"
require "hatenaauth.rb"
require "cgi"
####config
params = {
:api_key => "ここにapiキー",
:secret => "ここに秘密鍵"
#日本語用 形態素解析もどき
#http://ablog.seesaa.net/article/24578324.html
#を移植したものです。とりあえずライセンスは、Creative commonsの表示で。商用利用OKですが、自分の名前を明記してください。
#クレジット:sorah 感謝:http://ablog.seesaa.net/article/24578324.html
#str=形態素解析したい文字列(日本語のみ)
#返却するのは分割された配列。
def morphAnalyzer(str)
s = str.gsub(/([一-龠々〆ヵヶ]+|[ぁ-ん]+|[ァ-ヴー]+|[a-zA-Z0-9]+|[a-zA-Z0-9]+|[,.、。!!??()()「」『』]+|[  ]+)/,"\\1|")
ary = s.split("|")
// TARGET.pid のファイルを削除で終了
if ( WScript.Count == 0 ) {
WScript.Echo("対象ファイルをD&Dしてください");
WScript.Quit();
}
var TARGET = WScript.Arguments(0);
// バックアップするかチェックする間隔(ミリ秒)
var PERIOD = 60 * 1000;
var AutoBackup = {