- Novel; Not your typical technical book
- Transformation of Broken Organization towards DevOps Culture
- Quintessential beginning of a DevOps journey
- Pros: Easy to digest, can suggest to executives
- Cons: The implementation details are fuzzy
- Quip: We all know Brent. Help Brent not be Brent.
This file contains 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
def delegate(to, *methods): | |
''' | |
Class decorator to delegate methods to another objects. | |
>>> @delegate('v', 'upper') | |
... @delegate('v', 'lower') | |
... @delegate('v', 'wrong_method') | |
... @delegate('not_an_attribute', 'wrong_attribute') | |
... class Foo: | |
... def __init__(self, v): | |
... self.v = v |
This file contains 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
#!/usr/bin/env python | |
# -*- encoding: utf-8 -*- | |
import plistlib | |
import zict | |
import os | |
import appdirs | |
from replutilities import attr, isstring, isbytes |
This file contains 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 ast | |
import contextlib | |
import json | |
import os | |
import string | |
from collections import OrderedDict | |
from enum import Enum | |
from numbers import Number | |
from string import Template |
This file contains 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 importlib.abc | |
import importlib.machinery | |
import sys | |
import types | |
class DependencyInjectorFinder(importlib.abc.MetaPathFinder): | |
def __init__(self, loader): | |
self._loader = loader | |
def find_spec(self, fullname, path, target=None): |
This file contains 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
#!/usr/bin/env python | |
# encoding: utf-8 | |
# | |
# PyCheckMate, a PyChecker output beautifier for TextMate. | |
# Copyright (c) Jay Soffian, 2005. <jay at soffian dot org> | |
# Inspired by Domenico Carbotta's PyMate. | |
# Extensively overhauled for version 2.0 by Alexander Böhn. | |
# | |
# License: Artistic. | |
# |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# multiple_dispatch.py | |
# | |
# My version: | |
# https://gist.github.com/fish2000/1af4b852d20b7568a9b9c90fe2346b6d | |
# | |
# Forked from the originall by @wolfv: | |
# https://gist.github.com/wolfv/73f56e4a9cac84eea6a796fde3213456 |
This file contains 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
""" | |
A demonstration on how raising KeyboardInterrupt in the context of tasks | |
spawned via asyncio's loop.run_in_executor does not cancel the threads | |
using any of the cancellation methods in asyncio Futures. | |
The only "proper" way to cancel is to: | |
1. unregister the `atexit` registered `_python_exit` function | |
2. call `shutdown(wait=False)` | |
The reason is that the `thread` module registers `_python_exit` forcing a |
This file contains 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
from typing import * | |
import re | |
def to_regex(typevar, groups): | |
def to_matchgroup(arg, groups): | |
if type(arg) is TypeVar: | |
if arg in groups: | |
return "(?P={})".format(arg.__name__) | |
else: | |
groups |= {arg} |
This file contains 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
def ascii_deletion_distance(str1, str2): | |
from collections import defaultdict | |
histogram = defaultdict(int) | |
for ch in str1: | |
histogram[ch] += 1 | |
for ch in str2: | |
histogram[ch] += 1 | |
union = set(str1) | set(str2) | |
intersection = set(str1) & set(str2) | |
result = union - intersection |
NewerOlder