This gist is an implementation of http://sirile.github.io/2015/05/18/using-haproxy-and-consul-for-dynamic-service-discovery-on-docker.html on top of Docker Machine and Docker Swarm.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- PostgreSQL 9.2 beta (for the new JSON datatype) | |
-- You can actually use an earlier version and a TEXT type too | |
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8 | |
-- Inspired by | |
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html | |
-- http://ssql-pgaustin.herokuapp.com/#1 | |
-- JSON Types need to be mapped into corresponding PG types | |
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type InitFunction func() (interface{}, error) | |
type ConnectionPoolWrapper struct { | |
size int | |
conn chan interface{} | |
} | |
/** | |
Call the init function size times. If the init function fails during any call, then | |
the creation of the pool is considered a failure. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('bsselect', []) | |
.directive('bsSelectbox', function ($parse) { | |
return { | |
restrict: 'A', | |
priority: 100, | |
transclude: true, | |
scope: { | |
themodel: '=ngModel', | |
thearray: '@ngOptions', | |
thechange: '&ngChange', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Script to patch up diff reated by `repo diff` | |
# from https://groups.google.com/d/msg/repo-discuss/43juvD1qGIQ/7maptZVcEjsJ | |
if [ -z "$1" ] || [ ! -e "$1" ]; then | |
echo "Usages: $0 <repo_diff_file>"; | |
exit 0; | |
fi | |
rm -fr _tmp_splits* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//package ly.secret.android.net; | |
/** | |
* This is source code derived from the Cryptfs class found in Secret.ly's android app. | |
* | |
* Comments and variable names are my own. | |
* | |
* Here's how I generated this file: | |
* 1. Downloaded the Secret.ly APK via this link: | |
* http://storage.evozi.com/apk/dl/14/05/21/ly.secret.android.apk?vc=1600040 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bayes | |
// Classifier implements the Naive Bayes Classifier. | |
type Classifier struct { | |
classPerWordCount map[string]int | |
classPerDocument map[string]int | |
wordClassCount map[string]map[string]int | |
documentsCount int | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a RegExp from the given string, converting asterisks to .* expressions, | |
* and escaping all other characters. | |
*/ | |
function wildcardToRegExp (s) { | |
return new RegExp('^' + s.split(/\*+/).map(regExpEscape).join('.*') + '$'); | |
} | |
/** | |
* RegExp-escapes all characters in the given string. |
From JimDabell's comment on Hacker News: https://news.ycombinator.com/item?id=18355568
Off the top of my head, these are the kinds of things engineering managers often have to deal with:
- Writing job specs.
- Dealing with recruiters
- Reading CVs/résumés
- Interviews