Created
November 28, 2017 18:23
-
-
Save tdierks/0128d9ecc376c9adc6c84be1b1a3d191 to your computer and use it in GitHub Desktop.
A python script to emulate the bandwidth of a modem at certain speed.
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
#!/usr/bin/python -u | |
# Use: modem-speed.py [baud, default 1200] | |
import sys | |
from time import sleep | |
baud = len(sys.argv) > 1 and int(sys.argv[1]) or 1200 | |
cps = baud/10.0 # 10 baud per octet at 8n1 | |
while True: | |
c = sys.stdin.read(1) | |
if c == "": | |
break | |
sys.stdout.write(c) | |
sleep(1.0/cps) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment