Skip to content

Instantly share code, notes, and snippets.

@unclev
unclev / SubscriberExample.md
Last active October 10, 2025 10:19
A DotNet-only usage example of the modified version of the `EventSubscriber`
using System;
using System.Diagnostics;
using Westwind.WebConnection;

namespace SFLoggerConsoleClient
{
    
    public class EventPublisher
    {
@unclev
unclev / docker-bridge-networks-1st-subnet.md
Last active August 4, 2018 12:17
The first subnet of each docker bridge networks with their routes

The first subnet of each docker bridge networks with their routes. It is supposed the sought IPv4 subnet is the first one (with index 0 in Config map)

for n in $(docker network ls --format={{.ID}} --filter='driver=bridge'); do; printf "%s %-30s" $n $(docker inspect $n --format='{{.Name}}'); ip route | grep $(docker inspect $n --format='{{$value := index .IPAM.Config 0}}{{$value.Gateway}}'); done
@unclev
unclev / hosts.conf.tmpl
Last active July 1, 2018 15:30
docker-gen template example for dnsmasq hosts list with networks
{{define "NetworkName"}}{{if eq .Name "bridge"}}{{else}}.{{.Name}}{{end}}{{end}}
{{define "Address"}}{{printf "%-27s" .}}{{end}}
{{$domain := "docker.unclev.ru"}}
{{range $key, $value := .}}
# Container: {{ $value.Name }} ({{$value.ID}} from {{$value.Image.Repository}})
{{range $value.Networks}}{{if .Name}}
# Network: {{.Name}} {{if ne .Name "host"}}{{.Gateway}}{{if .IPPrefixLen}}/{{.IPPrefixLen}}{{end}} {{.IPv6Gateway}}{{if .GlobalIPv6PrefixLen}}/{{.GlobalIPv6PrefixLen}}{{end}}
{{if .GlobalIPv6Address}}{{template "Address" .GlobalIPv6Address}}{{$value.Hostname}}{{template "NetworkName" . }}.{{$domain}}{{end}}
{{if .IP }}{{template "Address" .IP }}{{$value.Hostname}}{{template "NetworkName" . }}.{{$domain}}{{end}}
{{if $value.Name -}}