Skip to content

Instantly share code, notes, and snippets.

View earnubs's full-sized avatar

Stephen Stewart earnubs

View GitHub Profile
@earnubs
earnubs / .vimrc
Last active February 5, 2019 14:49
set expandtab
set shiftwidth=2
set softtabstop=2
set nu
set path+=**
set clipboard=unnamed
set wildignore+=.git,.DS_Store
set statusline+=%F
set backspace=indent,eol,start
@earnubs
earnubs / docker-ip.js
Created February 5, 2019 10:18
use dockerode to get container ip address
const Docker = require('dockerode');
const fs = require('fs');
const socket = process.env.DOCKER_SOCKET || '/var/run/docker.sock';
const stats = fs.statSync(socket);
if (!stats.isSocket()) {
throw new Error('Are you sure the docker is running?');
}
@earnubs
earnubs / snappy-osx-vmware-fusion-howto.md
Last active August 13, 2018 21:09
How to setup Ubuntu Core 16 for developers on OS X with VMWare Fusion

Creating an Ubuntu Core Series 16 image

On VMWare fusion, running an Ubuntu Xenial VM, which has a copy of your OS X public SSH key -- the script to build the image will add it to the generated image -- grab the script at https://github.com/zyga/devtools/blob/master/ubuntu-image to create a new image:

./ubuntu-image.sh --developer-mode pc

Convert .img to .vmdk

qemu-img convert pc-devel.img -O vmdk snappy.vmdk

Keybase proof

I hereby claim:

  • I am earnubs on github.
  • I am earnubs (https://keybase.io/earnubs) on keybase.
  • I have a public key ASDf4O3J1rj_nt3Ct5n09bM6nNSpyguG6ikOmcymDAJ06wo

To claim this, I am signing this object:

@earnubs
earnubs / rg-to-trello.js
Created May 14, 2018 09:10
Send rg results to Trello lane
#!/usr/bin/env node
const readline = require('readline');
const request = require('request');
const RateLimiter = require('limiter').RateLimiter;
const limiter = new RateLimiter(5, 'second');
const TRELLO_KEY = process.env.TRELLO_KEY;
const TRELLO_TOKEN = process.env.TRELLO_TOKEN;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script>delete window.fetch;</script>
<script src="https://cdn.rawgit.com/zloirock/core-js/master/client/shim.min.js"></script>
@earnubs
earnubs / index.js
Created February 10, 2017 21:40
HMR with reach-hot-loader3 and webpack 2
import { AppContainer } from 'react-hot-loader';
import React from 'react';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import { render } from 'react-dom';
import App from './containers/app';
import reducers from './reducers';
// Grab the state from a global variable injected into the server-generated HTML
@earnubs
earnubs / Makefile
Last active October 4, 2017 12:00
node6 sunos node-sass pkg
# $NetBSD$
PORTNAME= node-sass
PORTVERSION= 4.5.3
DISTNAME= v${PORTVERSION}
PKGNAME= node6-sass-binding-${DISTNAME}
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
CATEGORIES= meta-pkgs
MASTER_SITES= ${MASTER_SITE_GITHUB:=sass/}
USE_TOOLS+= gmake
@earnubs
earnubs / simple-mocha-reporter.js
Created March 31, 2017 15:20
mocha reporter without the solarized colour mayhem
var mocha = require('mocha');
module.exports = MyReporter;
function MyReporter(runner) {
mocha.reporters.Base.call(this, runner);
var passes = 0;
var failures = 0;
runner.on('pass', function(test){
passes++;
vila@saw:~/u1/ols-vms/exp/doc 0 :) $ ./ols-vms2 help
Available Topics:
vm
==
vm.setup_scripts: A list of scripts to be executed on the guest to finalize the setup.
The scripts are executed over ssh, in the user home directory.
Scripts can use config options from their vm, they will be expanded before
upload.