Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Asciinema (asciinema.org)
513 points by jmduke on June 21, 2015 | hide | past | favorite | 90 comments


ttyrec is a tiny terminal utility that does this on your terminal. It was released in 2000, it's one of those nice little gems one is glad to discover. It records and playbacks terminal sessions. The recorded files are in kb's. [1]

It's simple to use. 'ttyrec filename' starts recording, ctrl-c to stop recording. 'ttyplay filename' to playback.

Of course with asciinema.org, you get the benefit of an html player for the files, that you can link and playback on your own website.

[1]http://0xcc.net/ttyrec/index.html.en [2]http://manpages.ubuntu.com/manpages/maverick/man1/ttyrec.1.h...


I first came across ttyrec for use in saving NetHack replays.

http://alt.org/nethack/


You know this calls for a ttyrec html player...!


I’ve spent the last week producing just that, and I’m just applying final polish before publishing it. It’s a drop-in replacement for <video>.



Looks like your link was somehow submitted with a null title: your thread appears broken to me. :)


Seriously when people will stop using that for installation....

"curl -sL https://asciinema.org/install | sh"

Still a cool product!


This is something I have been fighting with in my head for quite a while. "Piping shit into sh" is not really great way to do it, I fully agree. Let me describe you the situation.

At the moment there are native packages for Ubuntu/Debian (ppa) and Fedora/CentOS (in core repo). There's also homebrew package and Arch Linux one (aur). There are 2 nice guys who maintain the first two packages, doing great job, but it always takes time until the packages are ready (we're all doing it in our spare time, and there's process, especially Fedora case, which you can't skip). I maintain Arch Linux one (while not using Arch for more than few years now) but this one's usually ready on the release day.

There are no packages for other distros, but we'll never be able to provide ones for all distros (unless we're very popular project with lots of contributors). That's fine.

But there are also situations like this: https://bugs.gentoo.org/show_bug.cgi?id=532918 Let's not get into "Go packaging" discussion again, but what you can see in the mentioned Gentoo thread there's always some problem (no vendoring is bad, vendoring is bad). Sure, these guys do this too in their spare time and they don't owe me anything.

But when seeing this I'm like "oh boy, packaging is hard, I don't have time for dealing with this". So time (or lack of thereof) is one thing. Next thing is: "apt-get install asciinema" or "brew install asciinema" is awesome because it uses your software package manager and it's a single command. For all other distros (and people wanting new version right now) you can curl/sh which is equally easy. "First download this script, then review it, then run it" is not that hard but most people wouldn't review the script anyway, and those who would are the ones who are doing that now anyway. curl/sh sucks on many fronts but I made sure the script doesn't get executed when partially downloaded and it's not "| sudo sh".

I'm thinking about using one of these services which auto-build deb/rpm, they host them as apt/yum repos etc. There are few of them out there so if anyone can point me to any "proven/reliable" one I'd appreciate that. Any suggestions on the topic are welcome!


I added an RPM package to a project that used a Makefile to spin up a docker container which then built various packages via FPM:

https://github.com/jordansissel/fpm

I didn't use the build system heavily and it may be more overhead than you'd like but I thought it was a pretty neat way of doing things. Repo is here:

https://github.com/tutumcloud/tutum-agent


What's wrong with that? It is SSL secured.

Once you agree to install software, it had local access with your accounts privileges.


piping random shit into sh is wrong because domains go away, yet installation instructions might be repeated in countless other tutorials. easy to snap up domains and host malware.

and SSL has nothing to do with it. packages are not cryptographically signed either and once on the system can easily become root.


Would this be better if the pasted command included some checksum which was checked before piping into the `sh`? Can anyone who's better at bash than me give an example of how this could work in a relatively cross-platform way?


You would need to have a GPG signature with a well-known public key that is verified before executing the code.


Sorry, can you explain why? If the checksum is provided (as part of the sh snippet) by the website with the SSL certificate, isn't that enough reassurance?


If the snippet and the download are on the same site, then whoever controls that site at the moment can provide an accurate checksum of whatever malware they want to host. A signature is an improvement because it can give you some confidence that the current controller is the same as the original controller.


> Would this be better if the pasted command included some checksum which was checked before piping into the `sh`?

hashpipe does exactly that:

https://github.com/jbenet/hashpipe


If you are doing a terminal video, I'm pretty sure you are smart enough to break down that pipe and first download, and then run it.


So why not make that the way the instructions tell you to do it?


Because as other commenters have said, anyone interested in doing that will do it anyways.


But isn't that the behavior we want to encourage everyone to have? Most people will do the default: if the default is wrong, they don't care. If the default is right, they still don't care, but at least they're doing it right.


Once you've installed it you've given local privileges (or even root) to the app, so you're hosed anyway.


I think the bigger danger is that since you're instructing a direct pipe-to-sh over the network without regard to exit status, you're running the risk of executing truncated code that could trash your system state.


The author addresses this issue by wrapping the script [1] in {} braces:

    { # Prevent execution if this script was only partially downloaded
    # installation code here
    } # End of wrapping
I'm not sure if this is a bulletproof solution.

[1] https://asciinema.org/install


That's correct. In case bash doesn't see closing braces it will error out with "syntax error" and won't execute anything.


It's pretty rare for an app to need root privileges. You typically need root to write to the system dirs (/usr/* /bin etc). And in this particular case, the app has access (by design) to your terminal, so yeah, you need to trust the app a bit. But why would you need to demand all users of your system (even if that's just system users) also trust it?

Put it in ~/opt with xstow, and add ~/opt/bin to your path, ~/opt/man to your man-path, ~/opt/include, ~/opt/lib... to the various paths.

In this case, it seems like a lot of effort to get a tgz-archive just to download a single executable. I gather it's distributed as an archive in order for the Changelog, Readme and License to be available -- but as it's all downloaded from github anyway, it's hard to see why that really matters (rather than just have -h spit out a link or two).

As, if you're using a normal, full-featured web browser, there's no way of knowing if what you select, is what you copy and then paste -- it would probably be better to just link directly to the latest binary release for the various platforms (linux32, linux64, linux-arm, OSX 32bit, OSX 64bit) -- and let the user save the binary somewhere.

Limit the "command line instructions" to:

  go get github.com/asciinema/asciinema
rather than fighting idiomatic go practices.

If you really want to be clever, why not just use 0install?

http://0install.net/


> packages are not cryptographically signed either

Eh? Both debs and rpms can be signed with GPG keys.


You won't be so happy when your https connection drops after "/" as you are piping into /bin/sh:

  rm -rf /$INSTALLER_TEMP_DIR



We evolved packaging systems for a reason - they provide a standardized way to manage dependencies, provide clean uninstalls, etc... Having a shellscript pooping files arbitrarily into the filesystem is so 90's.

Seriously - you pretty much just have to make a .dep and a .rpm and you're covered. Is that so hard?


> you pretty much just have to make a .dep and a .rpm and you're covered

Author already did that [1] and has both .deb and .rpm:

https://asciinema.org/docs/installation


When there will be a better alternative.


There's no better alternative for a very good reason.


I find the timing of this amusing—I was just, in putting the finishing touches on my own project <tty-player> which is basically <video> but with ttyrec scripts for src, writing down my analysis of all the different options there are out there, and I saw this entry up here just as I was writing about asciinema.

asciinema’s player has the distinction of being the only one I know of not based on term.js (https://github.com/chjj/term.js).


On the subject of amusing names, since this one looks so similar to "ascii enema", wouldn't yours be the "titty player"? :-)


I've been using Asciinema and personally I love this product. I don't have to make my recordings for demos or presentations nor do I have to do live presentations, just pre-record and let everyone view it themselves while I present so they can follow along at their own pace.

Its been great as a teaching tool as well. We've been running it on our internal network but its always hilarious to see which people accidentally have it running so we get to see people do some really dumb shit during their terminal sessions.



I've stayed away from Showterm because it relies on a big rat's nest of Ruby deps. Looks like this one is written in Go, which is convenient.


Are these related?


Only in the sense that they are pretty much dead-on the same thing and Showterm has been around a lot longer and is in wider use.


When I see "previously" on HN, I tend to think "this was previously posted to HN." In this case, I thought the poster was indicating that asciinema.org was previously showterm.io - neither is the case.


asciinema was initially called ascii.io. It got renamed about 2 years ago.


No, shorterm wasn't around longer. I created asciinema in 2011.


I was really hoping this was short animated clips of famous movie scenes rendered in ASCII.



Now that is what I was hoping for.


Why does it have to be in the cloud? Can't you guys provide a player in html css whatever and the recording program to generate data files for the player so we can use your technology everywhere and are not tied to this website and its hosting policies?

/rant


Code is open source, install it https://github.com/asciinema/asciinema.org

Link is in the FAQ.


asciinema dev here. Please read my comment on the topic here: https://github.com/asciinema/asciinema.org/issues/186#issuec...

Btw, the player is already a separate project: https://github.com/asciinema/asciinema-player/tree/next


I love script[1,2] for this sort of thing. Why wait for a video to play? Or host it on a third-party site? Having the entire session visible on a single, static page is less frustrating in most circumstances I encounter.

Having said that, Asciinema certainly looks like fun.

[1] http://unixhelp.ed.ac.uk/CGI/man-cgi?script [2] Sample session: https://tinyapps.org/blog/nix/201107170745_copy_terminal_tex...


I was thinking the same thing... but then I realized it works, say, for an ed session, but not for a vi session. Of course, all that visual mode nonsense is just bloatware ;).


When I use an editor, I don't want eight extra KILOBYTES of worthless help screens and cursor positioning code! I just want an EDitor!! Not a "viitor". Not a "emacsitor". Those aren't even WORDS!!!! ED! ED! ED IS THE STANDARD!!!

http://www.gnu.org/fun/jokes/ed.msg.html


This reminded me about the Dwarf Fortress Map Archive, where you can play back ASCII recordings through a flash player: http://mkv25.net/dfma/browsemovies.php

Dwarf Fortress records the game to CMV format: http://dwarffortresswiki.org/index.php/User:Jifodus/CMV_file...


Looks great. But I think quite a few people (the audience with which the recording would be shared) would like to see the entire session at once instead of watching the entire video. It would also be helpful for the writer to quickly verify if they missed something.


Yeah maybe a button to "View Transcript"


From the title I was expecting this to be a link to http://www.asciimation.co.nz/ :-)


A better title for the submission is "Asciinema: Record and share your terminal sessions" (extracted from the main header of the page)


Is there any solution for me wanting to have my recordings be private, or only distributable within a small group?


With an account your recordings are private by default.


I quite like this service, used it a couple of months ago (http://steinn.org/post/brute-force-still-going-strong/) although I would love it if I could change my terminal dimensions (char width/height) after recording. That way I could make the terminal window fit the surrounding container on my blog.

But A+ for usability :-)


That might be against the point of this project, but I really miss the possibility of an audio-overlay. I found the demo really stress- and unhelpfull, because you have to read rockey text while typed in absolute silence… brrr. I'd rather talk while typing and explain what I am doing and have that synched to the recorded text-session.


Wanted (or at least I wanted last time this came up): (Multiple) terminal streams in an OGG container (or similar) and integration in VLC/mplayer. Could make for nice precise output in addition to regular video instead of just having either the raw terminal or a video only screencast.


This is very cool. I'd love to adapt it to help members of my team collaborate and share workflows, but GPL makes it hard to integrate with any internal tooling.


Should be fine as long as you're not distributing binaries, and the code stays internal.


If you don't know about it, check out the unix command 'script'. You can use it to stream or record terminal sessions.


I have used Asciinema couple of weeks now and I am very happy with it.

Our open source project contains a command line tool for Docker orchestration and Asciinema is a perfect solution to introduce its features and use cases (https://asciinema.org/~kontena).


It's be great to have a polished product like this but for programming sessions in a text editor like Sublime.


Just curious, what benefit would this have over something like git? Just to show your programming process?


Looking at a git diff is one thing, but seeing the commit as it was coded would introduce the dimension of time; giving you better context for how everything came together.

Add some interactive controls for slow-mo/fast-forward or scrubbing forward/back and you would have a powerful tool for learning & review.


some people like to watch a screencast video instead of reading through documentation. It's not a bad way to get introduced to a new language or framework, for example.


Another option for the common case of static output is to render command or script(1) outout directly to static html with something like http://www.pixelbeat.org/scripts/ansi2html.sh


I'm not sure why, but when viewing the recordings in full screen on my Galaxy S5 in landscape mode, a bottom portion of the cast is cut out. For example in the irssi/tmux cast, I don't see the commands typed below the status bar.


I'm disappointed to see this getting so much traction when showterm.io is clearly the superior product with rewinds, custom speeds, scrolling up and down and linking to a specific point in time, and has been around so much longer. Here is an example of a longer Showterm session: http://showterm.io/a0616ce5e6f411f292e18 taken from http://www.bitfalls.com/2013/08/autofight-php-job-interview-...


asciinema is here since 2011 (although it was called ascii.io until 2 years ago).

As for rewinds, you can click on the progress bar to jump to a time you want. Also, the upcoming version of the player supports fast-forward/rewind/jump keyboard shortcuts: https://github.com/asciinema/asciinema-player/blob/next/src/...

As for the playback speed you can set speed, theme, font size etc (embedding docs say this - https://asciinema.org/docs/embedding), and you can append these options to any asciicast URL too, like this: https://asciinema.org/a/21743?speed=5&theme=solarized-dark

Looks like these are not easily discoverable from the player UI, so noting this down. Thanks for bringing this up!


Ok, that's quite a bit of news. Thanks for clarifying, shines a new light on things.


That is cool and all, but its really really annoying the amount of history that thing throws at your browser.

Took about 10 tries of going back as far as the history would allow to get back here. I hate sites that do that junk.


I was about to write few blog post about hacking some websites and servers, now it's pretty cool to record live and post later to blog.


It's really bad to curl | sh. You shouldn't do it, and you shouldn't recommend doing it...

The app looks neat though, good job



I really love lolcat. It makes my day. I'm making alias and adding lolcat -f allover my bashrc files now :-)


How does it work?



Impressive.


Cool product and nice execution, but I'm a little stuck on the name. I keep reading it as ascii-enema.


It's obviously supposed to be "ass cinema"



Me too. Is this a sort of allusion to something?


It's supposed to read as a portmanteau of "ASCII" and "cinema", but yeah, I can see the misreading.


Oh that makes sense, as it is quite close in spelling. I have been reading as (As-Key-Nema).


You were reading it right :) I guess I should add spelling info to the site ;)


Askee-neema...? (ASCII)-nema




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: