Post your handy utility scripts!

True. One of the original ideas behind the eos-update-notifier was to help newcomers (i.e. not knowing how or when to update) keep the system updated, instead of having them run a system without updates for a long time.
Note that originally we had only the offline install…

Naturally, more experienced users don’t need it (and even might be slightly annoyed about it), but in fact I’m letting the eos-update-notifier run on a daily schedule.

Just a matter of taste… :wink:

1 Like

Actually I’m much worse than most experienced users - I have a vertically smooth scrolling list of coming updates on at all times (when an update is pending - which is nearly always), and a count of how many await updated on screen as well. And I STILL have the functions at hand! :grin: (sometimes the scroll is too slow, and it doesn’t tell me if a reboot is coming…)

Maybe you need a wihle loop of:

while true ; do


Seriously, your idea of having to know in advance if a reboot is recommended or not is great!

Someone on a tyhread I can’t find now was talking about a problem they had with updating and NOT rebooting when they should… so I thought I should add that in. Turns out I like it!

Now if I could find that thread, I could link in this one for them…

I created this script for use with a systemd user service for accessing a samba share without implementing any system wide changes.

The script - do remember to run chmod +x on the script file

#! /bin/bash
# Script for mounting and unmounting a configured samba share
#  Depends on `smbclient` and `gvfs-smb`
#  Customize the variables as needed
#  - Symlinks are located in designated folder (default: $HOME/SMBLinks)
#  - Symlink can be named  (default: $SHARENAME)
#  - Using `-u` argument will unmount and remove the symlink
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    GNU General Public License for more details.
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <>.
# @linux-aarhus -

# your samba server's hostname or IP address

# the share name on the server

# symlink name

# symlink is placed in this folder


SCRIPTNAME=$(basename "$0")

# check argument $1
if [[ "$1" == "-u" ]]; then
    # remove symlink
    # unmount share
    gio mount -u "smb://$HOST/$SHARENAME"
elif [[ $1 != "" ]]; then
    echo ":: $SCRIPTNAME v$VERSION"
    echo "==> invalid argument: $1"
    echo "Usage: "
    echo "  mount SMB : $SCRIPTNAME"
    echo "  umount SMB: $SCRIPTNAME -u"
    exit 1

# mount command
gio mount "smb://$HOST/$SHARENAME"

# easy reference to gio mount point

# create the subfolder
if ! [ -d "$SYMLINKS" ]; then
    mkdir -p "$SYMLINKS"

# use --force argument to suppress warning if link exist

:spiral_notepad: Note:

  • The user service is assuming the above script is located in the service folder.
    Adjust naming accordingly.
  • The service file depends on the credentials has been stored in your keyring.
    Open your file manager’s location bar and input
    Then when prompted store your credentials.
Description=GIO mount smb share-name

ExecStop=/home/%u/.config/systemd/user/ -u


Here’s a small script I use to transform my totally obsolete Windows Phone into a quality webcam. It should work with any phone really (iOS, Android etc) provided you install an app on the phone which streams video accessible by IP. (I’d search “IP cam” in the app store on the phone)

#group the elevated privileges commands
pkexec bash -c "\
modprobe v4l2loopback devices=1 video_nr=10 card_label='VirtualCam' exclusive_caps=1; \
modprobe snd-aloop index=10 id='VirtualMic'; \
#non elevated privileges commands
pacmd 'update-source-proplist alsa_input.platform-snd_aloop.0.analog-stereo device.description="VirtualMic"'
notify-send -t 5000 --icon=camera-video "Virtual Camera" "Camera now streaming" 
ffmpeg -hide_banner -loglevel error -an -probesize 32 -analyzeduration 0 -listen 0 -i http://user:pass@192.168.0.xx:8080/mjpeg -vf format=yuv420p -f v4l2 -vcodec rawvideo /dev/video10  ; notify-send -t 5000 --icon=camera-video "Virtual Camera" "Camera stopped streaming" ;

You’d need to replace http://user:pass@192.168.0.xx:8080/mjpeg with the stream URL provided by the streaming app on your phone. Keep in mind this is not intended to be a secured stream, but if you’re the only one using the network it should be good enough to casually use as a webcam.

The script requires package v4l2loopback-dkms to be installed.

I’m running the script from a launcher in XFCE panel (in non-terminal mode) hence the system notifications to let me know when the streaming is on and off again. (If the streaming fails the last notification is still triggered, letting me know the stream is off).


To cut online video from youtube/vimeo or other sources.

ytdlcut ()
ffmpeg -ss "$2" -i "$(youtube-dl -f "bv*[height<=?1440]" -g --youtube-skip-dash-manifest $1)" -t "$3" -c copy "$(echo "$(youtube-dl -e $1)" | sed 's/[^a-zA-Z0-9 ]//g')-cut.mkv"

Switched to yt-dlp recently, but hasn’t become muscle memory yet. :smile:

This uses yt-dlp. Takes 3 input arguments. 1st is URL, 2nd start time, 3rd is Duration. Output file is in pwd. Change the script to your liking. :grin:

I started the script to handle the recurring tasks on my server:

This is a little script that scans all the .jpg files from current working directory and then moves “Landscape” (width >= height) to a destination folder. Does this using identify which makes things more efficient if current directory is a network dir ( say gdrive or mega) and destination is local.

for i in *.jpg ; do width="$(identify -format '%w' "$i")" ; height="$(identify -format '%h' "$i")" ; if [[ $width -ge $height ]] ; then mv -v "$i" /home/username/destination/ ; else echo "Not Landscape Orientation" ; fi ; done
1 Like

For sway - Screenshot button with optional delay (requires pysimplegui):

#!/usr/bin/env python

import PySimpleGUI as sg
import time
from datetime import datetime
import os


layout = [[sg.Button("Screenshot", button_color=("red", "black"), size=(13, 1), font=("Noto Sans Bold", 11)),
           sg.Text('Delay:'), sg.InputText('0',size=(4,1),font=("Noto Sans Bold", 11))]]

window = sg.Window("Grim-SS", location=(800, 530), alpha_channel=1,
                   keep_on_top=True, no_titlebar=True).Layout(layout).Finalize()

now =
datestr = now.strftime("~/Pictures/grim/%Y%m%dT%H:%M:%S.png")

while True:
    event, values = window.Read()
    if event in (None, 'Exit'):

    if event == 'Screenshot':
        os.system("grim " + datestr)
1 Like