Skip to content

Instantly share code, notes, and snippets.

View LeoniePhiline's full-sized avatar
💭
🦀

LeoniePhiline

💭
🦀
View GitHub Profile
@LeoniePhiline
LeoniePhiline / auto-php.sh
Last active March 24, 2024 12:41
Auto-determine plesk php-fpm version for a given site in order to invoke the correct plesk php CLI binary in crontab. Requires PHP FPM setting "pm" to be set to "dynamic" with at least 1 process running at all times. Will not work with default "pm=ondemand"!
#!/bin/zsh
# USAGE in crontab:
# =================
#
# */15 * * * * (date -Is; /path/to/auto-php.sh 'subdomain.example.com' -f '/path/to/php/script' -- '<php script argument...>') >> /var/www/vhosts/example.com/logs/subdomain.example.com/cron_log 2>&1
# First argument, e.g. "subdomain.example.com"
SITE_HOSTNAME="$1"
@LeoniePhiline
LeoniePhiline / battery-care-notifications.zsh
Last active June 17, 2023 16:52
OpenSUSE Tumbleweed laptop battery care warnings, below 20% when discharging and above 80% when charging. Requires ripgrep for regex matching. Run as KDE autostart-script.
#!/usr/bin/zsh
sleep 30
while true
do
# You might need to change the `Battery $N` number in both regular expressions below.
# Use `acpi -b` to determine the battery number you want to watch.
state="$(acpi -b | rg '^Battery 1: (\w+)' --only-matching --replace '$1')"
percentage="$(acpi -b | rg '^Battery 1: \w+, (\d+)%' --only-matching --replace '$1')"
@LeoniePhiline
LeoniePhiline / dockerfile-auto-update-renovate-regex-manager.md
Created February 23, 2022 17:09
Update GitLab dependency proxy prefixed docker images and pinned PHP PECL packages in Dockerfiles with renovate-bot

Update GitLab dependency proxy prefixed docker images and pinned PHP PECL packages in Dockerfiles with renovate-bot

Example custom-built php-cli Dockerfile

ARG DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX
FROM $DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX/composer:2 AS composer
FROM $DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX/php:7.4-cli-alpine3.15
ENV MUSL_LOCPATH="/usr/local/share/i18n/locales/musl"
RUN set -eux \
@LeoniePhiline
LeoniePhiline / .gitlab-ci.yml
Created May 12, 2020 23:49 — forked from t3easy/.gitlab-ci.yml
Build and deploy docker containers with GitLab CI
image: an-image-with-docker-and-docker-compose
variables:
DOCKER_TLS_VERIFY: "1"
DOCKER_CERT_PATH: ".docker"
before_script:
- mkdir -p $DOCKER_CERT_PATH
- echo "$DOCKER_CA" > $DOCKER_CERT_PATH/ca.pem
- echo "$DOCKER_CERT" > $DOCKER_CERT_PATH/cert.pem