Skip to content

Instantly share code, notes, and snippets.

@mattmattmatt
mattmattmatt / Pioneer VSX-824.md
Last active May 4, 2023 01:08
Control Pioneer amplifier VSX-824 remotely for home automation via Telnet on port 8102.

Telnet in:

telnet 192.168.1.128 8102 Use cmd + alt + 6 to stop transmission, q(uit) to exit telnet.

Telnet and exit:

telnet 192.168.1.128 8102 >> EOF
PO
EOF
Command Function
PO  Power On
PF  Power Off
?P  Query power status
VD  Volume Up
VU  Volume Down
?V  Query volume status
MO  Mute On
MF  Mute Off
@mattmattmatt
mattmattmatt / init.lua
Last active May 7, 2018 07:24
Hammerspoon automation configuration
hs.alert.show('Hammerspoon config loaded')
hotkeyF3 = hs.hotkey.modal.new('', 'f3')
hotkeyF4 = hs.hotkey.modal.new('', 'f4')
hs.window.animationDuration = 0.1
cachedNumScreens = #hs.screen.allScreens()
hs.dockicon.hide()
kodihost = 'http://192.168.1.140'
-------------------------------
-- Auto-reload functionality --
@mattmattmatt
mattmattmatt / getRandomName.js
Created August 9, 2017 23:08
Returns a sufficiently random identifier
function randomIntFromInterval(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
function getRandomName() {
const names = [
'Bear',
'Monkey',
'Space',
'Bird',
@mattmattmatt
mattmattmatt / kodi-jsonp.js
Last active June 30, 2022 16:48
I had a hard time finding the documentation about the Kodi or XBMC JSONRPC API and how to make requests from a browser without running into CORS header problems. Kodi luckily supports JSONP-style requests. So if you can only make GET requests and want to circumvent CORS restrictions, use this JSONP snippet.
// npm i --save jsonp
import jsonp from 'jsonp';
var host = 'http://192.168.1.140';
var data = {
'jsonrpc': '2.0',
'method': 'Application.GetProperties',
'params': '[["volume","muted","version"]]',
'id': Math.ceil(Math.random() * 10000)