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
@groundwater
groundwater / index.js
Last active August 29, 2015 14:18
JavaScript Modules and Dependency Injection
import {Router} from './myRouter'
import {Component} from './myComponent' with {Router} // inject Router into imported module
const component = new Component()
component.doSomething()
let sink = async function(iter) {
for (let item of iter) {
console.log('got', await item)
}
}
sink(function*(){
var i = 0
while(true) {
yield new Promise(done => {
class Server {
constructor(){
this.user = {}
}
// add a single user
// this is a simple case
async putUser(uid, user){
this.user[uid] = user
}

I've been using CoreOS as an internal Docker PaaS, and have had a few thoughts.

  1. While sub-optimal, there is a need to map in network storage to containers.

    For example, Jenkins stores its configuration on the file system. As CoreOS containers can and should be portable around the cluster, unless you're using some kind of distributed storage your Jenkins configs will disappear periodically.

  2. Almost everything else should be ephemeral. You should replace CoreOS machines with fresh images periodically. Rather than perform maintenance and cleanup of the CoreOS hosts, just replace them. This is not only convenient, but tests failover constantly.

  3. Map in ephemeral storage for apps to use as temporary/scratch disk.

  4. Corollary: databases that do their own replication can use scratch disk instead of network storage

  5. Leverage etcd for service discovery

BIGVER

The BIGVER spec is a semver.io compatible versioning scheme

Rules

  1. all new versions must increment the major version always

The Nano Kernel

A nano-kernel (nK) a cross between a second boot-loader, and a micro-kernel. The nK does not provide memory isolation or process segregation. It's only role is to bootstrap high-level VMs in kernel space.

A nK serves a special type of system where all programs are JIT compiled by the kernel before execution.

Features

Keybase proof

I hereby claim:

  • I am groundwater on github.
  • I am groundwater (https://keybase.io/groundwater) on keybase.
  • I have a public key whose fingerprint is 2A5C 5EB2 E3C7 2DD5 4670 9E6C A3E8 5A7A 83C8 431A

To claim this, I am signing this object:

I think Semantic versioning is pretty useful, but it can be a tad arbitrary deciding when a version number should increment. In a dynamic language, what exactly constitutes the public interface?

Rather than marking interfaces as stable, or unstable, choose explicit consistency guaruntees for interfaces.

Interfaces should be marked as

  1. major
function httpHandler(request, response) {
server.log(request.body);
local b = request.body
local l1
local l2
if (b.len() > 16){
l1 = b.slice(0, 16)
l2 = b.slice(16, b.len())
}else{
l1 = b.slice(0, b.len())

build

Clone and build Node for analysis:

$ git clone https://github.com/joyent/node.git
$ cd node
$ export GYP_DEFINES="v8_enable_disassembler=1 v8_object_print=1"
$ export CXXFLAGS="-fno-omit-frame-pointer"
$ ./configure