Skip to content

Instantly share code, notes, and snippets.

View karolinepauls's full-sized avatar
🐧

Karoline Pauls karolinepauls

🐧
View GitHub Profile

Background

Currently, in datetime.strftime, the only sub-second formatting code available is %f, which produces a fixed-width string of microsecond digits, padded from the left with zeros, like "004312".

While Python's datetime code for %f doesn't handle fractions, the fixed-length, zero-padded aspect makes it usable in producing the "fraction of the second" part of a datetime string. For example "...%H:%M:%S.%f" results in a string like ...22:11:55.012345.

Problem

There is no way to for datetime.strftime to produce a string with any other sub-second precision apart from 6 decimal places. You cannot use datetime.strftime alone to obtain milliseconds, like 22:11:55.012, or any other fraction length between 1 and 5.

FROM ...
RUN pip install --no-cache python-lsp-server python-lsp-ruff pylsp-mypy 'python-lsp-server[websockets]'
# restore versions
RUN uv sync
CMD pylsp --verbose --tcp --host 0.0.0.0 --port 20000
@karolinepauls
karolinepauls / vdesktop.ahk
Created May 19, 2026 14:40
Virtual desktops switching AHK
;; State
desktop_no := 1
;; Make keys noop.
F1::
LWin::
Ctrl & F1::
LWin & F1::
@karolinepauls
karolinepauls / INFO.md
Last active January 16, 2022 23:56
clojure.main/report-error pprint problem report and patch drafts

The problem reproduced here occurs when an exception is thrown from user code and reaches clojure.main code responsible for exception reporting. Due to the use of pprint, reporting code can fail, obscuring the error and printing a rather unexpected Java stack trace, which is probably most obscure in case of StackOverflow.

The root cause is potentially buggy ex-info (ex-data with values having broken pprint methods or reference cycles, like overtone/at-at#20) being passed to Throwable->map in clojure.main/report-error. Throwable->map itself calls ex-data in a couple of places.

The "less simple" of the attached patches replaces :clojure.main/trace (the result of Throwable->map) in the report, however an even more advanced one would be able to replace ex-data everywhere in :clojure.main/trace where it can occur.

Being able to narrow down which part of the rep

apiVersion: apps/v1
kind: Deployment
metadata:
name: some-deployment
labels:
app: some-app
spec:
replicas: 1
selector:
matchLabels: