Skip to content

Instantly share code, notes, and snippets.

View flyaways's full-sized avatar
:octocat:
Focusing

flyaways

:octocat:
Focusing
  • Beijing
  • 01:07 (UTC +08:00)
View GitHub Profile
@flyaways
flyaways / socks5_proxy.go
Created January 31, 2024 03:36 — forked from felix021/socks5_proxy.go
Minimal socks5 proxy implementation in Golang
package main
import (
"encoding/binary"
"errors"
"fmt"
"io"
"net"
)
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"
@flyaways
flyaways / etcd_cluster.sh
Created May 7, 2018 12:03 — forked from jolestar/etcd_cluster.sh
Run etcd cluster by docker with custom network
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 \
package main
import (
"fmt"
"log"
"os"
"runtime"
"syscall"
"time"
)
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:]