Skip to content

Instantly share code, notes, and snippets.

View kessler's full-sized avatar
:octocat:
Be well!

Yaniv Kessler kessler

:octocat:
Be well!
View GitHub Profile
@kessler
kessler / redis-server
Last active December 19, 2015 02:28 — forked from dstroot/redis-server
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/6379.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis_6379.pid
@kessler
kessler / install-redis.sh
Last active December 19, 2015 02:28
install-redis.sh
sudo yum install gcc
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
sudo make install
sudo mkdir /etc/redis
sudo mkdir /var/redis
sudo cp redis.conf /etc/redis/6379.conf
@kessler
kessler / install-node
Last active December 19, 2015 02:39
amazon ec2 node setup / install script
#!/bin/sh
NODE_BRANCH=v0.10.38-release
sudo yum install -y make git gcc-c++
echo 'sleeping for 2 seconds now...'
sleep 2
git clone https://github.com/joyent/node.git
cd node
@kessler
kessler / end-write-stream
Last active December 20, 2015 01:39
end write stream
var fs = require('fs');
var rs = fs.createReadStream('bla.txt');
var ws = fs.createWriteStream('bla2.txt');
ws.on('finish', function() {
console.log('yey!');
});
@kessler
kessler / linux net settings
Created July 31, 2013 15:09
linux net settings
echo ec2-user soft nofile 999999 >> /etc/security/limits.conf
echo ec2-user hard nofile 999999 >> /etc/security/limits.conf
echo root soft nofile 999999 >> /etc/security/limits.conf
echo root hard nofile 999999 >> /etc/security/limits.conf
echo net.core.rmem_max = 33554432 >> /etc/sysctl.conf
echo net.core.wmem_max = 33554432 >> /etc/sysctl.conf
echo net.ipv4.tcp_rmem = 4096 16384 33554432 >> /etc/sysctl.conf
echo net.ipv4.tcp_wmem = 4096 16384 33554432 >> /etc/sysctl.conf
echo net.ipv4.tcp_mem = 786432 1048576 26777216 >> /etc/sysctl.conf
@kessler
kessler / Recursive process.nextTick detected
Created August 11, 2013 20:56
Recursive process.nextTick detected
node.js:375
throw new Error(msg);
^
Error: (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
at maxTickWarn (node.js:375:15)
at process._nextDomainTick (node.js:498:9)
at emitReadable (_stream_readable.js:400:13)
at readableAddChunk (_stream_readable.js:165:9)
at EncryptedStream.Readable.push (_stream_readable.js:127:10)
at EncryptedStream.read [as _read] (tls.js:510:10)
@kessler
kessler / install-zeromq
Last active December 22, 2015 03:48
zeromq install
TARGET=zeromq-4.0.5
sudo yum install libuuid-devel uuid-devel
wget http://download.zeromq.org/$TARGET.tar.gz
tar -xzf $TARGET.tar.gz
cd $TARGET
./configure
make
sudo make install
sudo sh -c 'echo /usr/local/lib > /etc/ld.so.conf.d/zmq.conf'
sudo ldconfig
@kessler
kessler / backpressure code patterns
Last active December 23, 2015 15:59
Are these two patterns to write to a stream equivalent (e.g backpressure handling) ?
//Pattern 1
var stream1 = fs.createWriteStream('some/path1');
function write1() {
var more = stream1.write('something1');
if (more)
write1();
else
stream1.once('drain', write1);
@kessler
kessler / install-riemann
Last active January 17, 2017 14:52
install riemann
sudo yum install -y make
echo 'sleeping for 2 seconds now...'
sleep 2
sudo yum install -y git
echo 'sleeping for 2 seconds now...'
sleep 2
sudo yum install -y gcc-c++
echo 'sleeping for 2 seconds now...'
@kessler
kessler / install-java
Last active December 28, 2015 05:19
install java
wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.rpm"
sudo rpm -ivh jdk-7u45-linux-x64.rpm
sudo rpm -Uvh jdk-7u45-linux-x64.rpm
echo 'sleeping 5 seconds'
sleep 5
rm jdk-7u45-linux-x64.rpm