Format
Some checks failed
BUILD x86_64-linux.picard
UPLOAD x86_64-linux.picard
DOWNLOAD x86_64-linux.picard
CACHIX x86_64-linux.picard
ATTIC x86_64-linux.picard
EVAL x86_64-linux.picard
/ test (push) Successful in 20s

This commit is contained in:
Andrea Ciceri 2024-12-18 14:58:39 +01:00
parent a45c032180
commit d2237c0a12
Signed by: aciceri
SSH key fingerprint: SHA256:/AagBweyV4Hlfg9u092n8hbHwD5fcB6A3qhDiDA65Rg
12 changed files with 352 additions and 392 deletions

View file

@ -1,9 +1,9 @@
host=${1-picard}
nixos-rebuild switch \
--flake ".#${host}" \
--target-host "root@${host}.fleet" \
--build-host "root@${host}.fleet" \
--option warn-dirty false \
--fast \
"${@:2}"
--flake ".#${host}" \
--target-host "root@${host}.fleet" \
--build-host "root@${host}.fleet" \
--option warn-dirty false \
--fast \
"${@:2}"

View file

@ -13,24 +13,21 @@ class MaildirHandler(FileSystemEventHandler):
def on_created(self, event):
if not event.is_directory:
print(f"New email found: {event.src_path}")
with open(event.src_path, 'r') as email_file:
with open(event.src_path, "r") as email_file:
msg = message_from_file(email_file)
print(f'{msg["From"]}: {msg["Subject"]}')
self.notifier.send(
title=msg["From"],
message=msg["Subject"],
sound=DEFAULT_SOUND,
icon=Icon(name="mail-message-new"),
timeout=20
title=msg["From"],
message=msg["Subject"],
sound=DEFAULT_SOUND,
icon=Icon(name="mail-message-new"),
timeout=20,
)
if __name__ == "__main__":
maildir_new = os.path.expanduser(os.environ.get("INBOX_NEW"))
notifier = DesktopNotifierSync(
app_name="Mails",
notification_limit=10
)
notifier = DesktopNotifierSync(app_name="Mails", notification_limit=10)
event_handler = MaildirHandler(notifier)
observer = Observer()

View file

@ -4,18 +4,20 @@ from pyforgejo.models.create_status_option import CreateStatusOption
import json
from os import environ
client = AuthenticatedClient(base_url=environ["GITHUB_API_URL"], token=environ["GITHUB_TOKEN"])
client = AuthenticatedClient(
base_url=environ["GITHUB_API_URL"], token=environ["GITHUB_TOKEN"]
)
with open('result.json', 'r') as file:
with open("result.json", "r") as file:
data = json.load(file)
print("Reporting statuses acording to the following result.json")
print(json.dumps(data, indent=2))
for result in data['results']:
attr = result['attr']
success = result['success']
type = result['type']
for result in data["results"]:
attr = result["attr"]
success = result["success"]
type = result["type"]
print(f"Report status success={success} for {type} {attr}")
response = repo_create_status.sync_detailed(
owner="aciceri",
@ -26,8 +28,10 @@ for result in data['results']:
context=type,
description=attr,
target_url="https://git.aciceri.dev", # FIXME
state="success" if success else "failure" # may be pending,success,failure,error_message
)
state=(
"success" if success else "failure"
), # may be pending,success,failure,error_message
),
)
print("Done reporting statuses")

View file

@ -66,8 +66,19 @@ class GarminCollector:
def collect(self):
try:
body = self.api.get_daily_weigh_ins(today.isoformat())["totalAverage"]
metric_gauge = GaugeMetricFamily("body_composition", "Body composition and weight", labels=["metric"])
for k in ["weight", "bmi", "bodyFat", "bodyWater", "boneMass", "muscleMass", "physiqueRating", "visceralFat"]:
metric_gauge = GaugeMetricFamily(
"body_composition", "Body composition and weight", labels=["metric"]
)
for k in [
"weight",
"bmi",
"bodyFat",
"bodyWater",
"boneMass",
"muscleMass",
"physiqueRating",
"visceralFat",
]:
metric_gauge.add_metric([k], body[k])
except Exception as e:
print(f"Something went wrong while fetching body composition data\n{e}")
@ -79,4 +90,4 @@ if __name__ == "__main__":
registry = CollectorRegistry()
registry.register(GarminCollector())
push_to_gateway(gateway_address, job='garmin', registry=registry)
push_to_gateway(gateway_address, job="garmin", registry=registry)

View file

@ -653,25 +653,11 @@
},
"targets": {
"default": {
"aiohttp": [
"aiosignal",
"attrs",
"frozenlist",
"multidict",
"yarl"
],
"aiosignal": [
"frozenlist"
],
"alembic": [
"mako",
"sqlalchemy",
"typing-extensions"
],
"aiohttp": ["aiosignal", "attrs", "frozenlist", "multidict", "yarl"],
"aiosignal": ["frozenlist"],
"alembic": ["mako", "sqlalchemy", "typing-extensions"],
"annotated-types": [],
"ansible": [
"ansible-core"
],
"ansible": ["ansible-core"],
"ansible-core": [
"cryptography",
"jinja2",
@ -679,45 +665,27 @@
"pyyaml",
"resolvelib"
],
"anyio": [
"idna",
"sniffio"
],
"anyio": ["idna", "sniffio"],
"argcomplete": [],
"attrs": [],
"beautifulsoup4": [
"soupsieve"
],
"build": [
"packaging",
"pyproject-hooks"
],
"beautifulsoup4": ["soupsieve"],
"build": ["packaging", "pyproject-hooks"],
"certifi": [],
"cffi": [
"pycparser"
],
"cffi": ["pycparser"],
"chardet": [],
"charset-normalizer": [],
"click": [],
"colorclass": [],
"compressed-rtf": [],
"cryptography": [
"cffi"
],
"dataclasses-json": [
"marshmallow",
"typing-inspect"
],
"cryptography": ["cffi"],
"dataclasses-json": ["marshmallow", "typing-inspect"],
"distro": [],
"dnspython": [],
"docutils": [],
"docx2txt": [],
"easygui": [],
"ebcdic": [],
"email-validator": [
"dnspython",
"idna"
],
"email-validator": ["dnspython", "idna"],
"et-xmlfile": [],
"extract-msg": [
"beautifulsoup4",
@ -731,25 +699,12 @@
"frozenlist": [],
"greenlet": [],
"h11": [],
"httpcore": [
"certifi",
"h11"
],
"httpx": [
"anyio",
"certifi",
"httpcore",
"idna",
"sniffio"
],
"httpcore": ["certifi", "h11"],
"httpx": ["anyio", "certifi", "httpcore", "idna", "sniffio"],
"idna": [],
"iniconfig": [],
"jinja2": [
"markupsafe"
],
"jsonpatch": [
"jsonpointer"
],
"jinja2": ["markupsafe"],
"jsonpatch": ["jsonpointer"],
"jsonpointer": [],
"langchain": [
"aiohttp",
@ -785,42 +740,21 @@
"pyyaml",
"tenacity"
],
"langchain-openai": [
"langchain-core",
"openai",
"tiktoken"
],
"langchain-text-splitters": [
"langchain-core"
],
"langsmith": [
"orjson",
"pydantic",
"requests"
],
"langchain-openai": ["langchain-core", "openai", "tiktoken"],
"langchain-text-splitters": ["langchain-core"],
"langsmith": ["orjson", "pydantic", "requests"],
"lark": [],
"lxml": [],
"mako": [
"markupsafe"
],
"markdown-it-py": [
"mdurl"
],
"mako": ["markupsafe"],
"markdown-it-py": ["mdurl"],
"markupsafe": [],
"marshmallow": [
"packaging"
],
"marshmallow": ["packaging"],
"mdurl": [],
"msoffcrypto-tool": [
"cryptography",
"olefile"
],
"msoffcrypto-tool": ["cryptography", "olefile"],
"multidict": [],
"mypy-extensions": [],
"names": [],
"numexpr": [
"numpy"
],
"numexpr": ["numpy"],
"numpy": [],
"olefile": [],
"oletools": [
@ -840,16 +774,11 @@
"tqdm",
"typing-extensions"
],
"openpyxl": [
"et-xmlfile"
],
"openpyxl": ["et-xmlfile"],
"orjson": [],
"packaging": [],
"pcodedmp": [],
"pdfminer-six": [
"charset-normalizer",
"cryptography"
],
"pdfminer-six": ["charset-normalizer", "cryptography"],
"pillow": [],
"pip": [],
"pip-tools": [
@ -861,68 +790,31 @@
"wheel"
],
"pluggy": [],
"prompt-toolkit": [
"wcwidth"
],
"prompt-toolkit": ["wcwidth"],
"pycparser": [],
"pydantic": [
"annotated-types",
"pydantic-core",
"typing-extensions"
],
"pydantic-core": [
"typing-extensions"
],
"pydantic": ["annotated-types", "pydantic-core", "typing-extensions"],
"pydantic-core": ["typing-extensions"],
"pygments": [],
"pyparsing": [],
"pyperclip": [],
"pyproject-hooks": [],
"pytest": [
"iniconfig",
"packaging",
"pluggy"
],
"pytest-datadir": [
"pytest"
],
"python-frontmatter": [
"pyyaml"
],
"python-pptx": [
"lxml",
"pillow",
"xlsxwriter"
],
"pytest": ["iniconfig", "packaging", "pluggy"],
"pytest-datadir": ["pytest"],
"python-frontmatter": ["pyyaml"],
"python-pptx": ["lxml", "pillow", "xlsxwriter"],
"pyyaml": [],
"red-black-tree-mod": [],
"regex": [],
"requests": [
"certifi",
"charset-normalizer",
"idna",
"urllib3"
],
"requests": ["certifi", "charset-normalizer", "idna", "urllib3"],
"resolvelib": [],
"rich": [
"markdown-it-py",
"pygments"
],
"rtfde": [
"lark",
"oletools"
],
"rich": ["markdown-it-py", "pygments"],
"rtfde": ["lark", "oletools"],
"setuptools": [],
"six": [],
"sniffio": [],
"soupsieve": [],
"speechrecognition": [
"requests",
"typing-extensions"
],
"sqlalchemy": [
"greenlet",
"typing-extensions"
],
"speechrecognition": ["requests", "typing-extensions"],
"sqlalchemy": ["greenlet", "typing-extensions"],
"tenacity": [],
"textract": [
"argcomplete",
@ -937,29 +829,20 @@
"speechrecognition",
"xlrd"
],
"tiktoken": [
"regex",
"requests"
],
"tiktoken": ["regex", "requests"],
"tqdm": [],
"typing-extensions": [],
"typing-inspect": [
"mypy-extensions",
"typing-extensions"
],
"typing-inspect": ["mypy-extensions", "typing-extensions"],
"tzlocal": [],
"urllib3": [],
"wcwidth": [],
"wheel": [],
"xlrd": [],
"xlsxwriter": [],
"yarl": [
"idna",
"multidict"
]
"yarl": ["idna", "multidict"]
},
"dev": {}
}
},
"invalidationHash": "a27986828c1132303158dcfbfb7a64c0e01d82c698db3ac241b87bd30305aa83"
}
}