Skip to content

Instantly share code, notes, and snippets.

View lepiaf's full-sized avatar

Thierry T. lepiaf

View GitHub Profile
@mosquito
mosquito / README.md
Last active May 10, 2024 20:44
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@artizirk
artizirk / gnupg_scdaemon.md
Last active April 3, 2024 14:49
OpenPGP SSH access with Yubikey and GnuPG

NB: This document describles a 'Old-School' way of using Yubikey with SSH

Modern OpenSSH has native support for FIDO Authentication. Its much simpler and should also be more stable with less moving parts. OpenSSH also now has support for signing arbitary files witch can be used as replacement of gnupg. Git also supports signing commits/tags with ssh keys.

Pros of FIDO

  • Simpler stack / less moving parts
  • Works directly with ssh, ssh-add and ssh-keygen on most computers
  • Simpler
  • Private key can never leave the FIDO device

Cons of FIDO

@gibtang
gibtang / gist:83f9681b525908900ec4b490992f032d
Created June 6, 2020 10:10
Simple sort of objects in a list using an attribute of type string
class cars:
def __init__(self, name, price):
self.name = name
self.price = price
unsorted_cars = []
unsorted_cars.append(cars('Ford', 20000))
unsorted_cars.append(cars('Volvo', 50000))
unsorted_cars.append(cars('BMW', 24000))
@m-radzikowski
m-radzikowski / script-template.sh
Last active May 4, 2024 04:13
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@clarkmcc
clarkmcc / delete-shutdown-pods.sh
Last active May 11, 2022 12:15
Deletes Kubernetes pods with a status of Shutdown that are usually left over after a GKE pre-emptible node goes offline.
#!/bin/sh
for namespace in $(kubectl get ns | awk '{print $1}' | grep -v NAME); do
for pod in $(kubectl get pod -n $namespace --field-selector=status.phase!=Running | grep Shutdown | awk '{print $1}' | grep -v NAME); do
kubectl delete pod -n "$namespace" "$pod"
done
done
@REDVM
REDVM / immich_auto_album.py
Last active April 17, 2024 09:57
Create and populate albums on Immich based on folder name
import requests
import os
from collections import defaultdict
# I have photos in subfolders like :
# /mnt/media/Photos/2023-08 Holidays
# /mnt/media/Photos/2023-06 Birthday
# /mnt/media/Photos/2022-12 Christmas
# This script will create 3 albums
# 2023-08 Holidays, 2023-06 Birthday, 2022-12 Christmas