Skip to content

Instantly share code, notes, and snippets.

@creationix
creationix / about.md
Created November 21, 2012 19:21
Parts of a stream interface

The Basics

Every stream has two basic parts

  • data-in - A chunk or EOF enters the stream
  • data-out - A chunk or EOF leaves the stream

I'm combining both "data" and "end" events since "end" is just a special data packet signifying the end of the stream.

Flow Control

@metakeule
metakeule / monitrc
Created March 14, 2012 13:21
node app as daemon with nvm, upstart and monit
# /etc/monit/monitrc (excerpt)
check process node-app with pidfile /var/run/node-app.pid
start program = "/sbin/start node-app" with timeout 5 seconds
stop program = "/sbin/stop node-app"
if failed port 3000 protocol HTTP
request /
with timeout 3 seconds
then restart
if cpu > 80% for 10 cycles then restart