Skip to content

Instantly share code, notes, and snippets.

@sevenissimo
sevenissimo / README.MD
Created July 7, 2024 14:19
Custom Pacman repository

For the purposes of this example, we assume the local repository custom is located in /home/custompkgs.

Append a section for the local repository to /etc/pacman.conf

   [custom]
   SigLevel = Optional TrustAll
   Server = file:///home/custompkgs

Create the repository root and database:

Run commands as Systemd (Dynamic)User

My Systemd unit uses User=hass, but user is reasonably locked. su, sudo or runuser are not aplicable.

Install packages in Python venv

systemd-run --uid=$(id -u hass) --gid=$(id -g hass) /usr/bin/python -m venv /var/lib/hass/.venv && /var/lib/hass/.venv/bin/pip install packaging

Check Home Assistant config

systemd-run --uid=$(id -u hass) --gid=$(id -g hass) /usr/bin/python -m venv /var/lib/hass/.venv && /var/lib/hass/.venv/bin/hass --config /var/lib/hass/ --script check_config -i -f

@sevenissimo
sevenissimo / bundle.py
Created July 4, 2025 08:01
OrcaSlicer Preset Helpers
import os
import json
import sys
from time import time
def bundle(path):
def ls(path, sub):
files = []
path = os.path.join(path, sub)
if os.path.exists(path):
@sevenissimo
sevenissimo / fusionsolar.huawei.com.js
Last active October 1, 2025 10:28
JavaScript snippets to download energy data (injected/withdrawn from e-distribuzione, or produced from Huawei inverter) in CSV format.
(async function() {
'use strict';
const wait = s => new Promise(fn => setTimeout(fn, Math.random() * s * 1000 + 500));
const isoStr = d => [d.getFullYear(), String(d.getMonth() + 1).padStart(2, '0'), String(d.getDate()).padStart(2, '0')].join('-');
const csvRow = (s, arr) => (s + ';' + arr.map(e => String(e).replace('--', '0').replace('.', ',')).join(';'));
const header = 'Giorno;'+Array.from({length:96}, (_, i) => new Date(i * 9e5).toLocaleTimeString('it-IT',{timeZone:'UTC'})).join(';');
let station;