[golang] go-ethereum으로 이벤트 구독

	go func(client *ethclient.Client) {
		contractAddresses := []common.Address{}
		for _, pair := range Pair {
			contractAddresses = append(contractAddresses, common.HexToAddress(pair.PairAddress))
		}

		SyncEventSig := []byte("Sync(uint112,uint112)")
		hash := sha3.NewLegacyKeccak256()
		hash.Write(SyncEventSig)
		SyncEventHashBytes := hash.Sum(nil)
		signature := common.BytesToHash(SyncEventHashBytes) // 0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1
		topic := []common.Hash{signature}
		topics := [][]common.Hash{topic}
		query := ethereum.FilterQuery{
			Addresses: contractAddresses,
			Topics:    topics,
		}

		logs := make(chan types.Log)
		sub := event.Resubscribe(2*time.Second, func(ctx context.Context) (event.Subscription, error) {
			return client.SubscribeFilterLogs(context.Background(), query, logs)
		})
		defer sub.Unsubscribe()
		for {
			select {
			case err := <-sub.Err():
				log.Fatal("Error on select:", err)
			case vLog := <-logs:
				fmt.Println("Log block number:", vLog.BlockNumber)
				// 여기서 하고 싶은 일 하기.
			}
		}
	}(client)

[Docker] docker commands

실행 중인 docker process (machine) 보기

docker ps

실행 중 + 실행 중이 아닌 docker process 보기

docker ps -a

docker 이미지 보기

docker images

docker process 삭제

docker rm -rf [container name]

docker 이미지 삭제

docker rmi [image name]

docker 이미지 가져오기

docker pull [image name]

docker process 시작

docker start [container name]

docker process 중지

docker stop [container name]

실행 중인 모든 컨테이너 강제 종료

docker kill $(docker ps -q -f status=running)

실행 중인 모든 컨테이너 중지

docker stop $(docker ps -q -f status=running)

종료된 모든 컨테이너 삭제

docker rm $(docker ps -q -f status=exited)

시스템 상의 모든 이미지 삭제

docker image rm -f $(docker image ls -q)

docker 로그 보기

docker logs [container name]

docker network 삭제

docker network prune -f

alias해서 간편히 사용하기

alias dockerkill='docker kill $(docker ps -q -f status=running)'
alias dockerstop='docker stop $(docker ps -q -f status=running)'
alias dockerrm='docker rm $(docker ps -q -f status=exited)'
alias dockerimgrm='docker image rm -f $(docker image ls -q)'
alias dockernetprune='docker network prune -f'

docker cli 실행

$ docker exec -it cli /bin/bash