Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am yottatsa on github.
  • I am atsukoito (https://keybase.io/atsukoito) on keybase.
  • I have a public key ASAWhjMc9kARFIPzpL5vkqc_hG_FfiEG-5EheiSzps_2wgo

To claim this, I am signing this object:

@yottatsa
yottatsa / cutpdf.sh
Created Apr 20, 2020
Cutting PDF pages in half
View cutpdf.sh
#!/bin/bash -eux
# Based on https://superuser.com/questions/235074/how-can-i-split-a-pdfs-pages-down-the-middle
sizes () {
pdfinfo -box "${1}" -f 1 -l -1 | grep MediaBox
}
biggest () {
awk '{print $4,$5,$6,$7}' $@ | sort | uniq | sort -n -k 1 -k 2 -k 3 -k 4 -t ' ' -r | head -n1
@yottatsa
yottatsa / sdnotify.py
Created Jan 30, 2019
systemd Service Notification for home assistant
View sdnotify.py
import os
import logging
from datetime import timedelta
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.util import Throttle
REQUIREMENTS = ["sdnotify"]
View gist:fa92ce1e6157f7ebefd067f3dc82a9ed
Jan 30 04:04:34 home hass[17791]: return dt.datetime.now(UTC)
Jan 30 04:04:34 home hass[17791]: TypeError: tzinfo argument must be None or of a tzinfo subclass, not type 'v0p�v0p�v'
@yottatsa
yottatsa / test.log
Created Dec 24, 2018
Testing 50pus6272/05 with new PR Raw
View test.log
(venv) homeassistant@home:~ $ python -m haphilipsjs --debug --host 192.168.1.6 --api 6
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.1.6:1925
DEBUG:urllib3.connectionpool:http://192.168.1.6:1925 "GET /6/system HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Resetting dropped connection: 192.168.1.6
DEBUG:urllib3.connectionpool:http://192.168.1.6:1925 "GET /6/audio/volume HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Resetting dropped connection: 192.168.1.6
DEBUG:urllib3.connectionpool:http://192.168.1.6:1925 "GET /6/channeldb/tv HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Resetting dropped connection: 192.168.1.6
DEBUG:urllib3.connectionpool:http://192.168.1.6:1925 "GET /6/channeldb/tv/channelLists/allcab HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Resetting dropped connection: 192.168.1.6
@yottatsa
yottatsa / test.log
Created Dec 24, 2018
Testing 50pus6272/05 with new PR
View test.log
$ python -m haphilipsjs --debug --host 192.168.1.6 --api 6
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.1.6:1925
DEBUG:urllib3.connectionpool:http://192.168.1.6:1925 "GET /6/system HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Resetting dropped connection: 192.168.1.6
DEBUG:urllib3.connectionpool:http://192.168.1.6:1925 "GET /6/audio/volume HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Resetting dropped connection: 192.168.1.6
DEBUG:urllib3.connectionpool:http://192.168.1.6:1925 "GET /6/channeldb/tv HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Resetting dropped connection: 192.168.1.6
DEBUG:urllib3.connectionpool:http://192.168.1.6:1925 "GET /6/channeldb/tv/channelLists/allcab HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Resetting dropped connection: 192.168.1.6
@yottatsa
yottatsa / re-crypt.sh
Last active Nov 13, 2018
re-crypt asymmetrically encrypted files using symmetric encryption (e.g for back up)
View re-crypt.sh
#!/bin/sh -eu
# this is a self-verifying shell script
exec sh -eu -c "$(gpg -o - --verify "${0}")" "${0}" "$@"
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
#!/bin/sh -eu
set -o pipefail
exec 2>> "${0}.log"
View home-assistant.log
2018-07-21 12:54:14 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform dlna_dmr
Traceback (most recent call last):
File "/Users/yottatsa/Public/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/opt/homebrew/Cellar/python36/3.6.2+_254.20170915/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/opt/homebrew/Cellar/python36/3.6.2+_254.20170915/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/opt/homebrew/Cellar/python36/3.6.2+_254.20170915/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
@yottatsa
yottatsa / home-assistant.log
Created Jul 8, 2018
Urlencoded QUERY_STRING
View home-assistant.log
POST http://192.168.1.6:2870/control/AVTransport
SOAPAction: "urn:schemas-upnp-org:service:AVTransport:3#SetAVTransportURI"
Host: 192.168.1.6:2870
Content-Type: text/xml
Content-Length: 1191
<?xml version="1.0"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
View home-assistant.log
2018-07-08 16:31:35 DEBUG (MainThread) [async_upnp_client.async_upnp_client.traffic] Sending request:
POST http://192.168.1.6:2870/control/AVTransport
SOAPAction: "urn:schemas-upnp-org:service:AVTransport:3#SetAVTransportURI"
Host: 192.168.1.6:2870
Content-Type: text/xml
Content-Length: 1191
<?xml version="1.0"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">