Skip to content

Instantly share code, notes, and snippets.

@Kartoffel
Kartoffel / backup-etherpad-tree.sh
Created October 17, 2017 09:19
Backup etherpad pads, starting from one pad that contains the URLs of the other pads to backup
curl -o badge https://pad.sha2017.org/p/badge/export/txt
for i in $(cat badge | grep -Po '(?<=pad.sha2017.org\/p\/)(.*)'); do curl -o $i "https://pad.sha2017.org/p/$i/export/txt"; done

Keybase proof

I hereby claim:

  • I am kartoffel on github.
  • I am kartoffel (https://keybase.io/kartoffel) on keybase.
  • I have a public key ASCbsREMOHC4s_x6f_Wlhu7POwV519nIJoc2Fv1b4vW_qgo

To claim this, I am signing this object:

@Kartoffel
Kartoffel / M5_IR_MQTT.ino
Created April 11, 2020 16:04
M5 Atom MQTT to IR bridge for controlling Edifier speakers
// Compile for ESP32 Pico Kit, upload rate 115200 baud
#include <Arduino.h>
#include <WiFi.h>
#include <PubSubClient.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#define MQTT_SERVER "10.0.1.3"
#define MQTT_TOPIC_DEBUG "niek/debug/"
#define MQTT_TOPIC_BASE "niek/speakers/"
#!/usr/bin/python3
import paho.mqtt.client as mqtt
from sty import fg, bg, rs
width = height = 5
mqtt_server = "test.mosquitto.org"
mqtt_topic = "matrixflut"
def on_connect(client, userdata, flags, rc):
print("Connected (rc={})".format(rc))
@Kartoffel
Kartoffel / bertrik_electricityprice_sha2017_poc.py
Created August 17, 2022 20:34
Proof of concept to get day-ahead electricity prices on the SHA2017 badge (old firmware)
# Quick POC, for the SHA2017 badge on the last firmware before the ESP32-platform
# Test through serial monitor, 115200 baud
# 1. Press some buttons on the badge to wake it up
# 2. Spam ctrl+C in the terminal until you get an empty prompt
# 3. Type `import shell` to get a blank display and clean shell
# 4. Press ctrl+E to enter paste mode
# 5. Paste the first 14 lines of the below code, press ctrl+D to exit paste mode and execute
# 6. Repeat above two steps for lines 15-27 and 29-41
# Note: paste mode doesn't work well for large paste buffers, use mpfshell or similar to push whole files to the badge