Skip to content

Instantly share code, notes, and snippets.

@totherik
totherik / ec2_rsync
Created May 3, 2012 18:09
rsync file to EC2 instance
rsync -e "ssh -i {pemfile}" {sourcepath} ec2-user@{server}:{destpath}
@totherik
totherik / ssh-agent
Created May 4, 2012 16:51
Start ssh agent from Git Bash to store creds for bash session.
exec ssh-agent /bin/sh --login -i
ssh-add
@totherik
totherik / npm-git-exe
Created May 4, 2012 16:52
Set npm config to exe in Windows
npm config set "git" "C:\\path\to.exe"
@totherik
totherik / gist:3305270
Created August 9, 2012 15:41 — forked from pguillory/gist:729616
Hooking into Node.js stdout
var util = require('util')
function hook_stdout(callback) {
var old_write = process.stdout.write
process.stdout.write = (function(write) {
return function(string, encoding, fd) {
process.nextTick(function() {
callback(string, encoding, fd)
});
@totherik
totherik / gist:3308181
Created August 9, 2012 21:24
NodeJS improved inherits and mixin
'use strict';
var util = require('util');
/**
* Combines objects in reverse order of provided arguments. The right-most
* object's properties are copied to the left, and so on.
* @param {Object} dest the destination object
* @return {Object} the destination object
*/
@totherik
totherik / gist:3379924
Created August 17, 2012 15:31
Profiling JavaScript in V8
$ git clone git://github.com/v8/v8.git v8 && cd v8
$ make dependencies # or mkdir build/gyp && git clone git://github.com/svn2github/gyp.git build/gyp
$ make native # (or the like: `$ make ia32`, etc)
$ out/native/d8 --prof 'test.js' # generates 'v8.log'
$ tools/mac-tick-processor # processes the generated 'v8.log'

Additional d8 options

@totherik
totherik / gist:5158013
Last active March 11, 2016 20:04
GitHub Emoji

These are the emoji supported by GitHub as of today (20130313).

See comments.

@totherik
totherik / 0-index.js
Last active January 2, 2016 20:29
kraken-js API brainstorm
'use strict';
var kraken = require('kraken-js'),
otherapp = require('./lib/otherapp');
var delegate, myapp;
delegate = { /* delegate ... */ };
/**
var express = require('express'),
engine = require('view-engine');
var renderer, app;
renderer = engine.create('dust', require('dustjs-linkedin'));
app = express();
app.set('view-engine', renderer);
@totherik
totherik / mjson.js
Created February 6, 2014 19:36
A naïve msjon impl for node.js.
#!/usr/bin/env node
var chunks = [];
process.stdin.on('data', chunks.push.bind(chunks));
process.stdin.on('end', function () {
var json;
json = Buffer.concat(chunks).toString('utf8');
json = JSON.parse(json);
json = JSON.stringify(json, null, 2);
process.stdout.write(json);