Skip to content

Instantly share code, notes, and snippets.

View pschmitt's full-sized avatar
🧠
spaces > tabs

Philipp Schmitt pschmitt

🧠
spaces > tabs
View GitHub Profile
@pschmitt
pschmitt / sherlock_bike.py
Created November 1, 2020 17:03
Home Assistant integration for sherlock.bike
"""
Support for Sherlock.bike GPS trackers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.sherlock_bike/
"""
from datetime import timedelta
import logging
import voluptuous as vol
@pschmitt
pschmitt / tmux-split-ssh.sh
Last active May 30, 2020 15:55
TMUX split and duplicate your current SSH session
#!/usr/bin/env bash
usage() {
echo "Usage: $(basename "$0") ARGS"
echo
echo "Arguments:"
echo " -v|-h Vertical or horizontal split"
echo " --fail Error out if there is no SSH session in the current pane"
echo " --verbose Display a message when spawning a new SSH session/pane"
echo " --no-shell Don't spawn a shell after the SSH command"
@pschmitt
pschmitt / lock.py
Last active May 19, 2020 08:29
Home Assistant: Proposal for merged class for Nuki Locks and Openers
"""Nuki.io lock platform."""
from abc import ABC, abstractmethod
from datetime import timedelta
import logging
from pynuki import NukiBridge, NukiLock, NukiOpener
from requests.exceptions import RequestException
import voluptuous as vol
from homeassistant.components.lock import (
@pschmitt
pschmitt / set_state.py
Created May 17, 2020 09:28
Home Assitant python script to set the state of any entity
# Usage
#
# - service: python_script.set_state
# data_template:
# entity_attr:
# nuki_id: '{{ trigger.json.nukiId }}'
# state: '{{ trigger.json.stateName }}'
# # Attributes
# battery_critical: '{{ trigger.json.batteryCritical }}'
# updated_by: python_script.set_state
@pschmitt
pschmitt / local.conf
Last active October 29, 2020 10:46
Emoji font fix for KDE Plasma 5.19 (Manjaro Linux)
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="font">
<edit mode="assign" name="rgba">
<const>rgb</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hinting">
@pschmitt
pschmitt / cvim.config
Created March 26, 2020 14:45
cvim config
map <C-b> :buffer<Space>
@pschmitt
pschmitt / living_room_speaker
Created June 9, 2018 15:46
Songpal debug output for Sony SRS-ZR7
Setting debug level to 2
DEBUG:root:Using endpoint http://sony-living-room-speaker.lan:54480/sony
DEBUG:songpal.device:Endpoint: http://sony-living-room-speaker.lan:54480/sony
DEBUG:songpal.device:Guide endpoint: http://sony-living-room-speaker.lan:54480/sony/guide
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): sony-living-room-speaker.lan
DEBUG:urllib3.connectionpool:http://sony-living-room-speaker.lan:54480 "POST /sony/guide HTTP/1.1" 200 5630
DEBUG:songpal.device:Got getSupportedApiInfo: {'id': 1,
'result': [[{'apis': [{'name': 'getMethodTypes',
'versions': [{'version': '1.0'}]},
{'name': 'getVersions',
@pschmitt
pschmitt / Dockerfile
Created April 3, 2018 12:05
ARMHF Dockerfile for find3
# docker build -t find3 .
# mkdir /tmp/find3
# docker run -p 11883:1883 -p 8003:8003 -v /tmp/find3:/data -t find3
FROM resin/rpi-raspbian:stretch
ENV GOLANG_VERSION 1.10
ENV PATH="/usr/local/go/bin:/usr/local/work/bin:${PATH}"
ENV GOPATH /usr/local/work
@pschmitt
pschmitt / enable-all-automations.sh
Created October 23, 2017 19:19
Enable all automations on your HASS instance
#!/usr/bin/env bash
HA_URL="$1"
HA_PASSWORD="$2"
_api_call() {
if [[ -n "$3" ]]
then # WITH DATA
curl -qs -X "$1" \
-H "x-ha-access: $HA_PASSWORD" \
@pschmitt
pschmitt / test.py
Created October 23, 2017 17:12
pyteleloisir snippet. Why is pylint complaining about missing members?
import asyncio
import pyteleloisirs
loop = asyncio.get_event_loop()
prg = loop.run_until_complete(pyteleloisirs.async_get_current_program('M6'))
dur = pyteleloisirs.get_program_duration(prg)
rem = pyteleloisirs.get_remaining_time(prg)
print('{} - Remaining time: {}/{}'.format(prg.get('name'), rem, dur))