Browse Source

temp commint

master
huangkun 1 year ago
parent
commit
8a74dc4a0c
  1. 13
      Dockerfile
  2. 68
      go/double_ball/main.go
  3. 1
      go/tensorflow/main.go
  4. 0
      go/uiweb/SC/test.txt
  5. 8
      go/uiweb/index.tmpl
  6. 1
      go/uiweb/main.go
  7. BIN
      go/uiweb/uiweb
  8. 11
      kubernetes/installation/scripts/get_images.sh

13
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" ]

68
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()
}
}

1
go/tensorflow/main.go

@ -0,0 +1 @@
package main

0
go/uiweb/SC/test.txt

8
go/uiweb/index.tmpl

@ -13,9 +13,13 @@
<h3 style="text-align: center;">{{.title}}</h3> <h3 style="text-align: center;">{{.title}}</h3>
</div> </div>
<hr class="my-4" > <hr class="my-4" >
{{ range .files }} {{ range $file := .files }}
<div class="row" style=""> <div class="row" style="">
<div style="width:80%;" class="p-3 mb-2 bg-light text-dark"><a href="/ui/{{.}}">{{.}}</a></div> {{ if eq $file "SC" }}
<div style="width:80%;" class="p-3 mb-2 bg-light text-dark"><a href="/{{$file}}">{{$file}}</a></div>
{{ else }}
<div style="width:80%;" class="p-3 mb-2 bg-light text-dark"><a href="/ui/{{$file}}">{{$file}}</a></div>
{{ end }}
</div> </div>
{{else}} {{else}}
<div class="" style=""> <div class="" style="">

1
go/uiweb/main.go

@ -14,6 +14,7 @@ func run(dir, title, addr string)error{
engine := gin.Default() engine := gin.Default()
engine.LoadHTMLGlob(dir + "/*.tmpl") engine.LoadHTMLGlob(dir + "/*.tmpl")
engine.Static("/ui", dir) engine.Static("/ui", dir)
engine.StaticFS("/SC", http.Dir(dir + "/SC"))
engine.GET("/", func(ctx *gin.Context) { engine.GET("/", func(ctx *gin.Context) {
dirs, _ := os.ReadDir(dir) dirs, _ := os.ReadDir(dir)
files := []string{} files := []string{}

BIN
go/uiweb/uiweb

Binary file not shown.

11
kubernetes/installation/scripts/get_images.sh

@ -12,4 +12,15 @@ do
ctr images push -k -u ${IMAGE_REGISTRY_USER} ${IMAGE_REGISTRY}/${IMAGE_NAME} ctr images push -k -u ${IMAGE_REGISTRY_USER} ${IMAGE_REGISTRY}/${IMAGE_NAME}
# ctr images rm ${IMAGE} # ctr images rm ${IMAGE}
done done
<<<<<<< Updated upstream
#192.168.0.144:1080 ccr.ccs.tencentyun.com/kgcrio 100004225373 #192.168.0.144:1080 ccr.ccs.tencentyun.com/kgcrio 100004225373
=======
#192.168.0.144:1080 ccr.ccs.tencentyun.com/kgcrio 100004225373:Hello2022
https_proxy=192.168.0.200:1080 ctr images pull --all-platforms registry.k8s.io/prometheus-adapter/prometheus-adapter:v0.10.0
https_proxy=192.168.0.200:1080 ctr images pull --all-platforms registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.8.2
ctr images tag registry.k8s.io/prometheus-adapter/prometheus-adapter:v0.10.0 registry.cn-hangzhou.aliyuncs.com/slmgoogle/prometheus-adapter:v0.10.0
ctr images tag registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.9.2 registry.cn-hangzhou.aliyuncs.com/slmgoogle/kube-state-metrics:v2.9.2
registry-vpc.cn-hangzhou.aliyuncs.com/slmgoogle
>>>>>>> Stashed changes

Loading…
Cancel
Save