Skip to content

Instantly share code, notes, and snippets.

View yteraoka's full-sized avatar

Yoshinori Teraoka yteraoka

View GitHub Profile
@yteraoka
yteraoka / file0.txt
Created August 30, 2013 10:42
ttyrec でターミナルの録画・再生 ref: http://qiita.com/yteraoka/items/ea85f094f7c934e78e11
$ sudo yum -y install compat-glibc-headers
$ git clone git://git.kitenet.net/ttyrec.git
$ cd ttyrec
$ make CFLAGS="-DSVR4 -D_XOPEN_SOURCE=500 -I/usr/lib/x86_64-redhat-linux5E/include"
@yteraoka
yteraoka / NG
Created September 9, 2013 14:46
Ansible の YAML で「:」を使う方法 ref: http://qiita.com/yteraoka/items/2afaa39d0635c7af1de4
- lineinfile: >
regexp='^%wheel'
line='%wheel ALL=(ALL) NOPASSWD: ALL'
dest=/etc/sudoers
@yteraoka
yteraoka / httpd.conf.j2
Created September 9, 2013 14:57
Ansible のテンプレート(Jinja2)で部分的にテンプレート処理を無効にする ref: http://qiita.com/yteraoka/items/a9b1fd6a5d76817530fe
{% raw %}
LogFormat "\
host:%h\t\
time:%{%Y-%m-%d %H:%M:%S}t\t\
method:%m\t\
uri:%U%q\t\
protocol:%H\t\
status:%>s\t\
referer:%{Referer}i\t\
user-agent:%{User-Agent}i\t\

デフォルトで変数のスコープは Global であるため、 perl の my のように local 宣言しましょう。

local var = "hogehoge"

文字列はダブルクオートが必要

@yteraoka
yteraoka / bench.rb
Last active December 25, 2015 03:39
in_tail_asis とか in_tail の none parser で読み込んだ FortiGate の syslog を parse する。 FortiGate のログは項目が多いので keys か remove_keys で必要なものだけに絞る。 loop で gsub! するのは非常に重いので書き直した。
require 'benchmark'
lines = []
f = open(ARGV[0])
while line = f.gets
lines.push line.chomp
break
end
f.close
@yteraoka
yteraoka / fluentd-plugin-fortigate-csv-parser.rb
Created October 18, 2013 15:17
FortiGate の CSV format な syslog を parse する fluentd plugin
module Fluent
class FortigateSyslogParseOutput < Output
Fluent::Plugin.register_output('forti_log_parser', self)
config_param :remove_prefix, :string, :default => nil
config_param :add_prefix, :string, :default => nil
config_param :message_key, :string, :default => 'message'
config_param :keys, :string, :default => nil
config_param :remove_keys, :string, :default => nil
@yteraoka
yteraoka / gist:7082511
Last active December 26, 2015 02:59
Ansible の fact を mongodb に突っ込んでみる
起動
sudo service mongodb start
$ mongo
MongoDB shell version: 2.4.6
connecting to: test
Welcome to the MongoDB shell.

Windows でアプリの IdentifyingNumber を探

> Get-WmiObject Win32_Product | Where-object {$_.Name -match "Skype"}

IdentifyingNumber : {1845470B-EB14-4ABC-835B-E36C693DC07D}
Name              : Skype™ 6.9
Vendor            : Skype Technologies S.A.
Version           : 6.9.106
Caption           : Skype™ 6.9
  NAME
    setmaxmem - change maximum memory limit

  SYNOPSIS
    setmaxmem <domain> <size> [--config] [--live] [--current]

  DESCRIPTION
    Change the maximum memory allocation limit in the guest domain.
@yteraoka
yteraoka / tameshitai.md
Last active December 29, 2015 15:49
試したいものリスト
  • Sentry
  • Zabbix
  • collectd
  • tuned
  • Serf
  • systemd
  • Docker
  • pgtune
  • Ganglia
  • statsd