blob: 50a0e3aac6f1ed11c414dd60eb155bba8ac5ee55 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/bin/sh
gofmt > main.go << EOF
package main
import (
"io/ioutil"
"os"
"os/exec"
)
//go:generate generate.sh
func main() {
f, err := ioutil.TempFile(os.TempDir(), os.Args[0])
if err != nil {
panic(err)
}
defer os.Remove(f.Name())
if _, err := f.Write(sound); err != nil {
panic(err)
}
cmd := exec.Command("afplay", f.Name())
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
panic(err)
}
}
var sound = []byte{
$(xxd -i < sound.wav | sed 's/\([^,]\)$/\1,/')
}
EOF
|