This file contains 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
function init(hostname, ip) { | |
const dgram = require('dgram'); | |
const srv = dgram.createSocket({ type: 'udp4', reuseAddr: true, recvBufferSize: 2000 }); | |
srv.addMembership('224.0.0.251', ip); // Bounjour link-local multicast IP | |
const socket = srv.bind(5353, function(bound) { | |
function onDatagram(msg, rinfo) { | |
//console.log('>MEM', JSON.stringify(process.memory())); | |
//console.log('MSG', msg.length, rinfo.address, rinfo.port); | |
try { |
This file contains 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
# Compress and decompress byte array | |
function Get-CompressedByteArray { | |
[CmdletBinding()] | |
Param ( | |
[Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)] | |
[byte[]] $byteArray = $(Throw("-byteArray is required")) | |
) | |
Process { |