Skip to content

Instantly share code, notes, and snippets.

@gdyr
gdyr / GALReplay.ino
Created December 2, 2016 07:21
Replay of GAL hits
#define MX 2
#define A0 3
#define A1 4
#define RW 6
#define A2 7
#define A3 8
#define AL 9
#define DC 11
#define DS 12
var fs = require('fs');
var parse = require('csv-parse');
var transform = require('stream-transform');
var output = [];
var parser = parse({delimiter: ','})
var input = fs.createReadStream('lines.csv');
input.pipe(parser).pipe(transform(function(record, callback){
var pos = record[3];
@gdyr
gdyr / promise.lua
Created December 12, 2019 06:11
Quick Lua Promises (v0.1)
Promise = (function(asyncFunction)
local state = 'pending';
local result;
local rListen, eListen = {}, {};
asyncFunction(function(...)
for _,f in pairs(rListen) do
f(...);
end;
@gdyr
gdyr / list-playlists.lua
Last active January 17, 2023 22:53
List playlists on Q-Sys using Lua
-- First we find all the files in the "playlist" directory
PlaylistFiles = dir.get('media/Playlists/')
-- Next we make a table that's going to contain all our playlist names
PlaylistNames = {}
-- Next we go through the list of playlist files we've found
for _,f in ipairs(PlaylistFiles) do
-- Open the file
@gdyr
gdyr / qsys-b64-img.lua
Created December 30, 2019 19:06
Q-Sys Dynamic button images
--[[
Notes:
- Remove any data:image/type; prefix
- Legend = '' prevents the Style JSON from appearing as the button label
- DrawChrome hides the button itself and just displays the image.
]]
Controls['Artwork'].Style = json.encode({
DrawChrome = false,
@gdyr
gdyr / redis.lua
Last active January 17, 2023 22:52
Q-Sys Redis Client
--[[
Q-Sys Redis Client
Author: Michael Goodyear
Email: michael@locimation.com
Version: 1.1
Copyright 2020 Locimation Pty Ltd
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software
and associated documentation files (the "Software"),

Locimation Stability & Support Tags

Locimation provides a range of open-source software, available at github.com/locimation.

Some projects may make use of undocumented features, or require further testing or development.

As such, we provide two types of graphical label to indicate the current status of the software.

Stability

S = TcpSocket.New();
S.EventHandler = print;
S:Connect(<HOST>, 80);
S.ReconnectTimeout = 0;
function randomWebSocketKey()
return Crypto.Base64Encode(('x'):rep(16):gsub('.', function() return string.char(math.random(0,255)) end));
end;
S.Connected = function()
@gdyr
gdyr / launcher.ps1
Created February 3, 2021 01:30
Automatically launch best Q-Sys Designer version for design file
# Parse design file header
$header = [System.Text.Encoding]::ASCII.GetString((Get-Content $args[0] -Encoding byte -TotalCount 64));
$version = ($header | Select-String -Pattern "Q-Sys Designer, Version=(\d+\.\d+)").Matches.Groups[1].Value;
# Enumerate installed Q-Sys Designer versions
$InstalledSoftware = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall";
$DesignerVersions = @();
foreach($obj in $InstalledSoftware){
$name = $obj.GetValue('DisplayName');
if($name -like "Q-Sys Designer *") {
@gdyr
gdyr / Mono Remote.PNG
Last active March 9, 2022 08:16
JetBrains Rider setup for S# Pro Debugging
Mono Remote.PNG