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
@riywo
riywo / gist:3877853
Created October 12, 2012 07:53
screenrc
escape ^z^z
bind ^U encoding utf8 utf8
bind ^E encoding eucjp utf8
bind ^S encoding sjis utf8
#bindkey "^[[1;5A" stuff "\015exit\012" ##dengerous...
bindkey "^[[1;5B" screen
bindkey "^[[1;5C" next
bindkey "^[[1;5D" prev
@riywo
riywo / gist:3844251
Created October 6, 2012 06:52
.psgiもperl syntax on vim
:autocmd! BufNewFile,BufRead *.psgi setf perl
access_log:
parser:
format: '/.../'
datacounter:
- count_key: code
pattern1: 2xx ^2\d\d$
pattern2: 3xx ^3\d\d$
pattern3: 4xx ^4\d\d$
pattern4: 5xx ^5\d\d$
tag_prefix: codecount
# tag: test.access_log.HOSTNAME
# record: {"method": "GET", "path": "/hoge", "code": "200"}
<match test.access_log.**>
type forest
subtype groupcounter
<template>
count_key method path code
count_interval 60s
aggregate all
diff --git a/bin/fluent-agent-lite b/bin/fluent-agent-lite
index 129a1c5..b515334 100755
--- a/bin/fluent-agent-lite
+++ b/bin/fluent-agent-lite
@@ -178,12 +178,12 @@ sub build_tail_command {
}
sub open_tail {
- open(my $tailfd, '-|', build_tail_command())
+ my $pid = open(my $tailfd, '-|', build_tail_command())
use strict;
use warnings;
my $pid = open(my $tailfd, '-|', qw/tail -F hogehoge/) or die;
print "$pid\n";
while (1) {
sleep 1;
}
require 'digest/md5'
require 'digest/sha1'
require 'digest/sha2'
require 'murmurhash3'
num = 5
test = 10000
res = {
"md5" => Array.new(num, 0),
"sha1" => Array.new(num, 0),
@riywo
riywo / gist:3506765
Created August 29, 2012 04:15
inrun
#!/usr/bin/perl
use strict;
use warnings;
my $logfile = '/tmp/inrun.log';
open my $log, '>>', $logfile or die;
my $file = $ARGV[0] or failed("need file path");
my $out = `$file 2>&1`;
#!/bin/bash
_sugyan() {
local cur prev
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
COMPREPLY=()
if (( $COMP_CWORD <= 1 )); then
local _list=$(sugyan list command)
#!/bin/bash
_get_kamipo_bin() {
cat <<'EOF' | perl - "${BASH_SOURCE[0]}"
use strict;
use warnings;
use Cwd;
my $path = $ARGV[0] or die;
$path =~ s/^\.\/(.+)$/$1/;
$path = getcwd() . "/$path" if ($path !~ /^\//);