Skip to content

Commit 05932b6

Browse files
committed
Initial commit of Martin Poviser's code.
1 parent 7b09cfd commit 05932b6

14 files changed

+1319
-0
lines changed

http_serve

7.38 MB
Binary file not shown.

http_serve.go

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package main
2+
3+
import (
4+
"os"
5+
"io"
6+
"log"
7+
"net/http"
8+
"io/ioutil"
9+
)
10+
11+
func main() {
12+
http.Handle("/", http.FileServer(http.Dir(".")))
13+
14+
http.HandleFunc("/log/all", func(w http.ResponseWriter, r *http.Request) {
15+
if r.Method != "GET" {
16+
http.Error(w, "invalid method", 405)
17+
return
18+
}
19+
20+
files, err := ioutil.ReadDir("log")
21+
if err != nil {
22+
log.Print(err.Error())
23+
http.Error(w, err.Error(), 500)
24+
return
25+
}
26+
27+
for _, file := range files {
28+
if file.IsDir() { continue }
29+
30+
f, err := os.Open("log/" + file.Name())
31+
if err != nil {
32+
log.Print(err.Error())
33+
http.Error(w, err.Error(), 500)
34+
return
35+
}
36+
37+
_, err = io.Copy(w, f)
38+
f.Close()
39+
40+
if err != nil {
41+
log.Print(err.Error())
42+
http.Error(w, err.Error(), 500)
43+
return
44+
}
45+
}
46+
})
47+
48+
log.Printf("Hle!\n")
49+
50+
log.Fatal(http.ListenAndServe(":80", nil))
51+
}
52+

index.html

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8">
4+
<title>Sluncárna, šum na 32 MHz</title>
5+
<script src="plotly-latest.min.js"></script>
6+
<script src='nprogress.js'></script>
7+
<link rel='stylesheet' href='nprogress.css'/>
8+
</head>
9+
<body>
10+
<div id="plot" style="width: 100%;height: 100%;"></div>
11+
12+
<script>
13+
NProgress.start();
14+
Plotly.d3.text("/log/all", function(text) {
15+
try {
16+
rows = Plotly.d3.tsv.parseRows(text);
17+
18+
var x = [], y = [];
19+
20+
for (var i = 0; i < rows.length; i++) {
21+
x.push(new Date(parseFloat(rows[i][1])*1000));
22+
y.push(rows[i][2]);
23+
}
24+
25+
var plotDiv = document.getElementById("plot");
26+
27+
Plotly.newPlot(plotDiv, [{
28+
x: x,
29+
y: y
30+
}], {
31+
title: 'Úroveň šumu na ~30 MHz, sluncárna'
32+
});
33+
NProgress.done();
34+
} catch (err) {
35+
NProgress.done();
36+
}
37+
});
38+
</script>
39+
</body>
40+
</html>

nprogress.css

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* Make clicks pass-through */
2+
#nprogress {
3+
pointer-events: none;
4+
}
5+
6+
#nprogress .bar {
7+
background: #29d;
8+
9+
position: fixed;
10+
z-index: 1031;
11+
top: 0;
12+
left: 0;
13+
14+
width: 100%;
15+
height: 2px;
16+
}
17+
18+
/* Fancy blur effect */
19+
#nprogress .peg {
20+
display: block;
21+
position: absolute;
22+
right: 0px;
23+
width: 100px;
24+
height: 100%;
25+
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
26+
opacity: 1.0;
27+
28+
-webkit-transform: rotate(3deg) translate(0px, -4px);
29+
-ms-transform: rotate(3deg) translate(0px, -4px);
30+
transform: rotate(3deg) translate(0px, -4px);
31+
}
32+
33+
/* Remove these to get rid of the spinner */
34+
#nprogress .spinner {
35+
display: block;
36+
position: fixed;
37+
z-index: 1031;
38+
top: 15px;
39+
right: 15px;
40+
}
41+
42+
#nprogress .spinner-icon {
43+
width: 18px;
44+
height: 18px;
45+
box-sizing: border-box;
46+
47+
border: solid 2px transparent;
48+
border-top-color: #29d;
49+
border-left-color: #29d;
50+
border-radius: 50%;
51+
52+
-webkit-animation: nprogress-spinner 400ms linear infinite;
53+
animation: nprogress-spinner 400ms linear infinite;
54+
}
55+
56+
.nprogress-custom-parent {
57+
overflow: hidden;
58+
position: relative;
59+
}
60+
61+
.nprogress-custom-parent #nprogress .spinner,
62+
.nprogress-custom-parent #nprogress .bar {
63+
position: absolute;
64+
}
65+
66+
@-webkit-keyframes nprogress-spinner {
67+
0% { -webkit-transform: rotate(0deg); }
68+
100% { -webkit-transform: rotate(360deg); }
69+
}
70+
@keyframes nprogress-spinner {
71+
0% { transform: rotate(0deg); }
72+
100% { transform: rotate(360deg); }
73+
}
74+

0 commit comments

Comments
 (0)