Skip to content

Instantly share code, notes, and snippets.

View ota42y's full-sized avatar

ota42y ota42y

View GitHub Profile
require 'benchmark'
require "committee"
COUNT = 10000
noop = Proc.new {[200, {}, ["hello"]]}
middleware = Committee::Middleware::RequestValidation.new(noop, schema_path: 'demo.yaml')
# warmup
request = Rack::MockRequest.new(middleware)
@ota42y
ota42y / gist:c8c7f4b5784f52afaf888bdd0c0f05af
Created June 22, 2019 08:57
読書メモ: 我々はなぜ我々だけなのか アジアから消えた多様な「人類」たち
https://www.amazon.co.jp/我々はなぜ我々だけなのか-アジアから消えた多様な「人類」たち-ブルーバックス-川端-裕人/dp/4065020379/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=&sr=
ジャワ原人
ホモ・エレクトス
現生人類に近い
120万年前にはジャワ島にいた
5万年前まではいた
ホモ・サピエンスがユーラシアにいる
4万7000年前までにはオーストラリア大陸に到達してる
アジアの人
require 'benchmark'
actioncable_folder = '/rails/actioncable'
rubocop_folder = '/rubocop'
def reset_rails(actioncable_folder)
Dir.chdir(actioncable_folder) do
system('git checkout -f v5.2.3 >/dev/null 2>&1')
system('mv ../.rubocop.yml ../.rubocop.yml_bk')
end
FROM node:8.11.3-alpine
RUN mkdir -p /app/node_modules
RUN touch /app/node_modules/test
@ota42y
ota42y / text.md
Last active August 21, 2019 04:57
技術書典7

一応最初に書いておくと、身内の恥をpublicな場で行うのは絶対嫌で、やってるのを見るだけでドン引きなんですが、 唯一のコミュニケーション手段であるprivateなパスではしょっちゅう無視されてますし、publicな場では元気なことからこのパスに頼らざるを得ませんでした。 悲しいことにpublicな場に出したことで一瞬で終息してしまったので、最低だが効果的な方法であると証明されてしまいましたし…

今回は「本とビルコン両方やるのは無理だから諦めてビルコンに集中させるという合意を取る」のが目的なので事態としては収束しています。 以下具体的な内容としては

  • 本人から精神的負荷を理由にビルコンの後に記事だけあげるという連絡が来る
  • 現在の状況から考えるとビルコン後からスタートすると間に合わないと判断
global:
resolve_timeout: 5m
slack_api_url: "https://hooks.slack.com/services/xxx"
route:
group_by: ['alertname']
group_wait: 10s
group_interval: 10s
repeat_interval: 1h
receiver: 'slack'
level=info ts=2019-10-05T12:41:33.693Z caller=cluster.go:640 component=cluster msg="gossip settled; proceeding" elapsed=10.01120645s
level=debug ts=2019-10-05T12:42:47.040Z caller=dispatch.go:104 component=dispatcher msg="Received alert" alert=server-status[83e172c][active]
level=debug ts=2019-10-05T12:42:57.045Z caller=dispatch.go:432 component=dispatcher aggrGroup="{}:{alertname=\"server-status\"}" msg=flushing alerts=[server-status[83e172c][active]]
level=debug ts=2019-10-05T12:43:07.048Z caller=dispatch.go:432 component=dispatcher aggrGroup="{}:{alertname=\"server-status\"}" msg=flushing alerts=[server-status[83e172c][active]]
level=debug ts=2019-10-05T12:43:17.050Z caller=dispatch.go:432 component=dispatcher aggrGroup="{}:{alertname=\"server-status\"}" msg=flushing alerts=[server-status[83e172c][active]]
% ./alertmanager --log.level=debug
level=info ts=2019-10-05T12:41:23.678Z caller=main.go:217 msg="Starting Alertmanager" version="(version=0.19.0, branch=HEAD, revision=7aa5d19fea3f58e3d27dbdeb0f2883037168914a)"
level=info ts=2019-10-05T12:41:23.678Z caller=main.go:218 build_context="(go=go1.12.8, user=root@587d0268f963, date=20190903-15:04:14)"
level=debug ts=2019-10-05T12:41:23.678Z caller=cluster.go:149 component=cluster msg="resolved peers to following addresses" peers=
level=info ts=2019-10-05T12:41:23.679Z caller=cluster.go:161 component=cluster msg="setting advertise address explicitly" addr=192.168.11.8 port=9094
level=debug ts=2019-10-05T12:41:23.681Z caller=delegate.go:230 component=cluster received=NotifyJoin node=01DPDZ0PYZT9KRQ6MWV5SCAFKM addr=192.168.11.8:9094
level=debug ts=2019-10-05T12:41:23.681Z caller=cluster.go:233 component=cluster msg="joined cluster" peers=0
level=info ts=2019-10-05T12:41:23.681Z caller=cluster.go:623 component=cluster msg="Waiting for gossip to settle..." interval=2s
l
# return path for validation, if return nil we doesn't validation
def validation_path_hook(request)
# only
# request.path.start_with?('/something') ? request.path : nil
# except
# request.path.start_with?('/something') ? nil : request.path
# prefix option (/v1/test => /test)
# request.path.gsub(/^\/v1/, "")
@ota42y
ota42y / techbookfest_calc
Created March 22, 2020 02:40
技術書典 応援祭 の販売数集計スクリプト(2020/03/22時点)
out = []
document.getElementsByClassName("css-1dbjc4n r-1l7z4oj r-ymttw5")[0].children.forEach(c => {
if (c.children.length == 1) { return; } // header
datetime = c.children[0].innerText.split("\n")[0];
s = c.children[2].innerText.split("\n");
title = s[0]
type = s[1]
price = c.children[3].innerText.split("\n")[0];
out.push(datetime + "," + type + "," + title + "," + price);
});