Skip to content

Instantly share code, notes, and snippets.

@tkhk
tkhk / think_ansible.md
Last active May 28, 2018 07:44
WIP: ansible playbook 雑記

ansible playbook 雑記

playbook を書く上で

  • 「何をしたか」
  • 「何を考えるか」
  • 「何が辛かったか」

を忘れないように書いておく

@tkhk
tkhk / research_connections.sql
Last active May 31, 2017 04:10
the number of connections to MySQL (group by HOST)
SELECT COUNT(*), SUBSTRING(HOST, 1, POSITION(':' in HOST)-1) AS ip FROM INFORMATION_SCHEMA.PROCESSLIST GROUP BY ip;
a = "a"
b = "b"
c = "c"
print(a and b or c) -- b
a = nil
b = "b"
c = "c"
print(a and b or c) -- c
@tkhk
tkhk / luajson.md
Last active August 29, 2015 14:26

lua の json モジュールは array と object をどのように区別しているのか

lua-users の Json Modules (http://lua-users.org/wiki/JsonModules) の pure lua で書かれてるものを読んでみた.
基本的にはそれぞれ独自に array 判定関数を作っていて, 中身のロジックは大体同様で以下のようなものだった.

  • テーブル内のすべてのキーをチェックする
  • type が number かつ連番であれば, array とみなす
  • 空のテーブルは空のリストとする

cmj-JSON4Lua

http://json.luaforge.net/