You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
511 B
40 lines
511 B
4 years ago
|
#!/bin/sh
|
||
|
|
||
|
if test $# -lt 1
|
||
|
then
|
||
|
echo "specify a file"
|
||
|
exit 2
|
||
|
fi
|
||
|
|
||
|
if test ! -f $1
|
||
|
then
|
||
|
cat <<! > $1
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"github.com/ajstarks/svgo"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
width = 500
|
||
|
height = 500
|
||
|
canvas = svg.New(os.Stdout)
|
||
|
)
|
||
|
|
||
|
func background(v int) { canvas.Rect(0, 0, width, height, canvas.RGB(v, v, v)) }
|
||
|
|
||
|
|
||
|
func main() {
|
||
|
canvas.Start(width, height)
|
||
|
background(255)
|
||
|
|
||
|
// your code here
|
||
|
|
||
|
canvas.Grid(0, 0, width, height, 10, "stroke:black;opacity:0.1")
|
||
|
canvas.End()
|
||
|
}
|
||
|
!
|
||
|
fi
|
||
|
$EDITOR $1
|