-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50f078e
commit 0816528
Showing
13 changed files
with
105 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
jsbuild/node_modules/ | ||
jsbuild/package-lock.json | ||
jsbuild/bundle.js | ||
bundle.js | ||
histogram_timestamps | ||
templates.go | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
all: histogram_timestamps | ||
|
||
histogram_timestamps: templates.go | ||
go build | ||
|
||
templates.go: bundle.js index.html external_deps | ||
go-bindata -o templates.go index.html bundle.js | ||
|
||
bundle.js: | ||
./jsbuild/build_bundle_for_makefile.sh | ||
|
||
.PHONY: external_deps | ||
external_deps: | ||
go get -u github.com/kevinburke/go-bindata/go-bindata | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f ./histogram_timestamps ./bundle.js ./jsbuild/bundle.js templates.go | ||
|
||
.PHONY: install | ||
install: all | ||
go install | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module github.com/lelandbatey/histogram_timestamps | ||
|
||
go 1.16 | ||
|
||
require ( | ||
github.com/itchyny/timefmt-go v0.1.3 // indirect | ||
github.com/kevinburke/go-bindata v3.22.0+incompatible // indirect | ||
github.com/mattn/go-isatty v0.0.14 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921iRkU= | ||
github.com/itchyny/timefmt-go v0.1.3/go.mod h1:0osSSCQSASBJMsIZnhAaF1C2fCBTJZXrnj37mG8/c+A= | ||
github.com/kevinburke/go-bindata v3.22.0+incompatible h1:/JmqEhIWQ7GRScV0WjX/0tqBrC5D21ALg0H0U/KZ/ts= | ||
github.com/kevinburke/go-bindata v3.22.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM= | ||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= | ||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= | ||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= | ||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<!doctype HTML5> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>histogram_timestamps 000</title> | ||
</head> | ||
<body> | ||
<canvas id="myChart" width="400" height="400"></canvas> | ||
<script src="bundle.js"></script> | ||
<script src="jsbuild/bundle.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
# File exists to run a command which is hard to express in a Makefile in a way | ||
# that's easy to understand. You can run this file from anywhere and it'll | ||
# always try to output the same thing. However, this script makes some | ||
# assumptions which are: | ||
# 1. This script is located inside of the `jsbuild/` directory which contains | ||
# all the files necessary (main.js, package.json, etc) for node to know how | ||
# to build 'bundle.js'. | ||
# 2. The output directory where 'bundle.js' shall be placed is the parent | ||
# directory to wherever this bash script is stored on disk. | ||
|
||
# Find the directory of this bash script, from https://stackoverflow.com/a/246128 | ||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
ORIGINAL_DIR="${PWD}" | ||
|
||
cd "${SCRIPT_DIR}" | ||
|
||
$(npm bin)/browserify main.js -o ../bundle.js | ||
|
||
echo "bundle.js has been successfully written to the directory '${SCRIPT_DIR}/../'" |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"os" | ||
|
||
_ "github.com/itchyny/timefmt-go" | ||
isatty "github.com/mattn/go-isatty" | ||
) | ||
|
||
func main() { | ||
fmt.Printf("Is stdin a terminal?: %t\n", isatty.IsTerminal(os.Stdin.Fd())) | ||
if !isatty.IsTerminal(os.Stdin.Fd()) { | ||
all, err := io.ReadAll(os.Stdin) | ||
if err != nil { | ||
fmt.Printf("Error reading stdin: %v\n", err) | ||
os.Exit(2) | ||
} | ||
fmt.Printf("Read the following data:\n%s\n", string(all)) | ||
} | ||
// 1. read stdin for lines of text | ||
// 2. Attempt to parse lines of text into dates then into epoch_ms formats | ||
// 3. Bin each timestamp by the interval | ||
// 4. Assemble the JSON data to be graphed | ||
// 5. Render the HTML/JS+JSON data to a tmp file | ||
// 6. Serve the tmp file from a port | ||
// 7. Launch a web-browser to view the localhost port | ||
fmt.Printf("hello world") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package tbin |