All of the following information is based on go version go1.17.1 darwin/amd64.
| GOOS | Out of the Box |
|---|---|
aix |
✅ |
android |
✅ |
| SHELL=/bin/bash | |
| # to see all colors, run | |
| # bash -c 'for c in {0..255}; do tput setaf $c; tput setaf $c | cat -v; echo =$c; done' | |
| # the first 15 entries are the 8-bit colors | |
| # define standard colors | |
| ifneq (,$(findstring xterm,${TERM})) | |
| BLACK := $(shell tput -Txterm setaf 0) | |
| RED := $(shell tput -Txterm setaf 1) |
| #!/bin/bash | |
| # | |
| # Function that parses semantic versioning striings of | |
| # the form: | |
| # MAJOR.MINOR.PATCH([+-].*)? | |
| # | |
| # Parse the major, minor and patch versions | |
| # out. | |
| # You use it like this: |
In some cases for Python unit tests, we want to automatically perform setUp methods in as declared in a base class. However, we still want setUp to work as per normal in the subclass. The following code will proxy the new setUp function to run it's base class' and the new one.
# Define a common test base for starting servers
class MyBaseTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
"""On inherited classes, run our `setUp` method"""
# Inspired via http://stackoverflow.com/questions/1323455/python-unit-test-with-base-and-sub-class/17696807#17696807
if cls is not MyBaseTestCase and cls.setUp is not MyBaseTestCase.setUp:| #!/usr/bin/env bash | |
| # Usage: | |
| # echo -e "... $(text-style style ...) ..." | |
| # echo -e "... $(text-reset) ..." | |
| # echo -e "... $(text-color r g b) ..." | |
| # echo -e "... $(background-color r g b) ..." | |
| # | |
| # Where: | |
| # styles: |
| # coding: utf-8 | |
| import logging | |
| class Logger(object): | |
| def __init__(self, name='logger', level=logging.DEBUG): | |
| self.logger = logging.getLogger(name) | |
| self.logger.setLevel(level) |