Skip to content

Instantly share code, notes, and snippets.

View ichernev's full-sized avatar

Iskren Ivov Chernev ichernev

  • Palo Alto, California, USA
View GitHub Profile
@ichernev
ichernev / node_redirect_test.sh
Created November 11, 2011 13:22
Simple test to check if node stdout redirection works
#!/bin/bash
cat > test.js <<EOF!
var i;
for (i = 1; i <= 10; i++) {
console.log("for in loop " + i);
}
process.exit(0);
@ichernev
ichernev / generate.sh
Created February 20, 2012 16:15
sandboxed-module & coffee-script issue
#!/bin/bash
mkdir tmp; cd tmp
cat > sandbox.coffee <<EOF!
x = require 'foo'
exports.do = ->
console.log x.foo
EOF!
@ichernev
ichernev / pyswitch.sh
Created March 17, 2012 11:36
Switch python versions (2 <-> 3)
#!/bin/bash
# source this file in your ~/.bashrc or ~/.zshrc and then use pyswitch function
_add_shortcut() {
mkdir -p /tmp/bin
cd /tmp/bin
rm -f python
ln -s /usr/bin/python2 python
export PATH="/tmp/bin:$PATH"
echo "using version $(python --version 2>&1 | cut -c8-)"
@ichernev
ichernev / socket-io-crasher.coffee
Created May 11, 2012 13:58
This code crashes socket.io server
socketIo = require 'socket.io'
socketIoClient = require 'socket.io-client'
serverOptions =
'log level': 2
'match origin protocol': yes
# transports: ['xhr-polling']
clientOptions =
transports: ['xhr-polling']
'try multiple transports': no
@ichernev
ichernev / socket-io-client-reconnect.js
Created July 3, 2012 12:10
client reconnect on server disconnect
// Generated by CoffeeScript 1.3.3
var ioClientLib, ioServerLib, setupClient, setupServer;
ioServerLib = require('socket.io');
ioClientLib = require('socket.io-client');
setupServer = function() {
var ioServer;
console.log('[server] setup');
@ichernev
ichernev / .gitconfig
Created July 26, 2012 11:41
shared scripts
[user]
email = [email protected]
name = Iskren Chernev
[alias]
st = status
co = checkout
ci = commit
br = branch
df = diff
dc = diff --cached
@ichernev
ichernev / node-gyp.log
Created August 5, 2012 21:11
node-gyp rebuild fails for zeromq.node/master
% node-gyp rebuild 0:13:04
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | ia32
gyp info spawn python
gyp info spawn args [ '/home/iskren/.node-gyp/0.8.5/tools/gyp_addon',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-I/home/iskren/src/zguide/examples/Node.js/node_modules/zmq/build/config.gypi',
gyp info spawn args '-f',
gyp info spawn args 'make' ]
@ichernev
ichernev / lruqueue.js
Created August 5, 2012 22:15
Node.js zmq guide examples
// Least-recently used (LRU) queue device in Node.js
var startClientsAndWorkersNowait = true
, terminate = 'skip'; // 'immediately', 'later', 'skip'
var numberOfClients = 10
, numberOfWorkers = 3;
var zmq = require('zmq')
, frontend = zmq.socket('router')
@ichernev
ichernev / inproc_dealer.c
Created August 8, 2012 21:51
inproc & dealer socket error
#include "zmq.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main(void)
{
void *context = zmq_init (1);
@ichernev
ichernev / momenen-test.log
Created August 28, 2012 08:17
moment create test failure
✖ create - six digit years
Assertion Message: parse BC 270,001
AssertionError: -270001 == -270000
at Object.assertWrapper [as equal] (/home/iskren/src/moment/node_modules/nodeunit/lib/types.js:83:39)
at Object.exports.create.six digit years (/home/iskren/src/moment/test/moment/create.js:320:14)
at Object.wrapTest (/home/iskren/src/moment/node_modules/nodeunit/lib/core.js:235:16)
at Object.wrapTest (/home/iskren/src/moment/node_modules/nodeunit/lib/core.js:235:16)
at wrapTest (/home/iskren/src/moment/node_modules/nodeunit/lib/core.js:235:16)
at Object.exports.runTest (/home/iskren/src/moment/node_modules/nodeunit/lib/core.js:69:9)