Skip to content

Instantly share code, notes, and snippets.

View johnDorian's full-sized avatar

John Dorian johnDorian

View GitHub Profile
@johnDorian
johnDorian / README.md
Created October 20, 2020 13:51
Tailscale for Valetudo

Tailscle on a roborock for Valetudo

Tailscale provides a simple to setup and use private network. I've just starting using this on my home network for home assistant and valetudo. Here are the instructions for setting up Tailsclae on the roborock vacuum.

For official tailscale installation see here: https://tailscale.com/download/linux/static

Download

@johnDorian
johnDorian / README.md
Last active August 14, 2022 06:01
Rockrobo restore map (gen1)

This gist is an example of how to use home assistant to reload the map of the vacuum

Setup the vacuum

How to setup the vacuum side of things

  1. You will need to copy the recovery_map.shto /mnt/data/valetudo/recovery_map.sh on the vacuum
  2. Create the backup folder mkdir -p /mnt/data/rockrobo/backup/
  3. Run a complete clean or manually steer the vacuum around the entire house. After finishing the tour, return the vacumm to the dock.
  4. Copy the base map to the backup folder cp /mnt/data/rockrobo/last_map /mnt/data/rockrobo/backup/ and the charger pos cp /mnt/data/rockrobo/ChargerPos.data /mnt/data/rockrobo/backup/

Setup Home assistant

@johnDorian
johnDorian / ggplot_piper.R
Last active May 6, 2022 16:09
Piper diagrams using ggplot2.
### A piper diagram based on the ternary plot example here: http://srmulcahy.github.io/2012/12/04/ternary-plots-r.html
### This was written quickly, and most likely contains bugs - I advise you to check it first.
### Jason Lessels jlessels@gmail.com
### This now consists of two functions. transform_piper_data transforms the data to match
### the coordinates of the piper diagram. ggplot_piper does all of the background.
transform_piper_data <- function(Mg, Ca, Cl,SO4, name=NULL){
if(is.null(name)){
@johnDorian
johnDorian / 2nd_axis.r
Created December 1, 2014 15:42
Function to plot secondary axis in ggplot2
library(ggplot2)
library(gtable)
library(grid)
library(ggthemes)
# extract gtable
ggplot_second_axis <- function(p1, p2){
p2 <- p2 + theme() %+replace%
@johnDorian
johnDorian / README.md
Last active April 10, 2021 14:06
Node exporter on roborock v1

Running node-exporter on the roborock v1 vacuum.

  1. Save the nodeexporter.conf upstart script to /etc/init/nodeexporter.conf
  2. Grab the armv7 node exporter binary from https://github.com/prometheus/node_exporter/releases
  3. Add the node_exporter binary to /usr/local/bin/node_exporter
  4. Reboot or start the service service nodeexporter start.
"""
Programming task
================
The following is an implementation of a simple Named Entity Recognition (NER).
NER is concerned with identifying place names, people names or other special
identifiers in text.
Here we make a very simple definition of a named entity: A sequence of
at least two consecutive capitalized words. E.g. "Los Angeles" is a named
"""
Programming task
================
Implement the method iter_sample below to make the Unit test pass. iter_sample
is supposed to peek at the first n elements of an iterator, and determine the
minimum and maximum values (using their comparison operators) found in that
sample. To make it more interesting, the method is supposed to return an
iterator which will return the same exact elements that the original one would
have yielded, i.e. the first n elements can't be missing.
@johnDorian
johnDorian / ggplot_cbind_rbind_example.r
Created January 12, 2015 09:26
Using cbind and rbind for ggplot plots
# load the libraries
library(ggplot2)
library(gtable)
library(gridExtra)
# Create the plots
p1 <- ggplot() + geom_point(aes(1,1))
p2 <- ggplot() + geom_point(aes(2,2))
p3 <- ggplot() + geom_point(aes(3,3))
p4 <- ggplot() + geom_point(aes(4,4))
# Firstly create two columns (the first and second column)
@johnDorian
johnDorian / piper.R
Created May 1, 2013 09:53
piper diagrams from the hydrogeo package
piper <-
function (data, group = NULL, colours = NULL, pch = NULL, numbersymbols = FALSE,
X = 300, ...)
{
p <- (X/11)
q <- (X/22)
over100 <- data[data$Ca + data$Mg > 100 | data$Cl + data$SO4 >
100, ]
if (length(over100[, 1]) != 0) {
print("ERROR")
#####################################################################################################
### Aim: To test the significance of randomly allocating flow to 'midnight' water quality samples.
### Date Created: Thursday 2nd September 2010
### Author: Jason Lessels
### Packages required: TSAgg_0.2-1,geoR
### Notes: The script can easily be modified for the other water quality parameters, and the amount of simulations. Things to check:
###Both WQ and discharge must have the same initial time stamp (hours) before aggregation.
###WQ variable modify lines 52,60,146,186
###line 99 changes the amount of simulations to run.
###line 156 determines when the bushfire occurred.