Skip to content

Instantly share code, notes, and snippets.

View groundwater's full-sized avatar
:electron:
Performing Alchemy

Groundwater groundwater

:electron:
Performing Alchemy
View GitHub Profile
[14:50:32] trevnorris: groundwater: there are others that are "safer", whatever that's about :P
[14:50:41] trevnorris: but still almost as fast
[14:51:10] trevnorris: groundwater: are you creating an object just to attach these objects?
[14:51:38] groundwater: i will be
[14:51:43] trevnorris flogs github
[14:52:02] groundwater: right now i'm actually converting between c++ / js land but that's proving to be a losing strategy
[14:52:47] groundwater: and i'm just playing around with various approaches to find the best fit
[14:52:59] trevnorris: groundwater: then the actual proper way to do this is create an ObjectTemplate, set the InternalFieldCount = 1
[14:53:21] trevnorris: then use SetAlignedPointerInInternalfield
[14:53:43] trevnorris: oy, again. SetAlignedPointerInInternalField (int index, void *value)

Usage: asg-connect DESCRIPTION

The asg-connect command will search for Auto-Scale Group instances that match the description. The first instances will be selected and you will be SSH'd into it.

Switch Stream

The switch stream multiplexes an readable stream across a series of writable streams. All streams operate in object mode, meaning read and write events emit whole objects instead of buffers.

Usage

var sw = new Switch();
var fs = require('fs');
var pp = require('path');
var Readable = require('stream').Readable;
var Writable = require('stream').Writable;
var Transform = require('stream').Transform;
var util = require('util');
// divert strem objects by their type
var Switch = require('./switch' ).Switch;

Enumerating Unicorn Workers

Usage

unicorn -c unicorn.conf.rb
@groundwater
groundwater / Dockerfile
Last active December 23, 2015 12:18
Example NodeOS Dockerfile
# build nodeos from a bare image with only the linux kernel,
# and node binary installed
FROM nodeos/kernel
MAINTAINER Jacob Groundwater <[email protected]>
# Environment variables passed to the init process and RUN commands
# setting BOOT=0 tells init to also exit after the shell process exists
ENV BOOT 0

NodeOS Init

History

Init is the first process launched on boot that is not in kernel space. Init runs as the root user, but it is still a user land process. Init has a process-id, it can be sent signals, and uses standard syscalls to interact with the kernel.

What makes init special is that it is essentially in charge of booting the operating system. During the boot process

@groundwater
groundwater / Dockerfile
Last active December 24, 2015 05:09
Build a Custom NodeOS with a Dockerfile
FROM nodeos/base
MAINTAINER Jacob Groundwater <[email protected]>
ENV HOME /root
ENV PATH /root/bin:/usr/bin:/usr/sbin:/bin:/sbin
# Use `init` to boot the system
ENTRYPOINT ["init"]
#-- Boilerplate --
#
# This must be a layer-2 image
# Use the default unless you're customizing layer-2 or below
FROM nodeos/base
# Important to have /root/bin binaries accessible
ENV HOME /root
ENV PATH /root/bin:/usr/bin:/usr/sbin:/bin:/sbin

Raspberry Pi NodeOS

ifconfig eth0 192.168.2.2
route 192.168.2.1
npkg install nko2013-raspinodeos-server
npkg start nko2013-raspinodeos-server