Skip to content

Instantly share code, notes, and snippets.

View nocodehummel's full-sized avatar

Hummel nocodehummel

View GitHub Profile
@nocodehummel
nocodehummel / profile-systemctl
Last active February 10, 2025 23:39
Systemctl status check
# check systemctl status
failed_jobs=$(systemctl --failed | grep -Ei "failed" | wc -l)
if [ "$failed_jobs" -gt 0 ]; then
echo -e "${RED}Failed systemctl jobs detected:${NC}"
tput setaf 1
systemctl --failed
tput sgr0
else
echo "No failed systemctl jobs."
@nocodehummel
nocodehummel / rclone-sync
Last active February 12, 2025 10:21
Rclone sync script
#!/bin/bash
# Set variables
SOURCE="${SOURCE}"
DESTINATION="${DESTINATION}"
IGNORE_FILE="${IGNORE_FILE}"
EXCLUDE_OPTIONS=""
PID=$$
# Check ignore file
@nocodehummel
nocodehummel / opencpn-docker-command.txt
Created January 8, 2025 09:07
OpenCPN Docker command
# start OpenCPN Docker container to compile and test.
# https://opencpn-manuals.github.io/main/opencpn-dev/docker.html
docker run -v /home/<user>/<source-path/:/src -it docker.io/nohal/opencpn-builder:latest bash
@nocodehummel
nocodehummel / power-query-parameter-function.txt
Last active January 8, 2025 08:56
Power Query Parameter function
(Name as text) => let
Parameters = Excel.CurrentWorkbook(){[Name="Parameters"]}[Content],
Param = Table.SelectRows(Parameters, each ([Key] = Name)),
Value =
if Table.IsEmpty(Param) = true then null
else Record.Field(Param{0},"Value")
in Value
@nocodehummel
nocodehummel / mongoose-aggregate-unwind.txt
Last active January 8, 2025 08:57
Mongoose aggregate and unwind
let activities = await Activity.aggregate([
{ $match: filter }, // filter to be applied
{ $lookup: { // populate the instrument(s)
from: 'instruments',
localField: 'instrument',
foreignField: '_id',
as: 'instrument'
}},
{ $unwind: '$instrument'}, // instrument array to object
{ $unwind: '$events' }, // flatten events