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 / gist:8289473
Created January 6, 2014 20:38
leiningen
cd ~
mkdir bin
cd bin
wget https://raw.github.com/technomancy/leiningen/stable/bin/lein
chmod +x lein
lein
@kessler
kessler / install-go
Last active January 2, 2016 16:19
install go
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
@kessler
kessler / install-etcd
Created January 9, 2014 04:21
install etcd
git clone https://github.com/coreos/etcd
cd etcd
./build
@kessler
kessler / pgbug.js
Created January 23, 2014 16:19
pg bug
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) {
@kessler
kessler / req_rep
Created January 28, 2014 06:03
zmq request/reply extended
/*
*
* 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';
@kessler
kessler / dealer.js
Created January 28, 2014 14:39
dealer.js
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;
@kessler
kessler / router.js
Created January 28, 2014 14:39
router.js
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!');
@kessler
kessler / sub
Last active September 14, 2017 21:42
launch sublime text from terminal with current directory or with argument
#!/bin/sh
sub="/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
target=$1
if [[ -z $target ]]
then
target=$(pwd)
fi
@kessler
kessler / iptables_off
Created June 28, 2014 16:46
iptables off
#!/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
@kessler
kessler / node_timers_example1.js
Created July 4, 2014 15:00
simple node.js timers examples
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')