Skip to content

Instantly share code, notes, and snippets.

@mattn

mattn/yes.go Secret

Created July 25, 2022 17:21
Show Gist options
  • Select an option

  • Save mattn/7188a90cfededb915c8e6362e5c358b7 to your computer and use it in GitHub Desktop.

Select an option

Save mattn/7188a90cfededb915c8e6362e5c358b7 to your computer and use it in GitHub Desktop.
package main
import (
"bytes"
"log"
"os"
)
func main() {
var buf bytes.Buffer
if len(os.Args) > 1 {
for i, arg := range os.Args[1:] {
if i > 0 {
buf.WriteByte(' ')
}
buf.WriteString(arg)
}
} else {
buf.WriteByte('y')
}
buf.WriteByte('\n')
b := bytes.Repeat(buf.Bytes(), 64*1024/buf.Len())
var err error
for {
if _, err = os.Stdout.Write(b); err != nil {
log.Fatal(err)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment