Skip to content

Instantly share code, notes, and snippets.

Kenji Naito kenjiskywalker

Block or report user

Report or block kenjiskywalker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kenjiskywalker
kenjiskywalker / consul-template.md
Last active Aug 29, 2015
consul-templateで全てのserviceを表示する
View consul-template.md
  • /etc/hosts.ctmpl
{{range services}}
{{range service .Name}}
{{.Address}} {{.Name}}{{end}}{{end}}
  • /etc/hosts
View consul.md
  • command ./consul-template_0.6.0_linux_amd64/consul-template -consul 127.0.0.1:8500 -template "/etc/hosts.ctmpl:/etc/hosts:service dnsmasq restart &"

  • /etc/hosts.ctmpl

# node{{ range nodes }}
{{.Address}} {{.Node}}{{ end }}

# service{{range $tag, $services := service "echo" | byTag}}
{{range $services}}{{.Address}} {{$tag}}.{{.Name}}{{end}}{{end}}
View pdf2text.rb
#!/usr/bin/env ruby
require "poppler"
require 'pp'
file = ARGV[0]
document = Poppler::Document.new(file)
document.each do |d|
puts d.get_text
View fluentd_hacking_guide.md

Fluentd ソースコード完全解説

英題:Fluentd Hacking Guide

目次

30分しかないため斜線部分は今回省く

  • Fluentd の起動シーケンスとプラグインの読み込み
  • Fluentd の設定ファイルのパース
  • Input Plugin から Output Plugin にデータが渡る流れ
View consul-kv-test.md
['-']% curl -X PUT -d 'bar' http://127.0.0.1:8500/v1/kv/foo
true
['-']%
['-']%
['-']% curl -s http://127.0.0.1:8500/v1/kv/foo | jq .
[
  {
    "CreateIndex": 538,
    "ModifyIndex": 538,
@kenjiskywalker
kenjiskywalker / file0.txt
Created Aug 7, 2014
AWSのLaunchConfigをLaunchConfigurationNameで絞るコマンド ref: http://qiita.com/kenjiskywalker/items/38e2560107e20aee6ac7
View file0.txt
aws autoscaling describe-launch-configurations \
| jq '.LaunchConfigurations[] \
| select(.LaunchConfigurationName \
| contains("*LAUNCH_CONFIG_NAME*")) \
| .LaunchConfigurationName ' \
-r \
@kenjiskywalker
kenjiskywalker / file0.txt
Created Aug 6, 2014
AMIのImageをAMI_NAMEで絞り込んでNameとImageIdを抜き出す ref: http://qiita.com/kenjiskywalker/items/5c0d2326907bca669bb8
View file0.txt
$ aws ec2 describe-images \
--filters "Name=name,Values='*AMI_NAME*'" \
--query 'Images[].[Name,ImageId]' \
--output text`
@kenjiskywalker
kenjiskywalker / mongo-rs-remove.md
Last active Aug 29, 2015
arbiterをrs.removeで外すと例外が出る
View mongo-rs-remove.md

レプリカセットつくるコマンド

mkdir -p /tmp/mongo
chmod 777 /tmp/mongo
mkdir -p /tmp/mongo/node[0-2]
mkdir -p /tmp/mongo/log/

mongod --replSet foo --smallfiles --port 27017 --dbpath /tmp/mongo/node0 
mongod --replSet foo --smallfiles --port 27018 --dbpath /tmp/mongo/node1
View main.go
package main
import (
"encoding/json"
"github.com/mizzy/consul-catalog"
"log"
"os"
"reflect"
"time"
)
You can’t perform that action at this time.