Skip to content

Instantly share code, notes, and snippets.

View nathanleclaire's full-sized avatar
👨‍🍳
Cooking up great code

Nathan LeClaire nathanleclaire

👨‍🍳
Cooking up great code
View GitHub Profile
@nathanleclaire
nathanleclaire / RunController.js
Created August 7, 2014 16:59
controller to download gist, create docker container and attach to it
/**
* RunController
*
* @description :: Server-side logic for managing Runs
* @help :: See http://links.sailsjs.org/docs/controllers
*/
var request, Docker, containerToStreamMap;
request = require('request');
Docker = require('dockerode');
10210 ◯ : docker pull nathanleclaire/octoblog ⏎
Pulling repository nathanleclaire/octoblog
87f34c3844db: Error pulling image (latest) from nathanleclaire/octoblog, HTTP code 404
511136ea3c5a: Download complete
a9d9abc9a8a0: Error pulling dependent layers
2014/08/23 12:19:19 Error pulling image (latest) from nathanleclaire/octoblog, HTTP code 404
root@6ca95efe974d:/laravel# composer install
Loading composer repositories with package information
SlowTimer [5000ms] at curl: https://packagist.org/packages.json
Installing dependencies (including require-dev)
SlowTimer [5000ms] at curl: https://packagist.org/p/provider-active$8a24f45ca2afc78c526c7bd2b50d77698132f26cb043b085f968a507fc55cd71.json
SlowTimer [5001ms] at curl: https://packagist.org/p/provider-active$8a24f45ca2afc78c526c7bd2b50d77698132f26cb043b085f968a507fc55cd71.json
SlowTimer [5002ms] at curl: https://packagist.org/p/provider-active$8a24f45ca2afc78c526c7bd2b50d77698132f26cb043b085f968a507fc55cd71.json
root@6ca95efe974d:/laravel# composer self-update
SlowTimer [5001ms] at curl: https://getcomposer.org/version
[Composer\Downloader\TransportException]
The "https://getcomposer.org/version" file could not be downloaded: Failed to open https://getcomposer.org/version (Operation timed out after 5001 milliseconds with 0 bytes received)
|master|~/docker$ make
docker build -t "docker:master" .
Sending build context to Docker daemon 54.74 MB
Sending build context to Docker daemon
Step 0 : DOCKER-VERSION 0.6.1
--->
Step 1 : FROM ubuntu:14.04
---> c3d5614fecc4
Step 2 : MAINTAINER Tianon Gravi <admwiggin@gmail.com> (@tianon)
---> Using cache

To correct the date format for permalinks:

find -type f -exec sed -i 's/\([0-9]\+-[0-9]\+-[0-9]\+\).*$/"\1"/' {} \;

To replace the {%img ... %} macro from Jekyll:

find -type f -exec sed -i 's/{% *img \([^ ]*\) \(.*\) %}/{{%img src="\1" caption="\2" }}/' {} \;
@nathanleclaire
nathanleclaire / pipelines.md
Last active August 29, 2015 14:12
Pipelines and cancellations - Golang as markdown (syntax highlighted)

The Go Blog

Go Concurrency Patterns: Pipelines and cancellation

13 March 2014

Introduction

Go's concurrency primitives make it easy to construct streaming data pipelines that make efficient use of I/O and multiple CPUs. This article presents examples of such pipelines, highlights subtleties that arise when operations fail, and introduces techniques for dealing with failures cleanly.

@nathanleclaire
nathanleclaire / configprop.md
Last active August 29, 2015 14:15
A proposal to add configuration to Docker

docker config proposal

Abstract

This proposal introduces a new command, docker config, which can be used to get and set configuration values from the Docker command line client. Eventually these may be used to modify the program's default behavior. This proposal is a summary of myself and @duglin's discussion about solving this.

Motivation

For a variety of reasons the Docker community seems to desire a way to store, set, and access options which dictate the manner in which Docker should behave. For instance, if the user wants to control the host which the Docker client executes commands against, they can set DOCKER_HOST or -H, but they have no way to persist this value out of the box or allow other programs to change them seamlessly. Docker configuration would allow users to do so,

@nathanleclaire
nathanleclaire / machinearch2.md
Last active August 29, 2015 14:16
Machine Architecture 2.0

Proposal for Machine Arch 2.0

The current architecture of Docker Machine is set to assume success, not failure. This has been great to get started quickly, but as the Machine project has grown it has become more apparent that failure is the norm, not the exception. Docker Machine architecture should be set up to handle this, and also to account for the real-life situations of securing your cluster, accessing it from computers other than where it was created, and recovering from disastrous situations such as the deletion of ~/.docker.

Design priciples

  1. Assume failure, not success. Everything will fail all the time, act accordingly.
  2. Assume that everyone on the Internet is actively trying to kill you. "Secure by default" is the maxim.
  3. Enable users with nice interfaces without trying to conceal the underlying mechanics. Power users should be allowed to get into the plumbing.
  4. "No Admin Interfaces". If the user has to visit the VBox GUI, EC2 console, DigitalOcean admin panel, etc. then it
@nathanleclaire
nathanleclaire / machinepkg.md
Last active August 29, 2015 14:16
machine packages arch

Machine Package Structure

main
|__libmachine
|____provider
|____provision
|__drivers
|____amazonec2
|____virtualbox