Skip to content

Instantly share code, notes, and snippets.

@olljanat
olljanat / overlay-network-and-static-ips-for-docker-containers.md
Last active March 26, 2024 04:51
Overlay network and static IPs for Docker containers

I don't expect moby/moby#24170 to be solved by Docker team on near future so this gist is about looking for least ugly workarounds which are available today and on near future.

What is possible on Docker 19.03

Network

It is possible to create overlay network with use user specified subnet. On this example I create network which is size is two C -class networks ( IP range 10.0.0.0 - 10.0.1.255 ) and force Docker to use IPs from second part of it ( 10.0.1.0 - 10.0.1.255 ).

That way I can make sure that IPs 10.0.0.2 - 10.0.0.254 can be specified to containers and they do not collide with IPs which Docker engine assign for service(s)/container(s).

from ijson import common
from ijson.backends import YAJLImportError
from cffi import FFI
ffi = FFI()
ffi.cdef("""
typedef void * (*yajl_malloc_func)(void *ctx, size_t sz);
typedef void (*yajl_free_func)(void *ctx, void * ptr);
typedef void * (*yajl_realloc_func)(void *ctx, void * ptr, size_t sz);
@armon
armon / benchmark.go
Created November 1, 2013 00:26
scrypt parameter benchmarks
package main
import "code.google.com/p/go.crypto/scrypt"
import "fmt"
import "time"
func main() {
n_vals := []int{4 * 1024, 8 * 1024, 16 * 1024, 32 * 1024}
r_vals := []int{6, 7, 8, 9, 10}
p_vals := []int{1, 2, 3, 4}
@nrrrdcore
nrrrdcore / inset_input.css
Created August 9, 2012 23:35
The Perfect Inset Input CSS
input {
height: 34px;
width: 100%;
border-radius: 3px;
border: 1px solid transparent;
border-top: none;
border-bottom: 1px solid #DDD;
box-shadow: inset 0 1px 2px rgba(0,0,0,.39), 0 -1px 1px #FFF, 0 1px 0 #FFF;
}