Skip to content

Instantly share code, notes, and snippets.

@MichaelDrogalis
Last active November 18, 2023 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelDrogalis/6ad081ba3abcc428a74df7b32ff2a052 to your computer and use it in GitHub Desktop.
Save MichaelDrogalis/6ad081ba3abcc428a74df7b32ff2a052 to your computer and use it in GitHub Desktop.
{
"generators": [
{
"table": "sensors",
"vars": {
"id": {
"_gen": "oneOf",
"choices": ["sensor-1", "sensor-2", "sensor-3", "sensor-4", "sensor-5"]
}
},
"row": {
"sensorId": {
"_gen": "var", "var": "id"
},
"timestamp": {
"_gen": "formatDateTime",
"ms": {
"_gen": "now"
}
}
},
"stateMachine": {
"_gen": "stateMachine",
"for": {
"_gen": "var",
"var": "id"
},
"initial": "start",
"transitions": {
"start": "update",
"update": "update"
},
"states": {
"start": {
"row": {
"value": {
"_gen": "normalDistribution",
"mean": 50,
"sd": 5
}
}
},
"update": {
"row": {
"value": {
"_gen": "add",
"args": [
{
"_gen": "uniformDistribution",
"bounds": [-1, 1]
},
{
"_gen": "previousEvent",
"path": [ "row", "value" ]
}
]
}
}
}
}
},
"localConfigs": {
"throttle": {
"ms": 1000
}
}
}
],
"connections": {
"pg": {
"kind": "postgres",
"connectionConfigs": {
"host": "localhost",
"port": 5432,
"db": "mydb"
}
}
}
}
#!vd -p
{"longname": "open-file", "input": "data.json", "keystrokes": "o"}
{"sheet": "data", "col": "row", "row": "", "longname": "expand-col", "input": "", "keystrokes": "(", "comment": "expand current column of containers one level"}
{"sheet": "data", "col": "table", "row": "", "longname": "hide-col", "input": "", "keystrokes": "-", "comment": "Hide current column"}
{"sheet": "data", "col": "row.timestamp", "row": "", "longname": "type-date", "input": "", "keystrokes": "@", "comment": "set type of current column to date"}
{"sheet": "data", "col": "row.timestamp", "row": "", "longname": "key-col", "input": "", "keystrokes": "!", "comment": "toggle current column as a key column"}
{"sheet": "data", "col": "row.sensorId", "row": "", "longname": "key-col", "input": "", "keystrokes": "!", "comment": "toggle current column as a key column"}
{"sheet": "data", "col": "row.value", "row": "", "longname": "plot-column", "input": "", "keystrokes": ".", "comment": "plot current numeric column vs key columns; numeric key column is used for x-axis, while categorical key columns determine color"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment