Skip to content

Instantly share code, notes, and snippets.

View foosel's full-sized avatar
🐙
Working full-time on OctoPrint!

Gina Häußge foosel

🐙
Working full-time on OctoPrint!
View GitHub Profile
@foosel
foosel / stl_to_svg.scad
Created December 7, 2021 13:59
STL to SVG conversion script using OpenSCAD. Takes an STL and projects it to the defined plane (default: XY), then saves the result as SVG.
FileToLoad = "";
Plane=0; // 0: XY, 1: XZ, 2: YZ
echo("File:", FileToLoad);
projection() {
if (Plane == 0) {
echo("Plane: XY");
import(FileToLoad);
} else if (Plane == 1) {
echo("Plane: XZ");
@foosel
foosel / README.md
Last active January 11, 2024 20:23
OBS script that updates the YouTube livechat URL on a browser source on stream start.

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 / mjpg-streamer.default
Created December 30, 2013 18:37
MJPG-Streamer init/default scripts by Sami Olmari (mirrored from http://pastebin.com/Eu5Cytk1 and http://pastebin.com/QCtC1sLc)
# Configuration for /etc/init.d/mjpg-streamer
# The init.d script will only run if this variable non-empty.
MJPG_STREAMER_USER="pi"
# Where mjpg-streamer is installed, this is important!
DAEMON_HOME=/home/pi/mjpg-streamer
# What arguments to pass to mjpg-streamer, here is few examples; You can change them by commenting one and
# uncommenting another:
@foosel
foosel / .Xmodmap
Created January 31, 2021 23:45
KMonad config to turn a ThinkPad X240 keyboard UHK alike. Combined with .Xmodmap for german umlauts and fixed ins/end shenanigans.
! 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 / README.md
Last active January 12, 2023 16:25
Getting the fingerprint reader of a Thinkpad x240 to work under Ubuntu 14.04

lsusb lists the fingerprint reader in the x240 as follows:

Bus 002 Device 003: ID 138a:0017 Validity Sensors, Inc.

There exists experimental driver support for this in a fork of libfprint for vfs5011 sensors, however you'll need to compile the driver yourself. To get the fingerprint sensor to work for lightdm login, su etc, follow these steps.

  1. Install fingerprint-gui:

    sudo add-apt-repository ppa:fingerprint/fingerprint-gui
    
@foosel
foosel / email_to_paperless.md
Created January 29, 2022 14:13
Email to Paperless Flow for NodeRed

Flow

[
    {
        "id": "c4be0c03394f3820",
        "type": "e-mail in",
        "z": "8357254d.c82348",
        "name": "Labeled \"paperless\"",
        "protocol": "IMAP",
@foosel
foosel / m33_storm.py
Last active September 15, 2021 13:24
Requests long names for files on printer's SD card via M33. OctoPrint 1.4.2+. No maintenance, no support.
# -*- 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
@foosel
foosel / README.md
Last active July 25, 2021 14:09
OctoPrint Filetab plugin & configuration instructions

Moving the "Files" component from the sidebar to the tab section

  1. Create .octoprint/plugins/filetab, .octoprint/plugins/filetab/templates and .octoprint/plugins/filetab/static/css
  2. Copy __init__.py to .octoprint/plugins/filetab
  3. Copy filetab_tab.jinja2 to .octoprint/plugins/filetab/templates
  4. Copy filetab.css to .octoprint/plugins/filetab/static/css
  5. Optional: Adjust the appearance.components.tab.order to list plugin_filetab in .octoprint/config.yaml if you want the "Files" tab to be placed somewhere else than after the regular tab components, e.g.:
@foosel
foosel / rewrite_wait_to_busy.py
Last active February 10, 2021 22:36
OctoPrint plugin that rewrites received wait responses to echo:busy processing for broken firmware misunderstanding when wait should be used. Place in ~/.octoprint/plugins
# 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 / NodeRed flow for GitHub Review Reminders.md
Last active January 27, 2021 04:17
NodeRed flow for GitHub Review Reminders

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