This file contains hidden or 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
#!/opt/minecraft/.venv/bin/python3 | |
""" | |
miner.py | |
------------------- | |
Keenan W. Wilkinson | |
16 Aug 2023 | |
------------------- | |
Basic CLI for maintaining server services. | |
""" |
This file contains hidden or 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/python3 | |
""" | |
This `gist` is some standard boilerplate I used to initialize | |
a logger. While actual usage may vary, this is-- more or less | |
-- the most common way I like to utilize this module. | |
""" | |
import logging | |
logger = logging.getLogger(__file__) |
This file contains hidden or 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
""" | |
urilib.py | |
--- | |
Author: Keenan W. Wilkinson | |
Date: 14 Nov 2023 | |
--- | |
Defines URI resource paths for RESTful Web APIs in | |
a pythonic way. | |
""" |
This file contains hidden or 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 netrc, typing, urllib, urllib.parse | |
# Requires httpx dependency. | |
import httpx | |
@contextlib.contextmanager | |
def client(hostname: str, **kwds) -> typing.Generator[httpx.Client, None, None]: | |
"""Enter context with an HTTP client.""" | |
kwds.setdefault("username") |
This file contains hidden or 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 dataclasses, functools, io, netrc, pathlib, sys, urllib, urllib.parse | |
import codecs, queue, shelve, threading, time, typing | |
import lxml.etree | |
from httpx import BasicAuth, Client, Request, Response, Timeout | |
type Element = lxml.etree._Element #type: ignore[valid-type] | |
type GetterQueue = queue.Queue[str] #type: ignore[valid-type] | |
type UpdateQueue = queue.Queue[tuple[str, io.BytesIO]] #type: ignore[valid-type] | |
type WrappedFunc[**P, T] = typing.Callable[P, T] #type: ignore[name-defined,valid-type] |
This file contains hidden or 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
""" | |
Produces a working example of an interview question | |
that I failed spectacularly. After some stewing, | |
contemplation, and self-loathing, I was able to | |
write this. Mostly in hopes that I will never have to | |
think about this arbitrary POC ever again. | |
""" | |
import math |