Skip to content

Instantly share code, notes, and snippets.

@tdierks
Created November 28, 2017 18:23
Show Gist options
  • Save tdierks/0128d9ecc376c9adc6c84be1b1a3d191 to your computer and use it in GitHub Desktop.
Save tdierks/0128d9ecc376c9adc6c84be1b1a3d191 to your computer and use it in GitHub Desktop.

Revisions

  1. tdierks created this gist Nov 28, 2017.
    15 changes: 15 additions & 0 deletions modem-speed.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/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)