Skip to content

Instantly share code, notes, and snippets.

View tai2's full-sized avatar
🐢

Taiju Muto tai2

🐢
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>XAPIAN_CJK_NGRAM</key>
<string>1</string>
<key>TERMINAL_NOTIFIER</key>
<string>/Users/tai2/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier</string>
@tai2
tai2 / speedtest.html
Created October 11, 2018 14:17
measure local network speed
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>SPEED TEST</h2>
<div id="results">
</div>
</body>
<script>
@tai2
tai2 / a.c
Created October 8, 2018 13:16
duplicate symbol test 2
#include <stdio.h>
#include "a.h"
int main() {
printf("%d\n", a);
}
@tai2
tai2 / a.c
Created October 8, 2018 12:29
duplicate symbol test
#include <stdio.h>
int a = 1;
int main() {
printf("%d\n", a);
}
@tai2
tai2 / a.js
Created September 26, 2018 01:58
[1,2,3,4,5] to [[1,2], [3,4], [5,null]]
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)
@tai2
tai2 / generate.py
Last active September 21, 2018 06:03
Stripe image generator
# 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
@tai2
tai2 / fp_consul.md
Last active August 3, 2018 06:29
FPとの相談メモ
  • 法人化のメリット:
    • 法人税は、利益が多くなるほど得
    • 役員報酬にを抑えれば、社保がかなり安くなる
    • 所得保障にも法人は有効 → ?
  • 法人化のデメリット:
    • 自分でやったら24万 → 司法書士なら28万 (ざっくり30万)
    • ランニング: 確定申告が個人ではできない (ざっくり月2万、決算時に10万)
    • 赤字でも税金(均等割)
  • 税務調査が多くなる
@tai2
tai2 / webpacker-migration-3.0.2-to-3.5.5.md
Last active July 31, 2018 05:32
webpacker 3.0.2 からwebpacker 3.5.5 への移行作業のログ

Webpacker 3.0.2 → Webpacker 3.5.5 移行ログ

webpackerとwebpack-dev-server更新

bundle update webpacker
yarn upgrade @rails/webpacker --latest
@tai2
tai2 / rails-update-5.1-to-5.2.md
Last active July 13, 2018 03:45
Rails 5.1から5.2への移行作業のログ
@tai2
tai2 / rails-sidekiq-concurrency.md
Last active March 23, 2022 06:51
Rails/Sidekiqアプリにおけるconcurrency, connection poolまわりの設定条件

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

rails redis concurrency

https://whimsical.co/SJK9Qzo733f6jkw1Tfk4dT

仮定

  • サーバーインスタンス(dyno)、ワーカーインスタンス(dyno)はそれぞれ1つずつ
  • Sidekiqジョブは毎回DB接続を要求する