Skip to content

Instantly share code, notes, and snippets.

View yteraoka's full-sized avatar

Yoshinori Teraoka yteraoka

View GitHub Profile
#!/home/ytera/ruby-2.1.0/bin/ruby

require 'csv'
require 'json'
require 'net/http'
require 'uri'

indexname = 'ldgourmet'
documentname = 'restaurant'

Erlang メモ

飛行機本 を読みながらのメモ

install

$ sudo apt-get install xsltproc fop libssl-dev
$ sudo apt-get install openjdk-7-jdk unixodbc-dev
$ curl -O http://download.basho.co.jp.cs-ap-e1.ycloud.jp/otp/download/otp_src_R16B03.tar.gz
@yteraoka
yteraoka / ansible-tutorial-memo.md
Last active December 30, 2015 16:49
Ansible Tutorial 更新メモ
vagrant init bento-centos65 http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box
cd /var/tmp
git clone https://github.com/tagomoris/xbuild.git
sudo yum install bzip2-devel sqlite-devel
sudo xbuild/python-install 2.7.6 /opt/python-2.7
sudo /opt/python-2.7/bin/pip install ansible
@yteraoka
yteraoka / tameshitai.md
Last active December 29, 2015 15:49
試したいものリスト
  • Sentry
  • Zabbix
  • collectd
  • tuned
  • Serf
  • systemd
  • Docker
  • pgtune
  • Ganglia
  • statsd
  NAME
    setmaxmem - change maximum memory limit

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

  DESCRIPTION
    Change the maximum memory allocation limit in the guest domain.

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
@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.
@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 / 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

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

local var = "hogehoge"

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