Skip to content

Instantly share code, notes, and snippets.

Geoff Flarity gflarity

Block or report user

Report or block gflarity

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

SSH agent forwarding and screen

When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.

This is enabled by adding the

ForwardAgent yes

option to any of your Host entries in ~/.ssh/config (or alternatively with the -A option). Don't set this option in a wildcard Host * section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.

gflarity / kiss.js
Created Feb 17, 2012
simple node.js based deployment tool
View kiss.js
//each task gets executed in parallel across each host defined, each phase is executed serially
//support for running individual phases+tasks should be easy
phase( 'web' )
.host( '' )
.host( '' )
.config( 'foo', [ 1, 2, 3 ] )
.task( 'checkout code',
function( c )
View gist:893258
function my_set( key, value ) {
index.set( key, value, function(err, context) {
if ( err ) {
console.log( err );
else {
console.log( "successfully inserted " + key );
View gist:893239
var key = 'E18EFDFD-ACC4-42CB-8261-E8139886DA1C';
var value = 'foo';
index.set( key, value, function(err, context) {
if ( err ) {
console.log( err );
else {
console.log( "successfully inserted " + content.key );
View node-index-snippet1
// You can run this file again and again and it will:
// 1) Keep inserting the same keys over and over again
// 2) You can't no longer trust the variables outside of the callbacks passed to index.set, context is needed
var generate_uuid = require('node-uuid');
var index_file = 'data/test.index';
var index;
console.log('run it twice, it should fail the second time as it keeps adding keys as if they were new');
var on_index_created = function(err) {
if ( err ) {
gflarity / gist:843783
Created Feb 25, 2011
Understanding Inheritance In JavaScript
View gist:843783
This is a rough outline for an article
In this article I will present the JavaScript inerhitence model in a concise and I hope easy to understand manner. The intended audience consists of developers with some previous experience with dynamically typed languages. It is my opinion that any difficulty associated with understanding the JavaScript inheritance model can be attributed to the difficulty teaching recursive definitions in general. It's sometimes hard to know where to start, when your definition is circular.
That said, let's boil JavaScript inheritance down into 5 key points:
1) In JavaScript, everything is an 'object' and all variables simply hold references to them. The other 'primitive' or basic types (of objects) are functions, booleans, strings, numbers and arrays.
2) Objects are collections of properties keyed by a reference. Most often, references to string objects are used as keys as they are immutable. This means that if foo and bar reference string types which contain the same data they
gflarity / node-ec2-ubuntu-cluster
Created Feb 21, 2011
Node+cluster on Amazon EC2 Quickstart
View node-ec2-ubuntu-cluster
#First you'll need to Signup for AWS/EC2 and generate a key pair. Google it, there should be plenty of
#Next, create an instance using the AWS Management Console and log into it using your key pair.
#You can find the AMI's here
#I picked a 64bit 10.04 LTS AMI in US-East.
#Install node's perquisites (or those that aren't the default ubuntu LTS ami):
sudo apt-get update
sudo apt-get install build-essential libssl-dev
You can’t perform that action at this time.