Skip to content

Instantly share code, notes, and snippets.

@mattn
Created January 17, 2019 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mattn/eafc3a979406a55bd241493778c948f5 to your computer and use it in GitHub Desktop.
Save mattn/eafc3a979406a55bd241493778c948f5 to your computer and use it in GitHub Desktop.
package main
import (
"flag"
"os"
"time"
)
func main() {
var n int
var s time.Duration
flag.IntVar(&n, "n", 100, "bytes")
flag.DurationVar(&s, "s", 100, "sleep")
b := make([]byte, n)
for {
time.Sleep(s * time.Millisecond)
os.Stdin.Read(b)
}
}
function! s:test() abort
let job = job_start(['slow', "-n", "500", "-s", "1ms"], {'noblock': 1, 'mode': 'raw' })
let ch = job_getchannel(job)
let n = 0
while 1
call ch_sendraw(ch, '0123456789')
redraw
let n += 10
echo n
endwhile
endfunction
call s:test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment