Skip to content

Instantly share code, notes, and snippets.

View Teebusch's full-sized avatar
↔️

Tobias Busch Teebusch

↔️
View GitHub Profile
@Teebusch
Teebusch / shiny-reactive-R6-object.R
Last active August 15, 2022 05:53 — forked from bborgesr/shiny-reactive-R6-object.R
Uses the reactiveTrigger() construct in an R6 object class in order to make it useful in reactive settings, like a Shiny app (MWE included), extended to multiple reactive values
library(shiny)
reactiveTrigger <- function() {
counter <- reactiveVal(0L)
list(
listen = function() {
counter()
invisible()
},
trigger = function() {
@Teebusch
Teebusch / mqttclient.py
Created March 8, 2019 17:45
quick fix and instructions for the ledfloor mqtt clinet
"""
## Usage
- publish to MQTT topic "ledfloorupdates" to change the color(s) of the LED floor
- send a string of the shape "x y r g b" to change the color of an individual pixel x,y to RGB(r,g,b)
- send a string of the shape "r g b" to change the color of all pixes to RGB(r,g,b)
## Starting the Server
- start the Raspberry Pi
- ssh pi@10.90.154.80
@Teebusch
Teebusch / filled_geom_step.R
Last active September 6, 2023 13:44
Filled geom_step() / stepwise geom_area() with ggplot2
# Problem: ggplots's geom_area() does not allow to make stepwise curves (a la geom_step) easily.
# Intead, it always connects the dots directly.
# Solution: We will add additional rows to the data frame to match the steps.
library(ggplot2)
library(dplyr)
# some random data
df <- data.frame(x = seq(10), y = sample(10))