Skip to content

Instantly share code, notes, and snippets.

View umegaya's full-sized avatar

iyatomi takehiro umegaya

View GitHub Profile
@umegaya
umegaya / gist:14481867191e4c57ce8580ea8c5bfcaf
Created February 25, 2018 17:48
docker file to make solpb image
FROM ubuntu:xenial
RUN apt-get update && apt-get install -y wget libgmp-dev && \
wget https://s3-ap-southeast-2.amazonaws.com/protobuf-solidity/packages/debian/solpb-0.5.0-linux-x86_64.deb && \
dpkg -i solpb-0.5.0-linux-x86_64.deb && \
rm -rf /var/lib/apt/lists/*
cv.wait***から抜けたあと、この関数に渡していたunique_lockはlockされているが、これはwakeupと不可分に起きるわけではない。
例えば他のスレッドが対応するmutexをロックするようなコードを実行していると、以下のようなフローが発生しうる
cv.notifyXXX 呼び出し => cv.waitXXX が再開 => __cv.waitXXXに渡されていたlockを他のスレッドが取得 => cv.waitXXXの中で、再開されたスレッドがlockを取得
したがって以下のようなコードでXが完了するまでYが実行されないことを保証することはできない
{
unique_lock lock(mutex);
cv.wait(lock, predicate);
//X
}
@umegaya
umegaya / gist:d2818bfba217f067ebb569d899a1c46e
Last active November 21, 2017 17:57
qrpc code generation image
package ns;
service Hoge {
rpc Foo(FooReq) returns (FooRep) {}
rpc Bar(BarReq) returns (BarRep) {}
}
|
V
#### client
@umegaya
umegaya / gist:70947b5dc4e1d73d93e7e60353762917
Last active November 15, 2017 08:21
naquid performance
11/13
300 client/13 byte records, 1 server process, 1 client process
dokyougemusu-no-MacBook-Pro:naquid iyatomi$ ./test/e2e/client/build/client
process 140841 requests average 1.707306 sec
dokyougemusu-no-MacBook-Pro:naquid iyatomi$ ./test/e2e/client/build/client
process 150644 requests average 1.564081 sec
dokyougemusu-no-MacBook-Pro:naquid iyatomi$ ./test/e2e/client/build/client
process 146526 requests average 1.580449 sec
dokyougemusu-no-MacBook-Pro:naquid iyatomi$ ./test/e2e/client/build/client
@umegaya
umegaya / gist:bffac13604c0022efe2b2d108f05de3f
Last active April 9, 2018 23:33
特定のディレクトリ以下のファイルをsedの置換機能を使って複雑なリネームする
find $SEARCH_DIR -name "$FILE_PATTERN" -exec sh -c 'echo mv "$1" "$(echo "$1" | sed s/$PATTERN/$REPLACE/)"' _ {} \;
複数引数の例
for i in {2..12} ; do
find . -name "food[1-6].png" -exec sh -c 'cp "$1" "$(echo "$1" | sed s#food#$2/food_$2_#)"' _ {} $i \;
done
@umegaya
umegaya / gist:4222cb2fd268faff636da4a8f5b88f0c
Created September 28, 2017 12:42
エンタングルメントのエントロピーメモ書き
J / K = Entropy
S1, S2 .. have same Entropy
K1 > K2 <=> J1 > J2
J => 保存される(第1法則)
E => 増大する(第2法則)
K => 減りつづけるということ
@umegaya
umegaya / gist:6579b777d28c1fb28ace5fdd31afb622
Created June 26, 2017 02:40
kubernetes-masterのサーバーをちょっとだけ治したいとき
#### tl;dr
例えばapiserverなら
```
sudo bash -c "GOPATH=/var/src/apiserver:/master-release/src/go/Godeps/_workspace/ go build -ldflags '-X github.com/GoogleCloudPlatform/kubernetes/pkg/version.gitCommit 431caa93dfdbe86e14c8041e64ba10bcc80a7b40 -X github.com/GoogleCloudPlatform/kubernetes/pkg/version.gitTreeState dirty -X github.com/GoogleCloudPlatform/kubernetes/pkg/version.gitVersion v0.3-111-g431caa93dfdbe8-dirty -X github.com/GoogleCloudPlatform/kubernetes/pkg/version.gitMajor 0 -X github.com/GoogleCloudPlatform/kubernetes/pkg/version.gitMinor 3+' github.com/GoogleCloudPlatform/kubernetes/cmd/apiserver"
```
でリビルドできる。
#### 背景
kubernetesを使っているとまだ、ちょっとしたバグを修正したいときがあるのですが、
### settings that cause trouble if you leave them default
- VPC
- DNS hostname => set to yes
- VPC subnet
- auto-assign public ip => set to yes
- VPC route table
- create internet gateway and attach it to route table. otherwise no one can connect instance which has this VPC
dokyougemusu-no-MacBook-Pro:mono iyatomi$ sudo make install
Password:
Sorry, try again.
Password:
Sorry, try again.
Password:
Making install in po
Making install in mcs
if test "mono" = "gettext-tools"; then \
../.././install-sh -c -d /usr/local/share/gettext/po; \
MachineId:8D9D94EBA24784C622132CA54BB54571
EpicAccountId:867f7c487d6b4555a177a07a11527560
SEGV_MAPERR at 0x3
FGenericPlatformMisc::RaiseException(unsigned int) Address = 0x109fc3dab (filename not found) [in UE4Editor-Core.dylib]
FOutputDeviceMacError::Serialize(wchar_t const*, ELogVerbosity::Type, FName const&) Address = 0x10a17c378 (filename not found) [in UE4Editor-Core.dylib]
FOutputDevice::Logf(wchar_t const*, ...) Address = 0x10a259d17 (filename not found) [in UE4Editor-Core.dylib]
FDebug::AssertFailed(char const*, char const*, int, wchar_t const*, ...) Address = 0x10a1d8b7e (filename not found) [in UE4Editor-Core.dylib]
__31-[FCocoaTextView selectedRange]_block_invoke Address = 0x10a108b1f (filename not found) [in UE4Editor-Core.dylib]