Skip to content

Instantly share code, notes, and snippets.

@ibressler
ibressler / get_SMART_data.sh
Last active August 14, 2025 10:58
Retrieve the S.M.A.R.T. & FARM meta data of a given disk and store it to a file named by its model, serial number and the current date.
#!/bin/sh
# Retrieve the S.M.A.R.T. & FARM meta data of a given disk and store
# it to a file named by its model, serial number and the current date.
devpath="$1"
if [ ! -e "$devpath" ]; then
echo "Please provide an existing device path!"
exit 1
fi
cmd=smartctl
@ibressler
ibressler / MDM Profiles on macOS.md
Last active July 11, 2025 14:39
MDM Profiles on macOS

MDM Profiles on macOS

Notes: From Zeno Popovici with edits & tested on a M1 macbook with Ventura (macOS 13).

In macOS you can check the MDM status with the following command in a Terminal:

profiles status -type enrollment

Non-removable MDM profiles cannot officially removed without doing a full system wipe

@ibressler
ibressler / Add LUKS2 support to GRUB bootloader UEFI image.md
Last active November 29, 2023 15:07
Add LUKS2 support to GRUB bootloader UEFI image

Add LUKS2 support to GRUB bootloader UEFI image

  • Assuming a Linux live or rescue system is booted and the new soon-to-be root encrypted partition is accessible on an NVMe drive, 2nd partiton (/dev/nvme0n1p2).
  • The EFI partition is the first on the device (/dev/nvme0n1p1).
  • There is no extra /boot partition since it should be encrypted as well and is included in the partition mounted as root / later.
  • The following requires root privileges, a preceeding sudo -i is assumed.

Inspired by: https://askubuntu.com/questions/1397826/default-embedded-modules-in-bootx64-efi-grubx64-efi-and-mmx64-efi/1466507#1466507

1. Get chroot

@ibressler
ibressler / Python+Miniforge+JupyterLab Install and Update Guide for Windows.md
Last active July 10, 2025 10:11
Python+Miniforge+JupyterLab Install and Update Guide for Windows

Python+Miniforge+JupyterLab Install and Update Guide for Windows

  • For a unprivileged user, without administrative rights
  • If a window, asking for an (admin) password pops up during installation or when installing any packages, just ignore it by closing the window. The installers should switch to user-mode then.

Install

  1. Search for Miniforge in the Internetz or download from here directly: https://conda-forge.org/miniforge/
  2. Install Miniforge for the current user only
  3. Create a dedicated environment for Jupyter Lab:
@ibressler
ibressler / exif_rename_iphone_pics.sh
Created June 16, 2019 18:10
Rename iPhone pictures by embedded timestamp and associated MOV video files
for fn in *.JPG; do
echo "=> $fn"
# get the timestamp from exif, format it accordingly
ts=$(exiv2 -g DateTimeOriginal $fn | awk '{ts=$(NF-1)"_"$NF; gsub(":","",ts); print ts}')
# retrieve the base name as well
basen=${fn%.*}
# rename the image, append its original name
mv -i "$fn" "${ts}_$basen.jpg"
# check if there is video file with the same name (live mode)
if [ -f "$basen.MOV" ]; then
@ibressler
ibressler / fix_broken_exif.sh
Created June 16, 2019 14:57
fix exif metadata containing wrong keys and datetime with binary character
fn="$1"
echo "fn: $fn"
[ -f "$fn" ] || exit 1
str="$(exiv2 -p a "$fn" 2>&1 | grep -a Exif.Image.DateTime | grep -a -o '2019:.*$')"
#echo "'$str'"
# fix datatime first
exiv2 -M"set Exif.Image.DateTime $str" "$fn"
# extract all readable metadata (to .xmp file)
exiv2 -eaX "$fn"
# delete all metadata
@ibressler
ibressler / gist:2bfbda39665e0371c70bb45e1b0d5ccf
Created July 4, 2018 13:42
Optimize PDF files on Linux
# as per https://stackoverflow.com/q/10450120
# PDFSETTINGS: http://milan.kupcevic.net/ghostscript-ps-pdf/
gs -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -sOutputFile=test.pdf "$INFILE"
@ibressler
ibressler / earlygrubcryptoimg.sh
Last active March 10, 2024 22:49
Creates an early grub core image for ESP to cryptmount a LUKS+LVM partition where the grub files /boot/ and the kernel is stored
#!/bin/dash
# Creates a standalone core image with grub to be started by EFI.
# It complements the excellent cryptroot tutorial at
# https://community.linuxmint.com/tutorial/view/2061
# for grub on BTRFS inside LVM inside LUKS.
#
# It initiates decryption of the root device which contains
# LVM with BTRFS on the root volume where grub is installed.
# Therefore, it allows to load grub from an LUKS encrypted BTRFS
# root file system.
@ibressler
ibressler / lcnc_mdi-queue.patch
Last active February 10, 2017 11:51
LinuxCNC MDI queue quick fix
diff --git a/src/emc/motion/command.c b/src/emc/motion/command.c
index da081d4..58cd81d 100644
--- a/src/emc/motion/command.c
+++ b/src/emc/motion/command.c
@@ -1026,7 +1026,7 @@ void emcmotCommandHandler(void *arg, long period)
emcmotStatus->atspeed_next_feed = 1;
}
/* append it to the emcmotDebug->coord_tp */
- tpSetId(&emcmotDebug->coord_tp, emcmotCommand->id);
+// tpSetId(&emcmotDebug->coord_tp, emcmotCommand->id);