Skip to content

Instantly share code, notes, and snippets.

View riywo's full-sized avatar
🏈
Go 49ers!

Ryosuke Iwanaga riywo

🏈
Go 49ers!
View GitHub Profile
http {
map $uri $backend_port {
hostnames;
include port_map;
}
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
@riywo
riywo / gist:1681604
Created January 26, 2012 07:56
llinstallとllenvでikachan入れる
$ curl -kL https://raw.github.com/riywo/App-llenv/master/llenv-install | bash
and add your .bashrc or something
export LLENV_ROOT=$HOME/llenv
export LLENV_OSTYPE=`$LLENV_ROOT/bin/ostype`
export PATH=$LLENV_ROOT/bin:$PATH
$ llinstall init perl
$ llinstall install perl perl-5.14.2
@riywo
riywo / Handler.pm
Created January 31, 2012 13:57
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) = @_;
@riywo
riywo / gist:1780661
Created February 9, 2012 15:25
fluent-plugin-statの出力
{
"hostname":"ga910",
"stats":{
"cpu":{
"cpu":{"user":0,"nice":0,"system":2,"idle":400,"iowait":0,"irq":0,"softirq":0,"steal":0,"guest":0},
"cpu0":{"user":0,"nice":0,"system":0,"idle":100,"iowait":0,"irq":0,"softirq":0,"steal":0,"guest":0},
"cpu1":{"user":0,"nice":0,"system":1,"idle":98,"iowait":0,"irq":0,"softirq":0,"steal":0,"guest":0},
"cpu2":{"user":0,"nice":0,"system":1,"idle":100,"iowait":0,"irq":0,"softirq":0,"steal":0,"guest":0},
"cpu3":{"user":0,"nice":0,"system":0,"idle":101,"iowait":0,"irq":0,"softirq":0,"steal":0,"guest":0}
},
@riywo
riywo / fluentd.conf
Created February 10, 2012 16:30
fluentd-0.10.10のsymlinkの通知タイミングが微妙
<source>
type tail
format /^(?<test>.*)$/
path /tmp/real
tag debug.real
pos_file /tmp/real_pos
</source>
<source>
type tail
@riywo
riywo / log
Created February 10, 2012 17:25
libevでsymlink先の変更が通知されない
$ perl test.pl &
$ echo aaa >> /tmp/real
$ /tmp/real has changed somehow.
$
$ echo aaa >> /tmp/symlink
$ /tmp/real has changed somehow.
@riywo
riywo / td-agent.spec
Created March 14, 2012 05:48
td-agentのspec for cents4
if [ -d "/etc/prelink.conf.d/" ]; then
echo "prelink detected. Installing /etc/prelink.conf.d/td-agent-ruby.conf ..."
cp -f /etc/td-agent/prelink.conf.d/td-agent.conf /etc/prelink.conf.d/td-agent-ruby.conf
elif [ $(grep '\-b /usr/lib{,64}/fluent/ruby/bin/ruby' -c /etc/prelink.conf) -eq 0 ]; then
echo "prelink detected, but /etc/prelink.conf.d/ don't exist. Adding /etc/prelink.conf..."
echo "-b /usr/lib{,64}/fluent/ruby/bin/ruby" >> /etc/prelink.conf
fi
@riywo
riywo / make-rpm.sh
Created March 15, 2012 15:28
fluent-agent-liteのrpm作るだけのshell
#!/bin/sh
if [ -z "$1" ]; then
echo "usage: ./make-rpm.sh 0.2"
exit 1
fi
version=$1
cur=`pwd`
rm -f fluent-agent-lite.v$version.tar.gz
rm -fr fluent-agent-lite
@riywo
riywo / comp.py
Created March 16, 2012 14:49
rpmのバージョン比較
#!/usr/bin/python
import sys
import yum
#ruby-1.8.5-24.el5.x86_64
pkg1 = ('ruby', 'x86_64', 0, '1.8.5', '24.el5')
#ruby-1.8.5-5.el5_4.8.x86_64
pkg2 = ('ruby', 'x86_64', 0, '1.8.5', '5.el5_4')
print yum.bestPackage(pkg1, pkg2)
#!/usr/bin/env perl
use strict;
use warnings;
use DBIx::QueryLog::Fluent;
#DBIx::QueryLog::Fluent->logger(
# host => "127.0.0.1",
# port => 22422,
#);