Skip to content

Instantly share code, notes, and snippets.

@polamjag
Created January 8, 2016 22:11
Show Gist options
  • Save polamjag/9b99ddb9e21fe7b5e03d to your computer and use it in GitHub Desktop.
Save polamjag/9b99ddb9e21fe7b5e03d to your computer and use it in GitHub Desktop.
Send STDIN to Quartz Composer via UDP Multicast in Ruby only with standard components
require 'socket'
while str = STDIN.gets
UDPSocket.new.send(
([str.encode('UTF-16LE').chars.map{|i| i.unpack("H*").first.reverse.rjust(8, "0")}.flatten.join].pack('h*')),
0,
"225.0.0.0", 50000 # hostname (UDP Multicast), port
)
STDERR.puts "sent: #{str}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment