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
#!/usr/bin/env node | |
var cordova_util = require('cordova-lib/src/cordova/util'); | |
var projectRoot = cordova_util.isCordova(process.cwd()); | |
var projectXml = cordova_util.projectConfig(projectRoot); | |
var ConfigParser = require('cordova-lib/src/ConfigParser/ConfigParser'); | |
var projectConfig = new ConfigParser(projectXml); | |
projectConfig.name(); | |
var fs = require ('fs'); |
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 | |
# | |
# Daniele Brugnara | |
# | |
# usage: | |
# meteor mongo xyz.meteor.com --url | ./do.sh | |
# | |
read mongo_auth |
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
var i = 0; | |
setInterval(function() { | |
if (i++ % 2) { | |
console.log('I\'m the child!'); | |
} else { | |
console.error('I\'m the child!'); | |
} | |
}, 1500); |
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
var request = require('request'); | |
var path = require('path'); | |
var fs = require('fs'); | |
var filename = process.argv[2]; | |
var target = 'http://localhost:3000/upload/' + path.basename(filename); | |
var rs = fs.createReadStream(filename); | |
var ws = request.post(target); |
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
func totalNQueens(n int) int { | |
if n == 1 { | |
return 1 | |
} | |
board := make([][]bool, n) | |
for i:=0;i<n;i++ { | |
board[i] = make([]bool, n) | |
} |
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
/** | |
* Definition for a binary tree node. | |
* type TreeNode struct { | |
* Val int | |
* Left *TreeNode | |
* Right *TreeNode | |
* } | |
*/ | |
func printBST(root *TreeNode) { | |
chn := make(chan 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
/** | |
* Definition for a binary tree node. | |
* type TreeNode struct { | |
* Val int | |
* Left *TreeNode | |
* Right *TreeNode | |
* } | |
*/ | |
func loopBST(root *TreeNode) bool { | |
if root == nil { |
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
/** | |
* Definition for a binary tree node. | |
* type TreeNode struct { | |
* Val int | |
* Left *TreeNode | |
* Right *TreeNode | |
* } | |
*/ | |
func lcaDeepestLeaves(root *TreeNode) *TreeNode { | |
levels := map[int][]*TreeNode{} |
OlderNewer