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
# Visualizing Energy Data from Influx DB | |
# | |
# - Loads energy data from an influx database filled with vzlogger | |
# - Creates a visualization for the electric power of the last 12 hours | |
# | |
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
requireNamespace("glue") | |
requireNamespace("plotly") |
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
# Example for simple function to be tested | |
# | |
# 1. Change working directory | |
# 2. Call: testthat::test_dir('tests') within RStudio or R | |
increment <- function(value) { | |
value + 1 | |
} |
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
library(ggplot2) | |
library(tidyverse) | |
requireNamespace("xts") | |
requireNamespace("generics") | |
requireNamespace("lubridate") | |
n <- 100 | |
t1 <- lubridate::ymd(20190101) | |
tser <- xts::xts(sin(2 * pi * seq(0, 1, length.out = n)), |
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
#!/bin/bash | |
# my bash template | |
set -o errexit | |
set -o nounset | |
shopt -s nullglob | |
SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" | |
function die() { | |
echo "ERROR $? IN ${BASH_SOURCE[0]} AT LINE ${BASH_LINENO[0]}" 1>&2 |
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
## start ssh-agent | |
# see https://stackoverflow.com/questions/40549332/how-to-check-if-ssh-agent-is-already-running-in-bash | |
USER="${USER:-$(id -un)}" # fix for Windows git-bash which does not set the USER variable | |
export SSH_AUTH_SOCK=${SSH_AUTH_SOCK:-/tmp/ssh-agent-${USER}.sock} | |
agent_run_state=$(ssh-add -l > /dev/null 2>&1 ; echo $?) | |
# agent_run_state == 0 agent runs with keys | |
# agent_run_state == 1 agent runs without keys | |
# agent_run_state == 2 agent is not running | |
if [[ $agent_run_state = 2 ]] ; then | |
# Load stored agent connection info. |
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
#!/usr/bin/bash | |
# allows to play back a remote configuration backed up with `git remote -v > remote.txt` | |
set -o errexit | |
set -o nounset | |
shopt -s nullglob | |
remoteFile="$1" | |
[[ -f "$remoteFile" ]] || { echo "Error: file $remoteFile does not exist"; exit 1; } | |
while read name url ; do | |
if git remote get-url "$name" >/dev/null 2>&1 ; then | |
echo "Remote $name already exists" |