Skip to content

Instantly share code, notes, and snippets.

Avatar
🐙
Working full-time on OctoPrint

Gina Häußge foosel

🐙
Working full-time on OctoPrint
View GitHub Profile
@foosel
foosel / README.md
Last active Feb 9, 2021
OBS script that updates the YouTube livechat URL on a browser source on stream start.
View README.md

youtube-live-chat-update.py

OBS script that updates the YouTube livechat URL on a browser source on stream start to the livechat associated with the (first) current livestream on a given channel. If no livestream is active, a placeholder page saying "No Stream." will be injected. You can style the text via the css class .nostream to match your background etc.

You will need a YouTube API key, see https://developers.google.com/youtube/v3/getting-started and https://developers.google.com/youtube/registering_an_application for more information on how to go about that.

Additionally you will require the channel ID of the channel for which you want to query the current live stream. You can retrieve that by inspecting the web site source of the channel in question and looking for externalId.

To use, download youtube-live-chat-update.py and add it as script to OBS Studio. Note: Be sure to configure a valid Python environment first, see here for more details.

@foosel
foosel / .Xmodmap
Created Jan 31, 2021
KMonad config to turn a ThinkPad X240 keyboard UHK alike. Combined with .Xmodmap for german umlauts and fixed ins/end shenanigans.
View .Xmodmap
! Fix ThinkPad shenanigans
keycode 118 = End
keycode 115 = Insert
! AltGr is Mode_switch
clear mod5
keycode 108 = Mode_switch
! AltGr shortcuts for umlauts
keycode 39 = s S ssharp
@foosel
foosel / NodeRed flow for GitHub Review Reminders.md
Last active Jan 27, 2021
NodeRed flow for GitHub Review Reminders
View NodeRed flow for GitHub Review Reminders.md

NodeRed flow for GitHub Review Reminders

Quick node setup to get notifications about requested reviews each workday morning.

Screenshot of the node setup

Flow json:

[{"id":"3ba912e4.896146","type":"http request","z":"8357254d.c82348","name":"Query","method":"GET","ret":"obj","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","authType":"","x":530,"y":880,"wires":[["fa377f9a.5a51a","872d9224.2341b8"]]},{"id":"fa377f9a.5a51a","type":"debug","z":"8357254d.c82348","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":750,"y":960,"wires":[]},{"id":"ea784988.39d24","type":"inject","z":"8357254d.c82348","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":940,"wires":[["fef091db.f8a6c"]]},{"id":"fef091db.f8a6c","type":"function","z":"8357254d
@foosel
foosel / lighter_freecad_forum.user.css
Last active Sep 24, 2020
Lighter FreeCAD Forum Userstyle. Install with Stylus extension. Tested on Firefox.
View lighter_freecad_forum.user.css
/* ==UserStyle==
@name Lighter FreeCAD Forum
@namespace github.com/foosel
@version 1.0.2
@description A lighter theme for the FreeCAD forum. Sans-serif instead of Fira-Sans, slightly more line-height, slightly less bold headlines, less read everywhere. Easier on the eyes.
@author foosel
@homepageURL https://gist.github.com/foosel/21fb760e94bae5782171ca49c799daf5
@updateURL https://gist.githubusercontent.com/foosel/21fb760e94bae5782171ca49c799daf5/raw/lighter_freecad_forum.user.css
==/UserStyle== */
@foosel
foosel / m33_storm.py
Last active Jan 3, 2021
Requests long names for files on printer's SD card via M33. OctoPrint 1.4.2+. No maintenance, no support.
View m33_storm.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import octoprint.plugin
import octoprint.events
import octoprint.util.comm
class M33StormPlugin(octoprint.plugin.EventHandlerPlugin):
def __init__(self):
self._active = False
View bot-commands-on-the-octoprint-discord.md

Bot Commands on the OctoPrint Discord Server

Roles

  • ?role: Get an overview of the available roles (teams, ranks) you can join. Only allowed in #bot-commands
  • ?role <role>: Join joinable role. Only allows in #bot-commands
  • ?ranks: Alias for ?role
  • ?rank <rank>: Alias for ?role <role>
  • ?joinirc & ?leaveirc: Use these to either join or leave the IRC bridge channel #irc (invisible by default). Aliases for ?role IRC. Only allowed in #bot-commands
@foosel
foosel / Dockerfile
Last active May 12, 2019
Simple Dockerfile & composition to run a speedtest2mqtt setup using speedtest-rs from https://github.com/nelsonjchen/speedtest-rs
View Dockerfile
FROM rust:1.31
WORKDIR /usr/src
RUN git clone https://github.com/nelsonjchen/speedtest-rs
WORKDIR ./speedtest-rs
RUN cargo install --path .
ADD entrypoint.sh /opt/speedtest2mqtt.sh
RUN apt-get update && \
@foosel
foosel / Dockerfile
Created May 12, 2019
Simple Dockerfile & composition to run a speedtest2mqtt setup using speedtest-go from https://github.com/showwin/speedtest-go
View Dockerfile
FROM alpine:3.7
ADD entrypoint.sh /opt/speedtest2mqtt.sh
COPY speedtest-go /usr/bin/speedtest-go
RUN apk update && \
apk add ca-certificates mosquitto-clients && \
rm -rf /var/cache/apk/* && \
chmod 777 /opt/speedtest2mqtt.sh
@foosel
foosel / rewrite_wait_to_busy.py
Last active Feb 10, 2021
OctoPrint plugin that rewrites received wait responses to echo:busy processing for broken firmware misunderstanding when wait should be used. Place in ~/.octoprint/plugins
View rewrite_wait_to_busy.py
# coding=utf-8
import logging
def rewrite_wait_to_busy(comm_instance, line, *args, **kwargs):
if line == "wait" or line.startswith("wait"):
return "echo:busy processing"
else:
return line
@foosel
foosel / strip_m110_parameter.py
Created Jan 11, 2018
OctoPrint plugin that strips any parameters from M110 commands to work around firmware quirks. Manually place in ~/.octoprint/plugins
View strip_m110_parameter.py
# coding=utf-8
def strip_M110_parameter(comm_instance, phase, cmd, cmd_type, gcode, subcode=None, *args, **kwargs):
if gcode != "M110":
return
return "M110" # make sure we always just send M110, no N parameters or anything else
__plugin_name__ = "Strip M110 Parameters"
__plugin_description__ = "Strips any parameters from M110 commands to work around firmware quirks"
__plugin_author__ = "Gina Häußge"