This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "encoding/binary" | |
| "errors" | |
| "fmt" | |
| "io" | |
| "net" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo -e "\033[41;30m 红底色 \033[0m" | |
| echo -e "\033[42;30m 绿底色 \033[0m" | |
| echo -e "\033[43;30m 黄底色 \033[0m" | |
| echo -e "\033[44;30m 蓝底色 \033[0m" | |
| echo -e "\033[45;30m 紫底色 \033[0m" | |
| echo -e "\033[46;30m 天底色 \033[0m" | |
| echo -e "\033[47;30m 白底色 \033[0m" | |
| echo -e "\033[31m 红色字 \033[0m" | |
| echo -e "\033[32m 绿色字 \033[0m" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| docker network create etcd --subnet 172.19.0.0/16 | |
| docker run -d --name etcd0 --network etcd --ip 172.19.1.10 quay.io/coreos/etcd etcd \ | |
| -name etcd0 \ | |
| -advertise-client-urls http://172.19.1.10:2379,http://172.19.1.10:4001 \ | |
| -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ | |
| -initial-advertise-peer-urls http://172.19.1.10:2380 \ | |
| -listen-peer-urls http://0.0.0.0:2380 \ | |
| -initial-cluster-token etcd-cluster-1 \ | |
| -initial-cluster etcd0=http://172.19.1.10:2380,etcd1=http://172.19.1.11:2380,etcd2=http://172.19.1.12:2380 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "os" | |
| "runtime" | |
| "syscall" | |
| "time" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func PanicTrace(kb int) []byte { | |
| s := []byte("/src/runtime/panic.go") | |
| e := []byte("\ngoroutine ") | |
| line := []byte("\n") | |
| stack := make([]byte, kb<<10) //4KB | |
| length := runtime.Stack(stack, true) | |
| start := bytes.Index(stack, s) | |
| stack = stack[start:length] | |
| start = bytes.Index(stack, line) + 1 | |
| stack = stack[start:] |