Skip to content

Instantly share code, notes, and snippets.

View muety's full-sized avatar
🤓

Ferdinand Mütsch muety

🤓
View GitHub Profile
# before: https://anchr.io/i/1NQ3x.png
# after: https://anchr.io/i/iMkiK.png
# script is interactive
# it will first fetch all broken products and then ask you for confirmation before actually updating them
import re
import sys
from typing import Tuple, Set, List, Any, Dict
import requests
@muety
muety / next_subuid.sh
Last active August 17, 2023 10:20
Script to determine the next available subuid on Linux
#!/bin/bash
# Author: Ferdinand Mütsch <[email protected]>
# Script to determine the next subuid / subgid for a user.
# It will consider (a) all already existing subuid / subgid ranges and (b) all "real" user ids.
#
# Note: When using LDAP login (e.g. with SSSD), /etc/passwd won't contain those external users.
# In the case of SSSD, you will have to enable enumeration (https://access.redhat.com/solutions/500433) to make "getent passwd" all local AD / LDAP users.
# However, on the other hand, enabling recommendation is not recommended, because it will cause high load on server and client (https://docs.pagure.org/sssd.sssd/users/faq.html#when-should-i-enable-enumeration-in-sssd-or-why-is-enumeration-disabled-by-default).
@muety
muety / smard.py
Created June 27, 2024 06:31
Script to fetch the current electricity market price in Germany
#!/usr/bin/python
# Script to fetch the current electricity market price in Germany.
# Borrowed from https://github.com/mampfes/ha_epex_spot/blob/main/custom_components/epex_spot/EPEXSpot/SMARD/__init__.py, thanks!
import argparse
from datetime import datetime, timedelta, timezone
import aiohttp
import asyncio
@muety
muety / tibber.py
Created July 19, 2024 13:03
Script to fetch the current electricity market price in Germany
#!/usr/bin/python
# Script to fetch the current electricity market price in Germany from Tibber's API.
# Borrowed from https://github.com/mampfes/ha_epex_spot/blob/main/custom_components/epex_spot/EPEXSpot/Tibber/__init__.py, thanks!
import argparse
import asyncio
import aiohttp
from datetime import datetime, timedelta
@muety
muety / immich_clean_duplicates.py
Created August 1, 2024 20:36
Script to clean up duplicates in Immich based on their file size.
#!/usr/bin/python
# Script to clean up duplicates in Immich based on their file size.
#
# Rationale: I observed that photos which I had applied the Google Photos' "Optimize" filter to, are imported in their original and edited versions,
# while the edited version usually seems to have a smaller file size, despite same resolution (lower JPEG quality, maybe?).
# This script iterates all duplicates detected by Immich itself and, given a pair of two, removes the smaller one if their file names and creations dates match
#
# Prerequisites:
# 1. Run Immich Smart Search
diff --git a/demo/mono_det_demo.py b/demo/mono_det_demo.py
index 42416fd9..0f4fcec9 100644
--- a/demo/mono_det_demo.py
+++ b/demo/mono_det_demo.py
@@ -56,8 +56,8 @@ def parse_args():
call_args = vars(parser.parse_args())
call_args['inputs'] = dict(
- img=call_args.pop('img'), infos=call_args.pop('infos'))
- call_args.pop('cam_type')