Skip to content

Instantly share code, notes, and snippets.

@kaissi
Forked from TooTallNate/bbs.js
Created August 22, 2017 01:21
Show Gist options
  • Save kaissi/1660920fd1ec1ffa2cdd0f415af0ab5a to your computer and use it in GitHub Desktop.
Save kaissi/1660920fd1ec1ffa2cdd0f415af0ab5a to your computer and use it in GitHub Desktop.

Revisions

  1. @TooTallNate TooTallNate revised this gist Apr 29, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bbs.js
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,7 @@ var server = http.createServer(function (req, res) {
    // log
    console.log(req.headers['user-agent'])

    // hack to thread stdin and stdout in
    // hack to thread stdin and stdout
    // simultaneously in curl's single thread
    var iv = setInterval(function () {
    res.write(buf0)
  2. @TooTallNate TooTallNate revised this gist Mar 28, 2012. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions bbs.js
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,7 @@ var server = http.createServer(function (req, res) {
    , input: req
    , output: res
    , terminal: false
    , useColors: true
    , useGlobal: false
    })

  3. @TooTallNate TooTallNate revised this gist Mar 26, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions bbs.js
    Original file line number Diff line number Diff line change
    @@ -14,8 +14,8 @@ var server = http.createServer(function (req, res) {
    res.write('Welcome to the Fun House\r\n')
    repl.start({
    prompt: 'curl repl> '
    , input: req,
    , output: res,
    , input: req
    , output: res
    , terminal: false
    , useGlobal: false
    })
  4. @TooTallNate TooTallNate revised this gist Mar 26, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion bbs.js
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,8 @@ var server = http.createServer(function (req, res) {
    res.write('Welcome to the Fun House\r\n')
    repl.start({
    prompt: 'curl repl> '
    , socket: { stdin: req , stdout: res }
    , input: req,
    , output: res,
    , terminal: false
    , useGlobal: false
    })
  5. @TooTallNate TooTallNate revised this gist Mar 26, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bbs.js
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ var server = http.createServer(function (req, res) {
    repl.start({
    prompt: 'curl repl> '
    , socket: { stdin: req , stdout: res }
    , enabled: false
    , terminal: false
    , useGlobal: false
    })

  6. @TooTallNate TooTallNate revised this gist Mar 26, 2012. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions bbs.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,5 @@
    /**
    * Currently requires my tty-readline-migration branch:
    * https://github.com/TooTallNate/node/compare/tty-readline-migration
    * Requires node v0.7.7 or greater.
    *
    * To connect: $ curl -sSNT. localhost:8000
    */
  7. @TooTallNate TooTallNate revised this gist Mar 16, 2012. 2 changed files with 52 additions and 32 deletions.
    59 changes: 34 additions & 25 deletions bbs.js
    Original file line number Diff line number Diff line change
    @@ -1,27 +1,36 @@
    var http = require('http');
    var buf0 = new Buffer([0]);
    /**
    * Currently requires my tty-readline-migration branch:
    * https://github.com/TooTallNate/node/compare/tty-readline-migration
    *
    * To connect: $ curl -sSNT. localhost:8000
    */

    var http = require('http')
    , repl = require('repl')
    , buf0 = new Buffer([0])

    var server = http.createServer(function (req, res) {
    res.setHeader('content-type', 'multipart/octet-stream');
    res.write('Welcome to the Fun House\r\n');
    res.write('> ');

    req.on('data', function (buf) {
    res.write(buf);
    res.write('> ');
    });

    req.on('end', function () {
    res.end();
    });

    console.log(req.headers['user-agent']);
    var iv = setInterval(function () {
    res.write(buf0);
    }, 100);

    res.connection.on('end', function () {
    clearInterval(iv);
    });
    });
    server.listen(8000);
    res.setHeader('content-type', 'multipart/octet-stream')

    res.write('Welcome to the Fun House\r\n')
    repl.start({
    prompt: 'curl repl> '
    , socket: { stdin: req , stdout: res }
    , enabled: false
    , useGlobal: false
    })

    // log
    console.log(req.headers['user-agent'])

    // hack to thread stdin and stdout in
    // simultaneously in curl's single thread
    var iv = setInterval(function () {
    res.write(buf0)
    }, 100)

    res.connection.on('end', function () {
    clearInterval(iv)
    })
    })
    server.listen(8000)
    25 changes: 18 additions & 7 deletions output
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,19 @@
    substack : http-bbs $ curl -sSNT. localhost:8000
    ☮ ~ (master) ⚡ curl -sSNT. localhost:8000
    Welcome to the Fun House
    > beep
    beep
    > boop
    boop
    > ^C
    substack : http-bbs $
    curl repl> process.platform
    'darwin'
    curl repl> process.arch
    'x64'
    curl repl> process.cwd()
    '/Users/nrajlich'
    curl repl> path
    { resolve: [Function],
    normalize: [Function],
    join: [Function],
    relative: [Function],
    dirname: [Function],
    basename: [Function],
    extname: [Function],
    _makeLong: [Function] }
    curl repl> ^C
    ☮ ~ (master) ⚡
  8. James Halliday revised this gist Oct 17, 2011. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions output
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    substack : http-bbs $ curl -sSNT. localhost:8000
    Welcome to the Fun House
    > beep
    beep
    > boop
    boop
    > ^C
    substack : http-bbs $
  9. James Halliday created this gist Oct 17, 2011.
    27 changes: 27 additions & 0 deletions bbs.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    var http = require('http');
    var buf0 = new Buffer([0]);

    var server = http.createServer(function (req, res) {
    res.setHeader('content-type', 'multipart/octet-stream');
    res.write('Welcome to the Fun House\r\n');
    res.write('> ');

    req.on('data', function (buf) {
    res.write(buf);
    res.write('> ');
    });

    req.on('end', function () {
    res.end();
    });

    console.log(req.headers['user-agent']);
    var iv = setInterval(function () {
    res.write(buf0);
    }, 100);

    res.connection.on('end', function () {
    clearInterval(iv);
    });
    });
    server.listen(8000);