Skip to content

Instantly share code, notes, and snippets.

@gteissier
Created April 29, 2019 04:19
Show Gist options
  • Save gteissier/9fa29cc50be5f26aa0741f14511634c1 to your computer and use it in GitHub Desktop.
Save gteissier/9fa29cc50be5f26aa0741f14511634c1 to your computer and use it in GitHub Desktop.
Asciinema now stores timestamp from the start of the capture. To skip start of the capture, one needs to offset the timestamps from the first kept in the capture.
#!/usr/bin/env python
import sys
import json
start_time = None
for line in sys.stdin.readlines():
o = json.loads(line)
if type(o) != type([]):
sys.stdout.write(line)
else:
if not start_time:
start_time = o[0]
o[0] = o[0]-start_time
sys.stdout.write(json.dumps(o) + '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment