diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b08d669 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:1.19 as builder +WORKDIR /workdir +ADD go.mod go.mod +ADD go.sum go.sum +ENV GOPROXY=https://goproxy.cn,direct GO111MODULE=on +RUN go mod download +ADD main.go main.go +ADD pkg pkg +RUN GOOS=linux GOARCH=amd64 go build -o /appname main.go + +FROM scratch +COPY --from=builder /workdir/appname / +ENTRYPOINT [ "/appname" ] \ No newline at end of file diff --git a/go/double_ball/main.go b/go/double_ball/main.go new file mode 100644 index 0000000..57eb437 --- /dev/null +++ b/go/double_ball/main.go @@ -0,0 +1,68 @@ +package main + +import ( + "flag" + "fmt" + "math/rand" + "sort" + "time" +) + + +const ( + RedMax = 33 + BlueMax = 16 +) + +func randRate(){ + rand.Seed(time.Now().UnixNano()) + rate := rand.Intn(100) + 1 + fmt.Printf("\t (中奖概率%d%%)", rate) +} + +func randBall(max int)int{ + rand.Seed(time.Now().UnixNano()) + return rand.Intn(max) + 1 +} + +func isIn(list []int, item int )bool{ + for _, i := range list{ + if i == item { + return true + } + } + return false +} + +func randDoubleBall(){ + balls := []int{} + for i := 0; i < 6;{ + ball := randBall(RedMax) + if isIn(balls, ball) { + continue + } + i++ + balls = append(balls, ball) + } + sort.Ints(balls) + blueball := randBall(BlueMax) + for _, ball := range balls { + fmt.Printf("\033[1;31;40m%d\033[0m \t", ball) + } + fmt.Printf("\033[1;34;40m%d\033[0m \t", blueball) + randRate() + fmt.Println("") +} + +func main(){ + var groups int + flag.IntVar(&groups, "g", 1, "注数") + flag.Parse() + if groups < 0 { + groups = 1 + } + fmt.Printf("为您选取了 %d 注随机双色球,祝君中奖!\n", groups) + for i := 0; i < groups; i++ { + randDoubleBall() + } +} \ No newline at end of file diff --git a/go/tensorflow/main.go b/go/tensorflow/main.go new file mode 100644 index 0000000..85f0393 --- /dev/null +++ b/go/tensorflow/main.go @@ -0,0 +1 @@ +package main \ No newline at end of file diff --git a/go/uiweb/SC/test.txt b/go/uiweb/SC/test.txt new file mode 100644 index 0000000..e69de29 diff --git a/go/uiweb/index.tmpl b/go/uiweb/index.tmpl index 950e11d..7ed24d7 100644 --- a/go/uiweb/index.tmpl +++ b/go/uiweb/index.tmpl @@ -13,9 +13,13 @@