Skip to content

Instantly share code, notes, and snippets.

@amlweems
Created March 14, 2016 02:49
Show Gist options
  • Save amlweems/eed5179dd9677fe80d3e to your computer and use it in GitHub Desktop.
Save amlweems/eed5179dd9677fe80d3e to your computer and use it in GitHub Desktop.
asciinema at lightning speeds
#!/usr/bin/env python3
""" speeder.py
Speed up your asciinema casts by an arbitrary factor.
Assumes your recording is stored at ./new and outputs a new recording at ./newer.
"""
import json
import sys
if len(sys.argv) != 2:
print("Usage: %s <factor>" % sys.argv[0])
sys.exit(1)
factor = int(sys.argv[1])
blob = open('new').read()
with open('new') as f:
blob = json.load(f)
for k in blob['stdout']:
k[0] /= factor
with open('newer', 'w') as f:
json.dump(blob, f)
@ku1ik
Copy link

ku1ik commented Mar 15, 2016

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment