Skip to content

Instantly share code, notes, and snippets.

@olegfedoseev
olegfedoseev / docker-static-ip.sh
Created January 12, 2016 07:26
How to create docker container with static ip
# create container, important bit is "--net=none"
CID=$(docker run -d --net=none ubuntu-upstart /sbin/init)
# get pid of main proccess
PID=$(docker inspect -f '{{.State.Pid}}' $CID)
# what ip we want for container
IP="192.168.20.167/24 broadcast 192.168.20.255"
# what gateway we shoud use
GATEWAY="192.168.20.1"
# main magic
package main
import (
zmq "github.com/pebbe/zmq4"
"log"
)
func main() {
subscriber, _ := zmq.NewSocket(zmq.SUB)
subscriber.Connect("localhost:1234")
@olegfedoseev
olegfedoseev / wildcard-dns.go
Created June 14, 2015 09:27
Simple DNS server for wildcard domain with forwarding
package main
// Inspired by https://github.com/tianon/rawdns
import (
"flag"
"log"
"net"
"os"
"os/signal"
package main
import (
"fmt"
"time"
"runtime"
"compress/zlib"
"io"
"os"
"os/signal"