"""An atomic, thread-safe incrementing counter.""" | |
import threading | |
class AtomicCounter: | |
"""An atomic, thread-safe incrementing counter. | |
>>> counter = AtomicCounter() | |
>>> counter.increment() |
import sys | |
import numpy | |
from datetime import datetime | |
from flask import Blueprint, Flask, make_response, request | |
from tifffile import TiffFile | |
# BSD Licensed | |
bp = Blueprint('SimulatedCameraImageFeeder', __name__) |
I've never had great understanding of launchctl but the deprecation of the old commands with launchctl 2 (10.10) has been terrible as all resources only cover the old commands, and documentation for Apple utilities is generally disgracefully bad, with launchctl not dissembling.
Mad props to https://babodee.wordpress.com/2016/04/09/launchctl-2-0-syntax/ which contains most details
Internally, launchd has several domains, but launchctl 1 would only ask for service names,
#!/usr/bin/env python3 | |
# Combining coroutines running in an asyncio event loop with | |
# blocking tasks in thread pool and process pool executors. | |
# | |
# Based on https://pymotw.com/3/asyncio/executors.html, but this version runs both | |
# threads and processes at the same time and interleaves them with asyncio coroutines. | |
# | |
# All appears to be working. | |
# |
@echo off | |
nuget restore -Verbosity normal | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
msbuild -p:Configuration=Release ^ | |
-p:WarningLevel=0 | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
dotnet.exe test TestProject.csproj --configuration Release --no-build -v n |
Rust error handling is nice but obligatory. Which makes it sometimes plenty of code.
Functions return values of type Result that is "enumeration". In Rust enumeration means complex value that has alternatives and that alternative is shown with a tag.
Result is defined as Ok or Err. The definition is generic, and both alternatives have
variable bucket { | |
description = "AWS S3 bucket name to use for state storage" | |
type = string | |
} | |
variable dynamodb_table { | |
description = "AWS DynamoDB table name to use for state locking" | |
type = string | |
} |
import logging | |
from dataclasses import dataclass | |
from typing import Union, List | |
logger = logging.getLogger(__name__) | |
class Validations: |