Skip to content

Instantly share code, notes, and snippets.

View coding-lemur's full-sized avatar

René Schimmelpfennig coding-lemur

View GitHub Profile
@coding-lemur
coding-lemur / shutdown.py
Last active September 1, 2017 07:18
raspberry pi 3 shudown button
import RPi.GPIO as GPIO
import os
BUTTON_PIN = 14
GPIO.setmode(GPIO.BCM)
GPIO.setup(BUTTON_PIN, GPIO.IN)
try:
channel = GPIO.wait_for_edge(BUTTON_PIN, GPIO.RISING)
@coding-lemur
coding-lemur / flow.json
Created November 28, 2019 21:16
node-red flow - presence detection
[
{
"id": "6a823385.834cbc",
"type": "tab",
"label": "AWTRIX",
"disabled": false,
"info": ""
},
{
"id": "91c2dade.0c6518",
@coding-lemur
coding-lemur / imap_cleanup.py
Created July 26, 2020 13:13
I redirect an copy of my mails to my Gmail account. But the original message always remains in my provider's IMAP mailbox. To save disk space this script helps me to delete old emails automatically. This script was inspired by https://gist.github.com/Rathgore/2597705
from imapclient import IMAPClient, DELETED
import datetime
SERVER = 'imap.yourdomain.com'
USERNAME = 'mail'
PASSWORD = '1234567890'
FOLDER = 'INBOX'
MAX_DAYS = 90 # emails older than was deleted
@coding-lemur
coding-lemur / store.helper.ts
Created October 17, 2020 14:43
Helper functions to work dictionaries on #angular #ngrx
export interface HasId {
id: string;
}
export interface HasOrderIndex {
orderIndex: number;
}
export interface Dictionary<T extends HasId> {
[id: string]: T;
}
@coding-lemur
coding-lemur / enum.helper.ts
Created November 6, 2020 12:34
Abstract enum handling for TypeScript
export class EnumHelper {
/** check if the enum contains the value (case-insensitive) */
static hasEnumValue<T>(enumObject: T, enumValue: string): boolean {
const hasEnumValue = Object.values(enumObject)
.map((v) => v.toString().toLowerCase())
.includes(enumValue?.toLowerCase());
return hasEnumValue;
}
@coding-lemur
coding-lemur / configure gyro sensor for klipper.md
Last active April 9, 2025 18:00
Klipper Config for measuring tesonances with adxl345 sensor

Steps

  • connect Pico via USB to Klipper Raspberry Pi
  • Get the correct serial path with ls /dev/serial/by-id/*
  • Add following file into klipper: adxl.cfg
  • Content:
[mcu pico]
serial: /dev/serial/by-id/usb-Klipper_rp2040_mySerial
@coding-lemur
coding-lemur / automatisierung_a.md
Created April 9, 2025 17:57
3D Drucker automatisch ausschalten mit Home Assistant

Automatisierung A ("3D Drucker auf fertig setzen")

alias: 3D Drucker auf fertig setzen
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.prusaprinter
 from: busy