Skip to content

Instantly share code, notes, and snippets.

View umegaya's full-sized avatar

iyatomi takehiro umegaya

View GitHub Profile
@umegaya
umegaya / gist:4e99991bc9a0dfe35c90fad0855d60fe
Last active March 15, 2022 07:53
CIサービスを使う理由
CIサービスを使う意味は大きいです。機材の保守に手間をかけなくて良い点、気をつけなくても実行環境を常に新しくしていってくれる点、またCIの規模が大きくなったときに処理能力を容易にスケールできる点などです。
上記のような利点は、ローカルマシンでやっていても、最初はあまり価値を感じないと思いますし、CIサービスに移行しようとしたら結構大変でコストに見合わないと感じると思いますが、
ローカルマシンでずっとCIを賄っていると、大体の場合、以下のような形でいきなり破綻します。
1. CIに必要なメモリ、CPU、ストレージの使用量が1台で処理し切れないぐらいの規模になる
2台以上のマシンを使って処理能力を拡張しようとすると、いきなり構築の難易度が増します。また2の理由により、同じように正しく動くローカルマシンを複数用意すること自体に大きな困難が伴うことがあります。
2. そのローカルマシンが利用できなくなる
ローカルマシンのような環境を使っていると、その環境に過度に依存したスクリプトになりがちで、例えばあるファイルがたまたまある場所に置いてある、といったことに知らずに依存していることがあります。
しばらくは問題ありませんが、自前の機材は故障ないし、機種としてのサポートが切れるなどして使えなくなる時が必ず来ます。
この場合、新しいマシンがたまたまその条件を満たしていないと急に動かなくなり、そして原因の判明や解決に非常に時間がかかる(あるいはできない)、といったことが起きます。
長く使うほど、こういった移行の時の問題は大きくなります。
@umegaya
umegaya / gist:aad998b30d514bfa39816e17ef5eb86f
Created October 8, 2021 00:59
tar files which modified between specified datetimes, without recursion
find . -newermt 20210901 -not -newermt 20210930 -type f -print0 -maxdepth 1 | xargs -0 tar -cvzf /tmp/archive.tar.gz

Keybase proof

I hereby claim:

  • I am umegaya on github.
  • I am umegaya (https://keybase.io/umegaya) on keybase.
  • I have a public key ASA_nFoeLT9Lgd5r9353LZuPOjL7g36Le78v7dEnfC7ZlQo

To claim this, I am signing this object:

@umegaya
umegaya / gist:b8aad13bf94b0be11535075df46533ce
Last active June 21, 2019 01:16
ドキュメントの内容を解析して勝手に解析するjs
こういうのがあると
```
---------- mhttp DL ----------
1174|1466|400|700|667
1172|1067|333|633|801
752|734|299|401|633
781|600|1234|1333|600
1188|631|335|799|934
```
@umegaya
umegaya / gist:ddca5b754279eaa57308ded159819b51
Created December 20, 2018 07:18
jestを使うとsetIntervalがnodeのやつじゃなくなる!
by default, jest uses jsdom to provide low level APIs like setInterval,
https://jestjs.io/docs/en/configuration#testenvironment-string
setting ```"testEnvironment": "node"``` in "jest" config of package.json solves problem
### name
Takehiro Iyatomi
### current position
- CTO of Dokyogames, inc.
### previous position
- Zynga Japan K.K. : Engineer of studio department
- IPA mitou project : Adopted Engineer
- Koei Tecmo Games Co., Ltd. : Senior Lead Engineer
@umegaya
umegaya / gist:3698a45f03f63b5831de304e2c081a92
Created June 5, 2018 06:04
sample script to launch multiple parcel command to watch directory and finish when ctrl-c is pressed
# watch script for parcel
if [ -z "$1" ]; then
# watch all
(
trap "kill 0" EXIT
for dir in `ls ./functions/` ; do
if [ -d "./functions/$dir" ]; then
parcel ./functions/$dir/index.ts -d dist/$dir &
fi
done
@umegaya
umegaya / gist:023532a22acc41d2cd2411ae21ec71ec
Created April 11, 2018 01:34
generate nearly unpredictable sha1 hash (for scripts) / 予測することがかなり困難なsha1 hashを作る
ps auwx | sha1sum | awk '{print $1}'
@umegaya
umegaya / gist:57a60bdc35394331075b904d53847610
Created March 20, 2018 00:47
makefile to build Nethereum.ABI.dll for unity3d
UNITY_LIBDIR=/Your/Path/For/Nethereum.Unity
BASE_LIBDIR=../../lib
LIBDIR=$(BASE_LIBDIR),$(UNITY_LIBDIR)
DLLNAME=Nethereum.ABI.dll
all:
mcs -lib:$(LIBDIR) -r:Newtonsoft.Json.dll -r:Nethereum.Hex.dll -r:Nethereum.Util.dll -target:library -out:$(DLLNAME) *.cs */*.cs */*/*.cs
@umegaya
umegaya / gist:f0b93ff53faf466dbee28a93491e24e2
Created March 6, 2018 18:55
convert arbiter length of hexdump string "0x...." to byte array
var toBytes = (hexdump) => {
var buff = new Uint8Array(hexdump.length / 2 - 1);
var idx = 0;
hexdump.substring(2).replace(/\w{2}/g, (m) => {
buff[idx++] = parseInt(m, 16);
});
return buff;
}