Skip to content

Instantly share code, notes, and snippets.

@rektide
rektide / noun-project.js
Last active August 29, 2015 14:03
Noun Project sample
var OAuth = require('oauth')
// `npm install oauth` to satisfy
// website: https://github.com/ciaranj/node-oauth
var KEY = "<INSERT KEY HERE>"
var SECRET = "<INSERT SECRET HERE>"
var oauth = new OAuth.OAuth(
'http://api.thenounproject.com',
'http://api.thenounproject.com',
@rektide
rektide / kubernetes.irc.06june
Last active August 29, 2015 14:03
Linking applications together in Kubernetes
Wednesday June 10, 2014:
19:26 < rektide> how should/could a webapp container get info about the database container it needs?
Thursday June 11, 2014:
10:32 < rektide> is there any means in kubernetes where coordination can happen? how ought my webapp node get the information about where the db node lies?
12:51 < vmarmol> rektide: bburns' demo showcased that. You point it at the generic "DB service" backend and it will discover and send requests to it
12:55 < jbeda> rektide: It works like this. You specify a ‘service’ that has a name and a ‘label query’. This then sets up configuration for a small proxy that runs on every worker node. That proxy will listen on a port per service and forward (simple round robin for now) to one of the backends specified by the ‘label query’. A set of env variables are set before jobs are started that gives the port for each service based on the name.
Brendan Burns talking about service availability:
https://www.youtube.com/watch?v=tsk0pWf4ipw#t=1620
@rektide
rektide / lift-node-module.js
Last active August 29, 2015 14:05
liftNodeModule
var _ = require('lodash');
var node = require('when/node');
function liftNodeModule(o){
return _.chain(o)
.pairs() // break into [key,value]
.filter(function(fn, slot){ // remove '*Sync' methods
var key = slot[0];
var firstLetter = key.charAt(0);
return ! (/Sync$/.test(key) || firstChar.toUpperCase() == firstChar);
@rektide
rektide / async-module.js
Last active August 29, 2015 14:05
async loading module
var path = require('path');
var mongoose = require('mongoose');
var when = require('when');
var whenNode = require('when/node');
var glob = whenNode.lift(require('glob'));
var config = require('./config');
// exports a 'done' promise
var done = when.defer();
module.exports = done.promise;
@rektide
rektide / expand-collection.js
Created August 26, 2014 21:56
Expand a collection in lodash
lodash.chain([1,1,2,3,5,8,13,21])
.map(function(data){
return [data, data*2, data*3]
})
.flatten(true)
.value()
@rektide
rektide / compileOpus.sh.log
Last active August 29, 2015 14:05
Compiling opus.js
./compileOpus.sh
+ cd libopus
+ [ ! -f configure ]
+ ./autogen.sh
Updating build configuration files, please wait....
libtoolize: putting auxiliary files in `.'.
libtoolize: linking file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: linking file `m4/libtool.m4'
libtoolize: linking file `m4/ltoptions.m4'
@rektide
rektide / related.md
Last active August 8, 2019 16:48
CoreOS related projects
@rektide
rektide / gulpfile.js
Created September 19, 2014 01:30
Gulp with Promises, take 1
var fs= require('when/node').liftAll(require('fs'))
var gulp= require('gulp'),
when= require('when')
//// configuration registry ////
exports.resourceDir = 'resources'
//// util ////
@rektide
rektide / uninitialized-vars.yaml
Created September 25, 2014 03:41
ansible with uninitialized vars
---
- hosts: all
gather_facts: False
vars:
foo: "one"
bar: "{{tbd}}"
tasks:
# this first line will fail, saying: fatal: [127.0.0.1] => One or more undefined variables: 'tbd' is undefined
- debug: msg="{{vars['foo']|default('nope')}}"
# but these would have been fine
@rektide
rektide / chrome.exe
Last active August 29, 2015 14:07
this computer is still unnamed
ÈÜx
ràà @ø° @  
á(þ'ð Q½ q
Rq D0~øÐ ÎÐ
° Ž P~µØ
  l@ `~ð »
° +:Hp~(½
ZÀ@ Àe`~0  Ïà
°½ ·¦P
ðè( °Ð