Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ascii.io - no non-sense asciicasting for seriou...

Marcin Kulik
September 30, 2012

ascii.io - no non-sense asciicasting for serious hackers

My RubyShift 2012 conf talk title "ascii.io - no nonsense asciicasting for serious hackers".

Marcin Kulik

September 30, 2012
Tweet

More Decks by Marcin Kulik

Other Decks in Programming

Transcript

  1. YOU MAY KNOW ME FROM: racksh, ascii.io, git-dude, vim-pasta, bitpocket,

    coloration, stderred... All of them available at https://github.com/sickill/
  2. "Recording the work in your terminal with screen capture software

    and serving it as a video is like recording your text reply as an .mp3 file and sending it via email" - Me.
  3. # man script NAME script — make typescript of terminal

    session DESCRIPTION script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1).
  4. # man scriptreplay NAME scriptreplay - play back typescripts, using

    timing information DESCRIPTION This program replays a typescript, using timing information to ensure that output happens at the same speed as it originally appeared when the script was recorded.
  5. "ASCII.IO is the simplest way to record your terminal and

    share the recordings with your fellow geeks. Simply record and upload your terminal session with single command, and ASCII.IO will play it back in your browser."
  6. it has its STDIN and STDOUT connected to the terminal

    app it forks and execs shell in child process it gets file descriptors for spawned process' STDIN and STDOUT it proxies STDIN and STDOUT and saves STDOUT to a file
  7. works on both Linux and OSX has minimum dependencies has

    simplest possible installation is targetted not at Rubyists only
  8. Renderers 2 AVAILABLE NOW: <pre> based, with "copy & paste"

    <canvas> based, faster, no "copy & paste" TODO: WebGL based one
  9. "tmux is a terminal multiplexer: it enables a number of

    terminals to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached."
  10. $ man tmux capture-pane [-b buffer-index] [-E end-line] [-S start-line]

    [-t target-pane] Capture the contents of a pane to the specified buffer, or a new buffer if none is specified.
  11. $ man tmux save-buffer [-a] [-b buffer-index] path Save the

    contents of the specified paste buffer to path. The -a option appends to rather than overwriting the file.
  12. BACKGROUND JOB THAT: creates new, detached tmux session runs `scriptreplay`

    in it waits for 10 sec runs `tmux capture-pane` runs `tmux save-buffer`
  13. // app/jobs/capture_job.rb class CaptureJob def self.perform(...) system "tmux new -s

    $SESS_ID -d -x $X -y $Y 'scriptreplay ....'" sleep 10 system "tmux capture-pane -t $SESS_ID" system "tmux save-buffer -" system "tmux kill-session -t $SESS_ID &>/dev/null" end end
  14. // script/capture.sh #!/bin/bash tmux new -s $SESS_ID -d -x $COLS

    -y $LINES "scriptreplay ...." sleep 10 tmux capture-pane -t $SESS_ID tmux save-buffer - tmux kill-session -t $SESS_ID &>/dev/null
  15. That's easy create S3 bucket for files easily deploy to

    Heroku export ASCII_IO_API_URL=http://your- app.herokuapp.com in .bashrc
  16. # end of .bashrc if [ -z "$RECORDING" ]; then

    export RECORDING=1 ASCII_IO_API_URL=http://localhost:3000 exec asciiio -y fi Thx @roy & @_solnic_ !