Created
January 8, 2016 22:11
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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