Skip to content

Instantly share code, notes, and snippets.

@niksaak
Created June 29, 2014 13:29
Show Gist options
  • Save niksaak/5a3e35475e3bb0b3c6d1 to your computer and use it in GitHub Desktop.
Save niksaak/5a3e35475e3bb0b3c6d1 to your computer and use it in GitHub Desktop.
package main
import "flag"
import "fmt"
import "os"
var oz = flag.Bool("oz", false, "if false, write 55h, otherwise write AAh.")
var len = flag.Uint("len", 512, "length of the bytes buffer")
func main() {
var fillValue byte
if !oz {
fillValue = 0x55
} else {
fillValue = 0xAA
}
bytes := make([]byte, len)
for i := range bytes {
bytes[i] = fillValue
}
for {
i, err := os.Stdout.Write(bytes)
if err != nil {
fmt.Println(err)
break
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment