Initial checkin
This commit is contained in:
@@ -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
@@ -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
|
||||
@@ -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
File diff suppressed because it is too large
Load Diff
+1000
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user