Skip to content

Instantly share code, notes, and snippets.

@honza
honza / sigterm.py
Created April 6, 2012 22:22
Sigterm handler in Python
"""
This snippet shows how to listen for the SIGTERM signal on Unix and execute a
simple function open receiving it.
To test it out, uncomment the pid code and kill the process with:
$ kill -15 pid
"""
import signal
import sys
@askvictor
askvictor / lms-cec.py
Last active June 23, 2017 20:14
Squeezebox/LMS send CEC command when play starts
#!/usr/bin/env python
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import unquote
import select, socket
import cec
config = {
'lms_server': ('192.168.1.10', 9090), # IP of your Squeeze Server, and the network control port (usually 9090)