This file contains 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
cd ~ | |
mkdir bin | |
cd bin | |
wget https://raw.github.com/technomancy/leiningen/stable/bin/lein | |
chmod +x lein | |
lein |
This file contains 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
wget https://go.googlecode.com/files/go1.2.linux-amd64.tar.gz | |
tar -C /home/ec2-user/ -xzf go1.2.linux-amd64.tar.gz | |
echo 'export GOROOT=$HOME/go' >> .bash_profile | |
echo 'export PATH=$PATH:$GOROOT/bin' >> .bash_profile |
This file contains 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
git clone https://github.com/coreos/etcd | |
cd etcd | |
./build |
This file contains 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 pg = require('pg') | |
var connectionString = 'your connection string here' | |
pg.defaults.poolSize = 2 | |
var executedCount = 0 | |
function query() { | |
pg.connect(connectionString, function (err, conn, done) { |
This file contains 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
/* | |
* | |
* One requester two responders (round robin) | |
* | |
*/ | |
var cluster = require('cluster') | |
, zeromq = require('zmq') | |
, port = 'tcp://127.0.0.1:12345' | |
, port2 = 'tcp://127.0.0.1:12346'; |
This file contains 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') | |
var socket = zmq.socket('dealer'); | |
socket.identity = 'client' + process.pid; | |
var value = 0; | |
socket.bind('tcp://127.0.0.1: ' + process.argv[2], function(err) { | |
if (err) throw err; |
This file contains 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') | |
var socket = zmq.socket('router'); | |
socket.identity = 'server' + process.pid; | |
for (var i = 2; i < process.argv.length; i++) | |
socket.connect('tcp://127.0.0.1:' + process.argv[i]); | |
console.log('connected!'); |
This file contains 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 | |
sub="/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" | |
target=$1 | |
if [[ -z $target ]] | |
then | |
target=$(pwd) | |
fi |
This file contains 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 | |
sudo /etc/init.d/iptables save | |
sudo /etc/init.d/iptables stop | |
sudo chkconfig iptables off | |
sudo /etc/init.d/ip6tables save | |
sudo /etc/init.d/ip6tables stop | |
sudo chkconfig ip6tables off |
This file contains 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
setTimeout(function() { | |
console.log('queue a print AFTER a second') | |
}, 1000) | |
setInterval(function() { | |
console.log('queue a print EVERY second') | |
}, 1000) | |
setImmediate(function() { | |
console.log('queue a print in the next event loop tick but after IO tasks are done') |