Initial checkin
This commit is contained in:
commit
ea8290a2a2
13
.devcontainer/devcontainer.json
Normal file
13
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/go",
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"golang.go"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mounts": [
|
||||||
|
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cache",
|
||||||
|
]
|
||||||
|
}
|
||||||
22
.gitignore
vendored
Normal file
22
.gitignore
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# If you prefer the allow list template instead of the deny list, see community template:
|
||||||
|
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||||
|
#
|
||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Test binary, built with `go test -c`
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
|
*.out
|
||||||
|
|
||||||
|
# Dependency directories (remove the comment below to include it)
|
||||||
|
# vendor/
|
||||||
|
|
||||||
|
# Go workspace file
|
||||||
|
go.work
|
||||||
|
usergen
|
||||||
43
main.go
Normal file
43
main.go
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/rand"
|
||||||
|
"embed"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"math/big"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
//go:embed resources
|
||||||
|
res embed.FS
|
||||||
|
// embed the resources/nouns.txt & resources/verbs.txt files as arrays of strings split by newlines
|
||||||
|
nouns []string
|
||||||
|
verbs []string
|
||||||
|
)
|
||||||
|
|
||||||
|
var count int
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
nounsContents, _ := res.ReadFile("resources/nouns.txt")
|
||||||
|
nouns = strings.Split(string(nounsContents), "\n")
|
||||||
|
|
||||||
|
verbsContents, _ := res.ReadFile("resources/verbs.txt")
|
||||||
|
verbs = strings.Split(string(verbsContents), "\n")
|
||||||
|
|
||||||
|
flag.IntVar(&count, "count", 10, "number of nouns and verbs to print")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
fmt.Println("count is ", count)
|
||||||
|
|
||||||
|
// Print the first 10 nouns and verbs
|
||||||
|
for i := 0; i < count; i++ {
|
||||||
|
randomNounIdx, _ := rand.Int(rand.Reader, big.NewInt(int64(len((nouns)))))
|
||||||
|
randomVerbIdx, _ := rand.Int(rand.Reader, big.NewInt(int64(len((verbs)))))
|
||||||
|
fmt.Printf("%s-%s\n", nouns[randomNounIdx.Int64()], verbs[randomVerbIdx.Int64()])
|
||||||
|
}
|
||||||
|
}
|
||||||
1000
resources/nouns.txt
Normal file
1000
resources/nouns.txt
Normal file
File diff suppressed because it is too large
Load Diff
1000
resources/verbs.txt
Normal file
1000
resources/verbs.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user