Skip to content

Instantly share code, notes, and snippets.

@xr09
xr09 / docker-fedora-33-dns.md
Created February 15, 2024 14:54 — forked from RedRoserade/docker-fedora-33-dns.md
Working around Docker DNS issues on Fedora 33. Adapted from https://stackoverflow.com/a/60113249

Problem

Docker on Fedora 33 has issues with systemd-resolved. This causes DNS issues when, for example, connecting VPNs, because it'll use the wrong DNS server, especially if you have several configured. The one from systemd-resolved is ignored since it's a 127.0.0.X address.

This causes containers to not be able to resolve addresses on the private network (VPN).

Solution

Use dnsmasq to listen on docker0 and forward DNS requests to systemd-resolved running on 127.0.0.53.

@xr09
xr09 / bobp-python.md
Created December 29, 2016 22:03 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@xr09
xr09 / contextmanager.md
Created December 29, 2016 22:01 — forked from bgilbert/contextmanager.md
Python context managers

Context managers

In Python, a context manager is an object that can be used in a with statement. Here's a context manager that reports the total wall-clock time spent inside a with block:

import time

class Timer(object):
    def __init__(self, msg):
        self._msg = msg
@xr09
xr09 / README.md
Created November 11, 2016 01:28 — forked from magnetikonline/README.md
Setting Nginx FastCGI response buffer sizes.

Nginx FastCGI response buffer sizes

By default when Nginx starts receiving a response from a FastCGI backend (such as PHP-FPM) it will buffer the response in memory before delivering it to the client. Any response larger than the set buffer size is saved to a temporary file on disk. This process is outlined at the Nginx ngx_http_fastcgi_module page document page.

Introduction

Since disk is slow and memory is fast the aim is to get as many FastCGI responses passing through memory only. On the flip side we don't want to set an excessively large buffer as they are created and sized on a per request basis (i.e. it's not shared memory).