Instantly share code, notes, and snippets.

View speedtest.html
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>SPEED TEST</h2>
<div id="results">
</div>
</body>
<script>
View a.c
#include <stdio.h>
#include "a.h"
int main() {
printf("%d\n", a);
}
View a.c
#include <stdio.h>
int a = 1;
int main() {
printf("%d\n", a);
}
View a.js
const a = [1,2,3,4,5]
const b = a.reduce((acc, v, i, a) => {
const [left, right] = acc
if (i % 2 == 0) {
left.push(v)
if (i === a.length - 1) {
right.push(null)
}
} else {
right.push(v)
View generate.py
# This script requires pypng.
# You may need such command like `pip install pypng`.
import png
WIDTH = 512
HEIGHT = 512
LINE_WIDTH = 10
with open('stripe.png', 'wb') as f:
data = [[255] * WIDTH * 3] * HEIGHT
View fp_consul.md
  • 法人化のメリット:
    • 法人税は、利益が多くなるほど得
    • 役員報酬にを抑えれば、社保がかなり安くなる
    • 所得保障にも法人は有効 → ?
  • 法人化のデメリット:
    • 自分でやったら24万 → 司法書士なら28万 (ざっくり30万)
    • ランニング: 確定申告が個人ではできない (ざっくり月2万、決算時に10万)
    • 赤字でも税金(均等割)
    • 税務調査が多くなる
View webpacker-migration-3.0.2-to-3.5.5.md

Webpacker 3.0.2 → Webpacker 3.5.5 移行ログ

webpackerとwebpack-dev-server更新

bundle update webpacker
yarn upgrade @rails/webpacker --latest
View rails-update-5.1-to-5.2.md
View rails-sidekiq-concurrency.md

Rails/Sidekiqアプリにおけるconcurrency, connection poolまわりの設定条件

rails redis concurrency

https://whimsical.co/SJK9Qzo733f6jkw1Tfk4dT

仮定

  • サーバーインスタンス(dyno)、ワーカーインスタンス(dyno)はそれぞれ1つずつ
  • Sidekiqジョブは毎回DB接続を要求する
View dtv-ext.txt
# request API
id: 797d05ac-6e72-434f-9819-c0742541f945 (ただのuuid)
cookie: unique-id=99295a9ec2bf1f236380d34cb760968b3d7cd59f59; entryunique-id=9934aacdbc27369b9837993a6f296030633506d603; required=1; secured=1; _ga=GA1.4.238537.1513353296; mute_setting=0; volume_setting=0.5; clid=ba6f54324ed9425befe43121769e49dc7cf27e00; _ga=GA1.2.175174540.1514433383; survey=0; QuantumMetricUserID=b7ddc68143acb71cff7a251a924db5b7; videoid=vqsfpdfnro5invssvhvnsbtvc6; secure=8ed2bda3a8c433dd5a52b79b8e839990562a73ff; PC030011_window_width=1440; _gid=GA1.4.1826462311.1515847463; cto_lwid=1e520bcd-f6a5-42aa-b2f9-d11cfce3aff0; x-environment=production-pc; x-disable-type=0%2C0%2C0%2C0%2C0; x-unique-id=99295a9ec2bf1f236380d34cb760968b3d7cd59f59; PC030011_window_height=877; zappingPageProceedingCount=289; _gat_UA-21554603-10=1; _gat_UA-21554603-18=1; _gat_UA-55283043-3=1s
# コンテンツリスト
POST /request method=pcSearchResultList