I have read about Fabrice Bellard's linux simulation in browser.
How does Linux emulator in Javascript by Fabrice Bellard work?
Today I stumbled upon this site, where they are simulating full linux terminal in browser, I am able to run python, perl etc. I know they are running their site on node.js, but I couldn't figure out how they exactly simulating the terminal.
http://runnable.com/UWRl3KlLuONCAACG/read-files-from-filesystem-in-python
The full linux is http://docker.io, the rest is https://github.com/Runnable/dockworker
We're not simulating the terminal but as Kyle says, replicating the terminal over websockets (with an ajax fallback).
In the browser we're using https://github.com/chjj/term.js which was derived from Fabrice Bellard's emulator. It handles the output, and also the keystroke capture.