Skip to content

Instantly share code, notes, and snippets.

View dgnorton's full-sized avatar

David Norton dgnorton

  • InfluxDB
  • Mooresville, NC
View GitHub Profile
#!/bin/bash
# addDays takes a Unix timestamp (in seconds) and returns a new timestamp
# with numDays added to it.
function addDays() {
local ts=$1
local days=$2
echo $((ts + days * 86400))
}
CREATE CONTINUOUS QUERY downsample_to_final ON nexus
BEGIN
SELECT
LAST("analog_input_temperature_value") AS "analog_input_temperature_value",
LAST("analog_input_ai0_value") AS "analog_input_ai0_value",
LAST("analog_input_ai1_value") AS "analog_input_ai1_value",
LAST("analog_input_ai2_value") AS "analog_input_ai2_value",
LAST("analog_input_ai3_value") AS "analog_input_ai3_value",
LAST("battery_level") AS "battery_level",
LAST("clock") AS "clock",
❯ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.2.0 (2019-08-20)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
#!/bin/bash
commit="$1"
for tag in $(git for-each-ref refs/tags --sort=-taggerdate --format='%(refname)'); do
t1="$t2"
t2="$(echo $tag | awk -F/ '{print $3}')"
if [ -z $t1 ]; then
continue
#!/bin/bash
# Source this script from within any directory within a valid potential
# GOPATH and it will set it. It looks for the first parent directory
# named "go" or "Go" and sets GOPATH to it.
c=$(pwd)/dummy
while :
do
d=$(basename $(dirname $c))
@dgnorton
dgnorton / issue.sh
Last active February 2, 2017 13:24
#!/bin/sh
echo "drop database foo; create database foo" | influx
influx -database foo -execute "insert regextest,tag1=test value=1"
echo "select value from regextest" | influx -database foo
echo "select value from /regextest/" | influx -database foo
#!/bin/sh
# base directory where cluster configs will be created
BASEDIR="/tmp/influxdb-cluster"
# delete the base dir if it exists
if [ -d "$BASEDIR" ]; then
rm -rf $BASEDIR
fi
==================
WARNING: DATA RACE
Write by goroutine 17:
github.com/influxdb/influxdb/cmd/influxd/run_test.configureLogging()
/home/dgnorton/i/go/src/github.com/influxdb/influxdb/cmd/influxd/run/server_helpers_test.go:424 +0x247
github.com/influxdb/influxdb/cmd/influxd/run_test.NewCluster()
/home/dgnorton/i/go/src/github.com/influxdb/influxdb/cmd/influxd/run/server_helpers_test.go:452 +0x59d
github.com/influxdb/influxdb/cmd/influxd/run_test.TestCluster_DatabaseCommands()
/home/dgnorton/i/go/src/github.com/influxdb/influxdb/cmd/influxd/run/server_cluster_test.go:53 +0x5f
testing.tRunner()
package main
import (
"log"
"os"
)
func main() {
if err := os.Mkdir("data", 0777); err != nil {
log.Fatal(err)
@dgnorton
dgnorton / goloc.sh
Last active September 29, 2015 00:33
#!/bin/sh
total=0
# loop through all package directories in the project
for dir in $(go list ./...); do
# prepend $GOPATH src directory
dir="$GOPATH/src/$dir"
# count lines of Go code in the directory
cnt=$(cloc ${dir}/* | egrep "^Go" | awk '{printf $5}')
# print the result