Skip to content

Instantly share code, notes, and snippets.

@paulvictor
Created June 21, 2019 03:33
Show Gist options
  • Select an option

  • Save paulvictor/031f82ea038fa4b340ab75e220cdb1c1 to your computer and use it in GitHub Desktop.

Select an option

Save paulvictor/031f82ea038fa4b340ab75e220cdb1c1 to your computer and use it in GitHub Desktop.
Simulating a stream from a file
#!/usr/bin/env bash
i=0
ratePerSecond=1000000
port=5000
ratePerMS=$(($ratePerSecond/100))
while [ true ]
do
toRead=$((i*$ratePerMS))
b=`head $toRead $1 | tail -$ratePerMS`
i=$((i+1))
echo $b; sleep 0.01
done | nc localhost $port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment