This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export JAVA_HOME=/opt/java/current | |
export EC2_PRIVATE_KEY=/home/ubuntu/cloudstrap.io/modules/amazon/files/certs/pk.pem | |
export EC2_CERT=/home/ubuntu/cloudstrap.io/modules/amazon/files/certs/cert.pem | |
export EC2_HOME=/opt/ec2-api-tools-1.5.3.1 | |
export PATH=$PATH:$EC2_HOME/bin | |
ec2-describe-tags --filter "resource-type=instance" --filter "key=node" | while read x; | |
do | |
node=`echo $x | awk '{print $5}'` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Show how to handle Ctrl+C in Node.js | |
var zmq = require('zmq') | |
, socket = zmq.createSocket('rep'); | |
socket.on('message', function(buf) { | |
// echo request back | |
socket.send(buf); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- This should be served by your server --> | |
<script src="/socket.io/socket.io.js"></script> | |
<script> | |
var socket = io.connect('http://localhost'); | |
socket.on('news', function (data) { | |
console.log(data); | |
socket.emit('my other event', { my: 'data' }); | |
}); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
infrastructure | |
.discover('solr') | |
.enter(function(instance) { // when a new instance has announced itself or come online again | |
// instance.port | |
// instance.core | |
// instance.ip | |
// instance.ttl | |
}) | |
.exit(function(instance) { // when an instance has left | |
// when an instance has left we can now unregister it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cloudfront = require('./cloudfront.io'); | |
var infrastructure = new cloudfront.infrastructure(); | |
// announce that there is a memcache instance available | |
// to the collective | |
infrastructure.announce('memcache', { | |
ip: '<yourip>', | |
port: '<yourport>', | |
tag: '<sometag you care about>' | |
}, 5000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cloudfront = require('./cloudfront.io'); | |
var infrastructure = new cloudfront.infrastructure(); | |
infrastructure.discover('memcache') | |
.enter(function(instance, done) { | |
// do something when a new memcache instance joins | |
done(); // callback required for ATOMIC acknowledgement (same concept as QUnit) | |
}) | |
.exit(function(instance, done) { | |
// do something when an instance has leaves |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ab -v 2 -c 30 -n 100 "http://www.yourdomain.com/" | grep -ohE "Set-Cookie: jspsession=..........................." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var zmq = require('zmq'), | |
sock = zmq.socket('push'), | |
_ = require('underscore'); | |
// increase swap for high water mark | |
zmq.options.swap = 1024; | |
zmq.options.hwm = 0; | |
// zmq.options.rate = 800000; | |
sock.bind('tcp://127.0.0.1:3000', function(err) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var zmq = require('zmq') | |
, sock = zmq.socket('pull'); | |
// increase swap for high water mark | |
zmq.options.swap = 1024; | |
zmq.options.hwm = 0; | |
// zmq.options.rate = 800000; | |
sock.connect('tcp://127.0.0.1:3000'); | |
console.log('Worker connected to port 3000'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var out = _step_.getTrans().getServletPrintWriter(); | |
out.println("<H1>"); | |
out.println("Hello World!"); | |
out.println("ときょ 東京 コーヒー"); | |
out.println("</H1>"); |