# HG changeset patch
# User pyon@macmini
# Date 1565693710 -32400
# Node ID 90659c7171eda0a339914555ca8ce9c685028ba0
# Parent efa8836fd42882650cb939b5418ca9b4a7f82c3a
add magicpacket.go
diff -r efa8836fd428 -r 90659c7171ed src/fx/chart.svg
--- a/src/fx/chart.svg Fri May 17 19:50:32 2019 +0900
+++ b/src/fx/chart.svg Tue Aug 13 19:55:10 2019 +0900
@@ -1,823 +1,823 @@
diff -r efa8836fd428 -r 90659c7171ed src/fx/fx.go
--- a/src/fx/fx.go Fri May 17 19:50:32 2019 +0900
+++ b/src/fx/fx.go Tue Aug 13 19:55:10 2019 +0900
@@ -1,3 +1,6 @@
+/*
+ fx.go: make MA/RSI/BB-Band graph
+*/
package main
import (
@@ -13,6 +16,7 @@
)
const debug = false
+const ratefile = "./fx_result.csv"
func main() {
n, m := 20, 14
@@ -20,12 +24,13 @@
var date []string
// Read Exchange-data
- content, err := ioutil.ReadFile("/Users/takayuki/Downloads/USDJPY.csv")
+ content, err := ioutil.ReadFile(ratefile)
if err != nil {
log.Fatal(err)
}
r := csv.NewReader(bytes.NewReader(content))
+ r.Comment = '#'
for {
record, err := r.Read()
if err == io.EOF {
@@ -47,7 +52,7 @@
f, err = strconv.ParseFloat(record[2], 64)
xh = append(xh, f)
- date = append(date, strings.ReplaceAll(record[0], "/", "-"))
+ date = append(date, record[0])
}
// Calc Moving-Average
@@ -173,7 +178,7 @@
}
// Print Data
- if false {
+ if debug {
fmt.Println("[j] n x bb1 bb2 rsi | n x bb1 bb2")
fmt.Println("---")
for i, j := len(x) - term, 0; i < len(x); i++ {
diff -r efa8836fd428 -r 90659c7171ed src/fx/rsi.svg
--- a/src/fx/rsi.svg Fri May 17 19:50:32 2019 +0900
+++ b/src/fx/rsi.svg Tue Aug 13 19:55:10 2019 +0900
@@ -3,213 +3,213 @@
30%
50%
70%
-2018-08
-2018-09
-2018-10
-2018-11
-2018-12
-2019-01
-2019-02
-2019-03
-2019-04
-2019-05
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+2018-08
+2018-09
+2018-10
+2018-11
+2018-12
+2019-01
+2019-02
+2019-03
+2019-04
+2019-05
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r efa8836fd428 -r 90659c7171ed src/magicpacket.go
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/magicpacket.go Tue Aug 13 19:55:10 2019 +0900
@@ -0,0 +1,37 @@
+package main
+
+import (
+ "bytes"
+ "fmt"
+ "net"
+ "log"
+ "os"
+)
+
+func main() {
+ if len(os.Args) < 2 {
+ fmt.Fprintln(os.Stderr, "wol mac-address1 mac-address2 ...")
+ os.Exit(1)
+ }
+ for i, m := range os.Args {
+ if i == 0 {
+ continue
+ }
+ hw, err := net.ParseMAC(m)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ b := [][]byte{bytes.Repeat([]byte{255}, 6), bytes.Repeat([]byte(hw), 16)}
+ pkt := bytes.Join(b, nil)
+
+ conn, err := net.Dial("udp", "255.255.255.255:9")
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer conn.Close()
+
+ conn.Write(pkt)
+ }
+}
+