Skip to content

Instantly share code, notes, and snippets.

@ecspresso
ecspresso / wallpaper_changer.sh
Created October 30, 2023 14:08
Change background image with cron, using images from a folder where the current background image is.
#!/bin/bash
PID=$(pgrep gnome-session | tail -n1)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ | tr '\0' '\n' |cut -d= -f2-)
current_image=$(gsettings get org.gnome.desktop.background picture-uri | xargs echo)
if [ "$1" == "echo" ]; then
echo $current_image
@ecspresso
ecspresso / exe-to-png.ps1
Created January 20, 2025 10:21
Extract png from exe with PowerShell
# https://learn-powershell.net/2016/01/18/getting-the-icon-from-a-file-using-powershell/
# (archive link) https://web.archive.org/web/20180609182021/https://learn-powershell.net/2016/01/18/getting-the-icon-from-a-file-using-powershell/
$exe = 'path\to\.exe'
$png = 'image.png'
$format = [System.Drawing.Imaging.ImageFormat]::Png
[System.Drawing.Icon]::ExtractAssociatedIcon($exe).ToBitmap().Save($png, $format)