Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
I may be slow to respond.

Lucio Paiva luciopaiva

🐢
I may be slow to respond.
View GitHub Profile
View async_test.py
from tornado.testing import AsyncHTTPTestCase, gen_test
from tornado.web import Application
from tornado.web import RequestHandler
from tornado.gen import coroutine, Return
class HelloHandler(RequestHandler):
@coroutine
@markdaws
markdaws / flushStdOutAndErrOnExit
Created Aug 11, 2011
Shutting down node.js and flushing stdout and stderr
View flushStdOutAndErrOnExit
function flushAndShutdown(exitCode) {
if(process.stdout.flush()) {
process.exit(exitCode);
}
else {
process.stdout.on('drain', function() {
process.exit(exitCode);
})
}
}
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active Dec 23, 2021
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
View node-and-npm-in-30-seconds.sh
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh