# Create a network
$ docker network create foo
24ec61d239758d698d07cbb13f1adb0616d2011495fbff911930f743bd9bfc23
# Create two containers (separate terminals)
$ docker run --rm -it --name c1 --net foo centos:7 bash
$ docker run --rm -it --name c2 --net foo centos:7 bash
# Ping
This file contains hidden or 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
docker ps -q | xargs -P 8 -n 1 time docker stop -t 60 |
This file contains hidden or 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
docker rmi $(grep -xvf <(docker ps -a --format '{{.Image}}' | sed 's/:latest//g') <(docker images | tail -n +2 | grep -v '<none>' | awk '{ print $1":"$2 }' | sed 's/:latest//g')) |
This file contains hidden or 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
$ git branch -r --merged origin/development | | |
grep origin | | |
grep -v '>' | | |
grep -v 'master$' | | |
grep -v 'development$' | | |
xargs -L1 | | |
cut -d"/" -f2- | | |
xargs git push origin --delete |
This file contains hidden or 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
import io.undertow.Undertow; | |
import io.undertow.util.Headers; | |
public class HelloServer { | |
public static void main(final String[] args) { | |
Undertow server = Undertow.builder() | |
.addHttpListener(8081, "localhost") | |
.setHandler((exchange) -> { | |
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain"); | |
exchange.getResponseSender().send("Hello World"); |
This file contains hidden or 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
grunt.registerTask('config', function (env) { | |
var config = grunt.file.readJSON('src/config.json'); | |
var envs = { | |
production: { | |
apiUrl: 'http://foo.com' | |
}, | |
staging: { | |
apiUrl: 'http://bar.com' | |
} | |
}; |
This file contains hidden or 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
function wrapEqualityComparerWithDateSupport(origFn) { | |
return function (a, b) { | |
return origFn(a, b) || | |
(a instanceof Date && b instanceof Date && a.getTime() === b.getTime()); | |
} | |
} | |
ko.observable.fn.equalityComparer = wrapEqualityComparerWithDateSupport(ko.observable.fn.equalityComparer); | |
ko.dependentObservable.fn.equalityComparer = wrapEqualityComparerWithDateSupport(ko.dependentObservable.fn.equalityComparer); |
This file contains hidden or 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
namespace TracingMiddleware | |
{ | |
using System; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using MidFunc = System.Func< | |
System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>, | |
System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task> |
This file contains hidden or 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
public class MyBootstrapper : DefaultNancyBootstrapper | |
{ | |
protected override void ApplicationStartup(TinyIoc.TinyIoCContainer container, Bootstrapper.IPipelines pipelines) | |
{ | |
base.ApplicationStartup(container, pipelines); | |
Nancy.Security.Csrf.Enable(pipelines); | |
} | |
} |
This file contains hidden or 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
class Foo { | |
func bar() -> String { | |
return "Hello" | |
} | |
} | |
func greet (f: Foo) -> String { | |
return f.bar() | |
} |
NewerOlder