Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
tkuchiki / elb-configure-health-check.sh
Last active August 29, 2015 14:07
ELB の health check を設定する
#!/bin/bash
usage() {
echo "Usage: $(basename $0) -e|--elb ELB_NAME -t|--target TARGET
-e|--elb elb name
-t|--target target protocol (http|tcp)
-h|--help show this help message and exit
"
exit 0
}
@tkuchiki
tkuchiki / multiprocess-configtest.sh
Last active August 29, 2015 14:07
fluentd で fluent-plugin-multiprocess を使っているとき用の configtest
#!/bin/bash
TD_CONF=/etc/td-agent/td-agent.conf
# /usr/sbin/td-agent --user td-agent --group td-agent --dry-run -q --use-v1-config -c $TD_CONF
/usr/sbin/td-agent --user td-agent --group td-agent --dry-run -q -c $TD_CONF
STATUS=$?
IFS=$'\n'
for LINE in $(grep cmdline $TD_CONF); do
CONFIG_FILE=$(echo $LINE | sed -e 's/ */ /' | egrep -o "(-c|--config) (.+?)" | awk '{print $2}')
@tkuchiki
tkuchiki / consul_status_leader.rb
Last active August 29, 2015 14:07
ruby の net/http で consul の status/leader の結果を取得する
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse('http://127.0.0.1:8500/v1/status/leader')
http = Net::HTTP.new(uri.host, uri.port)
res = http.start {
@tkuchiki
tkuchiki / gist:1107f43f50d507b29cf9
Created September 16, 2014 14:09
install ruby 2.2.0-devl
# https://gist.github.com/tkuchiki/543e277a2f7221a7833a
yum install -y bison
@tkuchiki
tkuchiki / gist:543e277a2f7221a7833a
Last active April 3, 2024 12:56
install autoconf 2.69 for CentOS 6
curl -L -O http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar zxf autoconf-2.69.tar.gz
cd autoconf-2.69
yum install -y openssl-devel
./configure
make && make install
@tkuchiki
tkuchiki / bats.log
Last active May 16, 2023 11:07
Example Bats
##### setup start
BATS_TEST_NAME: test_example_status_and_output-2c_lines
BATS_TEST_FILENAME: /home/bats/test.bats
BATS_TEST_DIRNAME: /home/bats
BATS_TEST_NAMES: test_example_status_and_output-2c_lines
BATS_TEST_DESCRIPTION: example status and output, lines
BATS_TEST_NUMBER: 1
BATS_TMPDIR: /tmp
##### setup end
example 1
@tkuchiki
tkuchiki / nginx_find_log.sh
Last active August 29, 2015 14:06
ltsv 形式の nginx ログを response time ごとに色分けで出力
#!/bin/bash
usage() {
echo "Usage: $(basename $0) -v|--value VALUE -k|--key KEY [--min MIN] [--max MAX] [-l|--log LOG]
-v, --value find value (grep pattern)
-k, --key find key (grep pattern)
-l, --log log file path
--min min response time
--max max response time
"
@tkuchiki
tkuchiki / installation.md
Created September 9, 2014 01:44
Install bats
$ add-apt-repository ppa:duggan/bats --yes
gpg: keyring `/tmp/tmp_ijpu6ti/secring.gpg' created
gpg: keyring `/tmp/tmp_ijpu6ti/pubring.gpg' created
gpg: requesting key 5F28EA3F from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp_ijpu6ti/trustdb.gpg: trustdb created
gpg: key 5F28EA3F: public key "Launchpad PPA for Ross Duggan" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
@tkuchiki
tkuchiki / _.md
Last active August 29, 2015 14:06
EC2 の DHCP Option Sets (consul 用)

dhcp option sets 作成

$ aws ec2 create-dhcp-options --dhcp-configuration file://dhcp.json
{
    "DhcpOptions": {
        "DhcpConfigurations": [
            {
                "Values": [
 "node.consul service.consul ap-northeast-1.compute.internal"
@tkuchiki
tkuchiki / install.md
Last active August 29, 2015 14:05
install LXC (CentOS 6.5)

install

# epel required
wget --no-check-certificate https://linuxcontainers.org/downloads/lxc-1.0.5.tar.gz
tar zxvf lxc-1.0.5.tar.gz
rpmdev-setuptree
cp ./lxc-1.0.5.tar.gz ~/rpmbuild/SOURCES/
cp lxc-1.0.5/lxc.spec ~/rpmbuild/SPECS/
yum install -y libcap-devel docbook2X graphviz