generated from bing/readnotes
feat 不知道改了什么
This commit is contained in:
parent
4e392e9746
commit
dc9d8b6e94
|
@ -3,9 +3,9 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
|
||||||
"net/http"
|
|
||||||
"net"
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func get(resp http.ResponseWriter, req *http.Request) {
|
func get(resp http.ResponseWriter, req *http.Request) {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cmd := cobra.Command{
|
cmd := cobra.Command{
|
||||||
Use: "cobra",
|
Use: "cobra",
|
||||||
|
|
|
@ -8,21 +8,36 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
RedMax = 33
|
RedMax = 33
|
||||||
BlueMax = 16
|
BlueMax = 16
|
||||||
)
|
)
|
||||||
|
|
||||||
func randRate(){
|
type ball struct{
|
||||||
rand.Seed(time.Now().UnixNano())
|
B int
|
||||||
rate := rand.Intn(100) + 1
|
R []int
|
||||||
fmt.Printf("\t (中奖概率%d%%)", rate)
|
Rate int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b ball)display(){
|
||||||
|
for _, r := range b.R {
|
||||||
|
fmt.Printf("\033[1;31;40m%d\033[0m \t", r)
|
||||||
|
}
|
||||||
|
fmt.Printf("\033[1;34;40m%d\033[0m \t", b.B)
|
||||||
|
fmt.Printf("\t (中奖概率%d%%)\n", b.Rate)
|
||||||
|
}
|
||||||
|
|
||||||
|
func randRate() int {
|
||||||
|
src := rand.NewSource(time.Now().UnixNano())
|
||||||
|
rd := rand.New(src)
|
||||||
|
rate := rd.Intn(100) + 1
|
||||||
|
return rate
|
||||||
}
|
}
|
||||||
|
|
||||||
func randBall(max int) int {
|
func randBall(max int) int {
|
||||||
rand.Seed(time.Now().UnixNano())
|
src := rand.NewSource(time.Now().UnixNano())
|
||||||
return rand.Intn(max) + 1
|
rd := rand.New(src)
|
||||||
|
return rd.Intn(max) + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func isIn(list []int, item int) bool {
|
func isIn(list []int, item int) bool {
|
||||||
|
@ -34,35 +49,46 @@ func isIn(list []int, item int )bool{
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func randDoubleBall(){
|
func randDoubleBall()ball{
|
||||||
balls := []int{}
|
b := ball{}
|
||||||
for i := 0; i < 6; {
|
for i := 0; i < 6; {
|
||||||
ball := randBall(RedMax)
|
r := randBall(RedMax)
|
||||||
if isIn(balls, ball) {
|
if isIn(b.R, r) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
i++
|
i++
|
||||||
balls = append(balls, ball)
|
b.R = append(b.R, r)
|
||||||
}
|
}
|
||||||
sort.Ints(balls)
|
sort.Ints(b.R)
|
||||||
blueball := randBall(BlueMax)
|
b.B = randBall(BlueMax)
|
||||||
for _, ball := range balls {
|
b.Rate = randRate()
|
||||||
fmt.Printf("\033[1;31;40m%d\033[0m \t", ball)
|
return b
|
||||||
}
|
|
||||||
fmt.Printf("\033[1;34;40m%d\033[0m \t", blueball)
|
|
||||||
randRate()
|
|
||||||
fmt.Println("")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var groups int
|
var groups int
|
||||||
flag.IntVar(&groups, "g", 1, "注数")
|
var zhong bool
|
||||||
|
flag.IntVar(&groups, "g", 0, "注数")
|
||||||
|
flag.BoolVar(&zhong, "z", true, "必中")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if groups < 0 {
|
if groups < 1 {
|
||||||
groups = 1
|
groups = 1
|
||||||
|
}else{
|
||||||
|
zhong = false
|
||||||
|
}
|
||||||
|
if zhong {
|
||||||
|
for {
|
||||||
|
b := randDoubleBall()
|
||||||
|
if b.Rate == 100 {
|
||||||
|
b.display()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
fmt.Printf("为您选取了 %d 注随机双色球,祝君中奖!\n", groups)
|
fmt.Printf("为您选取了 %d 注随机双色球,祝君中奖!\n", groups)
|
||||||
for i := 0; i < groups; i++ {
|
for i := 0; i < groups; i++ {
|
||||||
randDoubleBall()
|
b:=randDoubleBall()
|
||||||
|
b.display()
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
package font
|
package font
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Font struct {
|
type Font struct {
|
||||||
Head Head `json:"head"`
|
Head Head `json:"head"`
|
||||||
}
|
}
|
|
@ -86,7 +86,6 @@ type NameTable struct {
|
||||||
Style string `json:"style"`
|
Style string `json:"style"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type NameRecord struct {
|
type NameRecord struct {
|
||||||
Platform uint16
|
Platform uint16
|
||||||
PlatformSpecific uint16
|
PlatformSpecific uint16
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func get(c *gin.Context) {
|
func get(c *gin.Context) {
|
||||||
//c.ClientIP()
|
//c.ClientIP()
|
||||||
log.Println()
|
log.Println()
|
||||||
|
|
|
@ -7,8 +7,6 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func show(file string) error {
|
func show(file string) error {
|
||||||
mp3File, err := id3v2.Open(file, id3v2.Options{Parse: true})
|
mp3File, err := id3v2.Open(file, id3v2.Options{Parse: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -50,7 +50,7 @@ func (n *Notifier)recieveMessage(ctx context.Context){
|
||||||
func (n *Notifier) notify(msg Message) {
|
func (n *Notifier) notify(msg Message) {
|
||||||
n.lock.Lock()
|
n.lock.Lock()
|
||||||
defer n.lock.Unlock()
|
defer n.lock.Unlock()
|
||||||
clts, ok := n.userClients[msg.User];
|
clts, ok := n.userClients[msg.User]
|
||||||
if !ok || len(clts) == 0 {
|
if !ok || len(clts) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,6 @@ func (a *AliOSS) CheckFileVersion(obj string, info os.FileInfo) (bool, error) {
|
||||||
return info.ModTime().Unix() >= modifiedAt, nil
|
return info.ModTime().Unix() >= modifiedAt, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// const host = "http://testspeed.xk.design"
|
// const host = "http://testspeed.xk.design"
|
||||||
|
|
||||||
const MAX = 300
|
const MAX = 300
|
||||||
|
@ -320,7 +319,6 @@ func NewRequest(url string)(*http.Request, error){
|
||||||
return req, nil
|
return req, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func test(f file, count int, host string) {
|
func test(f file, count int, host string) {
|
||||||
fmt.Printf("begin normal testing for %s\n", f.Name)
|
fmt.Printf("begin normal testing for %s\n", f.Name)
|
||||||
startedAt := time.Now().UnixMilli()
|
startedAt := time.Now().UnixMilli()
|
||||||
|
@ -410,7 +408,6 @@ func filelist(dir string)([]string, error){
|
||||||
return fs, nil
|
return fs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func case3(dir string, ak string, sk string, count int, host string) error {
|
func case3(dir string, ak string, sk string, count int, host string) error {
|
||||||
files, err := filelist(dir)
|
files, err := filelist(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ func (w *Wechat)GetGrantToken(code string)(*GrantToken, error){
|
||||||
err = json.Unmarshal(data, &token)
|
err = json.Unmarshal(data, &token)
|
||||||
return &token, err
|
return &token, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// {"expire_seconds":"60","action_name": "QR_STR_SCENE", "action_info": {"scene": {"scene_str": '.$id.'}}}
|
// {"expire_seconds":"60","action_name": "QR_STR_SCENE", "action_info": {"scene": {"scene_str": '.$id.'}}}
|
||||||
type Scene struct {
|
type Scene struct {
|
||||||
Str string `json:"scene_str"`
|
Str string `json:"scene_str"`
|
||||||
|
|
Loading…
Reference in New Issue