Skip to content

Instantly share code, notes, and snippets.

@laclaro
laclaro / commandpad.py
Created November 19, 2016 15:43
A simple keypad controller that executes custom shell commands on keypress, website: https://laclaro.wordpress.com/
#!/usr/bin/env python
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Cofiguration file for commandpad.py
# required:
# q_keycode: number
# modifier_keycode: number
#
#- name: "Human readable name"
# keycode: 83
# cmds1: echo Keycode 83 triggered!
# cmds2: echo Keycode 83 triggered with modifier!
@laclaro
laclaro / kodiIsIdle.sh
Created June 20, 2018 19:26
bash script to detect if kodi is idle
#!/bin/bash
# bash script to detect if kodi is idle. Returns 1 if idle and 0 if kodi was still active recently.
# kodi path
kodi_webpath='http://localhost:8080/jsonrpc'
if [ -f /etc/autosuspend.conf ]; then
idle_time=$(awk -F'=' '/idle_time/{print $2}' /etc/autosuspend.conf \
| sed -e 's/^[ \t]*//')
#!/usr/bin/python
import evdev
from subprocess import check_call
import RPi.GPIO as GPIO
# use BCM numbering
GPIO.setmode(GPIO.BCM)
# volume steps
[Unit]
Description=Rotary volume dial to work with RPi-Jukebox-RFID
After=alsa-restore.service
[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/python /usr/local/bin/rotary-volume.py
[Install]
@laclaro
laclaro / kodi.log
Created July 6, 2019 21:00
kodi debug log
2019-07-06 22:25:25.632 T:1895822048 DEBUG: CLibInputKeyboard::ProcessKey - using delay: 500ms repeat: 50ms
2019-07-06 22:25:25.632 T:1231803104 DEBUG: Thread Timer start, auto delete: false
2019-07-06 22:25:25.642 T:1916192304 DEBUG: Keyboard: scancode: 0x1c, sym: 0x000d, unicode: 0x000d, modifier: 0x0
2019-07-06 22:25:25.776 T:1231803104 DEBUG: Thread Timer 1231803104 terminating
2019-07-06 22:25:25.781 T:1916192304 DEBUG: Keyboard: scancode: 0x1c, sym: 0x000d, unicode: 0x000d, modifier: 0x0
2019-07-06 22:25:25.781 T:1916192304 DEBUG: HandleKey: return (0xf00d) pressed, action is Select
2019-07-06 22:25:25.793 T:1916192304 DEBUG: OnPlayMedia plugin://plugin.video.netflix/?action=play_video&infoLabels=%7B%27rating%27%3A+0%2C+%27writer%27%3A+%27%27%2C+%27episode%27%3A+1%2C+%27plot%27%3A+u%27Rick%2C+Ezekiel+and+Maggie+plot+an+elaborate+attack+on+the+Sanctuary.+Carl+encounters+a+mysterious+stranger+at+a+gas+station.%27%2C+%27season%27%3A+8%2C+%27tvshowtitle%27%3A+u%27The+Walking+Dead%27%2C+%27titl
2020-02-26 15:10:42.745 T:1915455024 DEBUG: Previous line repeats 21 times.
2020-02-26 15:10:42.745 T:1915455024 DEBUG: Activating window ID: 10025
2020-02-26 15:10:43.062 T:1915455024 DEBUG: ------ Window Deinit (Home.xml) ------
2020-02-26 15:10:43.063 T:1915455024 DEBUG: FreeVisualisation() done
2020-02-26 15:10:43.107 T:1915455024 DEBUG: ------ Window Init (MyVideoNav.xml) ------
2020-02-26 15:10:43.107 T:1915455024 INFO: Loading skin file: MyVideoNav.xml, load type: KEEP_IN_MEMORY
2020-02-26 15:10:43.467 T:1915455024 DEBUG: CGUIMediaWindow::GetDirectory (plugin://plugin.video.netflix/)
2020-02-26 15:10:43.468 T:1915455024 DEBUG: ParentPath = [plugin://plugin.video.netflix/]
2020-02-26 15:10:43.470 T:1363145440 DEBUG: Thread waiting start, auto delete: false
2020-02-26 15:10:43.513 T:1377297120 DEBUG: CAddonDatabase::SetLastUsed[plugin.video.netflix] took 44 ms
2020-03-04 22:04:46.279 T:1915266608 NOTICE: ADDON: plugin.video.netflix v0.16.4 installed
2020-03-04 22:17:58.246 T:1426051808 ERROR: CPythonInvoker(5, /home/osmc/.kodi/addons/plugin.video.netflix/addon.py): script didn't stop in 5 seconds - let's kill it
2020-03-04 22:18:01.614 T:1426051808 ERROR: GetDirectory - Error getting plugin://plugin.video.netflix/
2020-03-04 22:18:01.629 T:1915266608 ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.netflix/) failed
2020-03-04 22:18:36.613 T:1915266608 DEBUG: CAddonSettings[plugin.video.netflix]: loading setting definitions
2020-03-04 22:18:36.613 T:1915266608 DEBUG: CAddonSettings[plugin.video.netflix]: trying to load setting definitions from old format...
2020-03-04 22:18:39.876 T:1915266608 DEBUG: CAddonSettings[plugin.video.netflix]: loading setting definitions
2020-03-04 22:18:39.876 T:1915266608 DEBUG: CAddonSettings[plugin.video.netflix]: trying to load setting definitions from old format...
2020-03-04 22:19:43.488 T:1915266608 DEBU
@laclaro
laclaro / privacyidea.log
Created March 10, 2020 11:26
PrivacyIDEA log, complaining about not found directory /etc/privacyidea/gpg
[2020-03-10 12:10:24,329][11480][140689530718016][DEBUG][privacyidea.api.before_after:84] Begin handling of request '/realm/?'
[2020-03-10 12:10:24,329][11480][140689530718016][DEBUG][privacyidea.api.lib.utils:254] Can not get param: Expecting value: line 1 column 1 (char 0)
[2020-03-10 12:10:24,329][11480][140689530718016][DEBUG][privacyidea.lib.user:185] Entering get_user_from_param with arguments ({},) and keywords {}
[2020-03-10 12:10:24,329][11480][140689530718016][DEBUG][privacyidea.lib.user:185] Entering __init__ with arguments (User(login='', realm='', resolver=''),) and keywords {'login': '', 'realm': '', 'resolver': None}
[2020-03-10 12:10:24,329][11480][140689530718016][DEBUG][privacyidea.lib.user:197] Exiting __init__ with result None
[2020-03-10 12:10:24,330][11480][140689530718016][DEBUG][privacyidea.lib.user:197] Exiting get_user_from_param with result <empty user>
[2020-03-10 12:10:24,330][11480][140689530718016][DEBUG][privacyidea.lib.audit:188] Entering getAudit with arguments HIDDEN and ke
@laclaro
laclaro / logging.yml
Created March 18, 2020 09:15
Logging configuration for privacyIDEA used with logstash
# /etc/privacyidea/logging.yml
version: 1
formatters:
detail:
class: privacyidea.lib.log.SecureFormatter
format: >-
[%(asctime)s][%(process)d][%(thread)d][%(levelname)s][%(name)s:%(lineno)d]
%(message)s
handlers: