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 asyncio | |
from asyncio import Future | |
from collections import Callable | |
from typing import ClassVar | |
from typing import Optional | |
class Timer: | |
_task: Optional[ Future ] = None | |
_timeout: ClassVar[ float ] |
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 threading import Timer | |
from typing import ClassVar | |
from typing import Optional | |
class SelfRunner( object ): | |
_timeout: ClassVar[ float ] = 10.0 | |
_timer: Optional[ Timer ] = None | |
_end_called: bool = False |
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 matplotlib.pyplot as plt | |
%matplotlib inline | |
plt.rcParams["figure.figsize"] = 12,12 | |
def plot_images(images, columns=4): | |
total = len(images) | |
nrow = ceil(total / columns) | |
ncol = columns | |
fig = plt.figure(figsize=(ncol+1, nrow+1)) |
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 threading import Lock | |
import time | |
class Took: | |
def __init__ ( self ): | |
self.__lock = Lock() | |
with self.__lock: | |
self.__start = time.time() | |
self.__total = time.time() |
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 __future__ import annotations | |
from typing import Union | |
import os | |
import uuid | |
import json | |
from datetime import datetime | |
from threading import Lock | |
class Log( object ): |
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 threading import Lock | |
class Counter( object ): | |
def __init__ ( self ): | |
self.__value = 0 | |
self.__lock = Lock() | |
def increment ( self, by_value: int = 1 ): | |
with self.__lock: |
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 asyncio | |
import json | |
import threading | |
from aiohttp import web | |
def healthcheck_response ( data, *, text=None, body=None, status=200, reason=None, headers=None, content_type="application/json", dumps=json.dumps ): | |
return web.json_response( | |
data, | |
text=text, |
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 Foundation | |
import UIKit | |
extension CGImage { | |
public var cvPixelBuffer: CVPixelBuffer? { | |
let attrs = [ | |
kCVPixelBufferCGImageCompatibilityKey: kCFBooleanTrue, | |
kCVPixelBufferCGBitmapContextCompatibilityKey: kCFBooleanTrue, | |
kCVPixelBufferMetalCompatibilityKey: kCFBooleanTrue | |
] as CFDictionary |
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
set ask askcc append dot save crt | |
ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via D$ | |
account forcron { | |
set smtp-use-starttls | |
set ssl-verify=ignore | |
set smtp-auth=login | |
set smtp=smtp://example.com:587 | |
set from="Email Address <[email protected]>" | |
set smtp-auth-user=USERNAME |
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
#!/bin/sh | |
# CSV file line example: | |
# [email protected],PASSWORD | |
if [ -z "$1" ] | |
then | |
echo "CSV file is not specified!" | |
exit 1 | |
fi |
NewerOlder