Skip to content

Instantly share code, notes, and snippets.

View hfm's full-sized avatar

Okumura Takahiro hfm

View GitHub Profile
@wakwanza
wakwanza / dbupdate.ctmpl
Last active May 24, 2019 03:29
consul template to update db server in proxysql
INSERT OR REPLACE INTO mysql_servers
(hostgroup_id,hostname,port,comment)
VALUES {{ range $i, $s := service "mydb"}}{{if $i }},{{end}}
(1,'{{.Address}}',{{.Port}},'{{.Node}}'){{end}};
SAVE MYSQL SERVERS TO DISK;
@yano3
yano3 / about_elasticsearch_cluster.md
Last active September 28, 2020 07:52
Elasticsearch クラスタ概説
@bhouse
bhouse / centos_nspawn.md
Created February 8, 2016 23:41
Centos 7.2.1511 via systemd-nspawn

Make a directory to install CentOS 7.2.1511 in

[root@localhost ~]# mkdir /centos_chroot

Make a directory for the rpm database

[root@localhost ~]# mkdir -p /centos_chroot/var/lib/rpm

Create the RPM database

突然のホストダウンで /proc/meminfo の Dirty ページがディスクに同期されず揮発するかどうかの検証

Dirty ページの書き出しを抑えるめちゃくちゃ設定をする

sudo sysctl -w vm.dirty_writeback_centisecs=1000000 # 単位は ms
sudo sysctl -w    vm.dirty_expire_centisecs=1000000 # 単位は ms
sudo sysctl -w    vm.dirty_background_ratio=99
sudo sysctl -w               vm.dirty_ratio=99
```
@winebarrel
winebarrel / pg_show_grants.sql
Last active July 16, 2025 19:02
show grants for PostgreSQL
select
pg_user.usename,
t1.nspname,
t1.relname,
relacl.privilege_type,
relacl.is_grantable
from (
select
pg_namespace.nspname,
pg_class.relname,
@sunaot
sunaot / writing_unit_test.md
Last active February 20, 2022 06:57
テストを書くか書かないかの判断の話

ユニットテストでテストを書くか書かないかの判断の話

お題

メソッドの出力の結果が、true か false のどちらでも返ってくる可能性がある場合、assert 文を書く時は true の場合だけで良いのだろうか

テストとは

まず、基本の考えとしてなぜテストをするのか?というのがあります。

@sonots
sonots / out_forward.conf
Last active November 2, 2021 06:14
ログの欠損をできるだけ避ける Fluentd の out_forward 設定サンプル cf. http://blog.livedoor.jp/sonots/archives/44690980.html
<source>
type in_tail
# ...
tag raw.eventlog
</source>
<match raw.**>
type forward
log_level "#{ENV['DEBUG'] ? 'debug' : 'info'}"

Norikra

必要パッケージインストール

yum install git openssl-devel java-1.8.0-openjdk java-1.8.0-openjdk-devel

Norikraのインストールにrbenvを使用する

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
@everpeace
everpeace / Why People Want Microservices.md
Last active November 8, 2022 10:37
マイクロサービス化が進む背景について考えてみた

マイクロサービス化が進む背景について考えてみた

最近マイクロサービスって流行ってますよね。バズってると言ってもいいくらい。

個人的には、「マイクロサービスって結局何なの?」とか、「SOAと何が違うわけ?」とかいう議論は苦手です。

でも「なんでみんなマイクロサービスで作りたいのか?なんでマイクロサービスで作られるサービスが多いのか?」にはすごく興味があるんです。

僕は今、シリコンバレーにある日系SIerの小さな子会社で駐在員をやっていますが、このエリアに居ると、とにかく最近、

「サービス全体が、独立した小さなサービスの集合で構成されるようになってきている」

@sonots
sonots / fluentd_hacking_guide.md
Last active October 4, 2024 00:01
Fluentd ソースコード完全解説 (v0.10向け)

Fluentd ソースコード完全解説

英題:Fluentd Hacking Guide

目次

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

  • Fluentd の起動シーケンスとプラグインの読み込み
  • Fluentd の設定ファイルのパース
  • Input Plugin から Output Plugin にデータが渡る流れ