Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[Linux Mint] Start Applications minimized (start in tray)

The fact that some applications do not start minimized (in tray) at system startup has been annoying me for quite some time. I find it even more annoying that you can’t simply set this directly via a checkbox in the Startup Applications for each application. The problem seems to be that each application has a different parameter for this, and therefore it cannot be done generally by the operating system (at least that’s my guess). I have therefore researched the necessary parameters for the applications I use. Simply add the parameter at the end of the Startup Applications command. For some applications, you can also activate it directly in the specific settings.

ApplicationSetting / Command
Bitwarden (Flatpack)File ⇾ Settings ⇾ App Settings ⇾ Start to tray icon
Netxcloud–background
SignalFile ⇾ Preferences ⇾ General ⇾ System ⇾ Start minimized to system tray
Steam-silent
Syncthing GTK–background
Telegram-autostart -startintray
Transmission remote GUI-hidden

Helpful discussion: https://askubuntu.com/questions/663187/how-can-i-run-a-program-on-startup-minimized

[Terminal] Bash script to add leading season and episode numbers by parsing from file names

I had some videos in the format “My Episode #01.mkv” which I wanted to rename to “S01E01 My Episode #01.mkv“. This little script did the job for me:

# Specify the directory containing the files. For current directory use: $(dirname "$0")
directory="/path/to/your/directory"	

# Loop through all .mkv files in the directory
for file in "$directory"/*.{webm,mkv}; do
    # Check if the file exists to avoid errors when no files match
    [ -e "$file" ] || continue
    
    # Extract the base filename (without the directory path)
    filename=$(basename "$file")

    # Use regex to find the episode number (e.g., #01, #02)
    if [[ $filename =~ \#([0-9]+) ]]; then
        episode_number=${BASH_REMATCH[1]}

        # Pad the episode number with a leading zero if it's a single digit
        if [ ${#episode_number} -eq 1 ]; then
            episode_number="0$episode_number"
        fi  
		
        # Construct the new filename
        new_filename="S01E${episode_number} $filename"
        
        # Rename the file
        mv "$file" "$directory/$new_filename"
        echo "Renamed: $filename -> $new_filename"
    fi
done

[Mint] Transmission Remote GUI: download directory path is not absolute

Every few months, I run into this issue when adding a torrent to transgui:

Although there is a 5-year-old closed issue on this bug, which also led to a code adjustment, this bug still seems to exist: https://github.com/transmission-remote-gui/transgui/issues/1270
The user Kethsar has probably already found the right cause and gives some hints on how to solve it. At least it helped me to find a workaround:

  • close transgui if it’s running, otherwise your changes will get overwritten again
  • nano ~/.config/Transmission\ Remote\ GUI/transgui.ini
  • search for the [AddTorrent.transmission]section
  • remove some entries which a related, e.g.
Folder1=/my/path/1
FolHit1=1
FolExt1=
LastDt1=18.02.2024

Folder2=/my/path/2
FolHit2=3
FolExt2=
LastDt2=18.02.2024

...
  • save & quit nano
  • start trangui again and try to add a torrent again

It seems like the issues occurs, when the [AddTorrent.transmission] section reaches Folder50.

[Git] Branch Commands

https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging

https://git-scm.com/book/en/v2/Git-Branching-Branch-Management

# create branch, switch to it and commit changes
git checkout -b hotfix
git commit -a -m 'Commit changes for fix'

# go back to main branch
git checkout main

# merge branch changes to main
git merge hotfix

# delete branch after merging, as it is not needed anymore
git branch -d hotfix

# check on which branch your are
git status

# list all branches including last commit on each branch
git branch -vv

# check which branches are already merged and which are not
git branch --merged
git branch --no-merged

# rename branche locally
git branch --move bad-branch-name corrected-branch-name

# push new name to github/gitlab
git push --set-upstream origin corrected-branch-name

# displays local and remote branches
git branch --all

# delete remote branch
git push origin --delete bad-branch-name

# push branch to remote 
git push origin hotfix

[Linux Mint] Wemos D1 Mini (ESP8266) not recognized

I had a few D1 Minis lying around that I wanted to flash WLED onto. But when plugging into my main PC running Linux Mint 21, no device got recognized. The D1 Mini was just flashing its blue LED light 2 times and that was all. I had already checked before, whether the USB cable is also a Data Link cable, because now and then you accidentally grab a USB cable which is charging only.

Since I was pretty sure it wasn’t a hardware problem, I checked dmesg for any suspicious messages. I’m using an alias named klog to beautify the output.

sudo dmesg -t -L=never -l emerg,alert,crit,err,warn --human --nopager

And indeed there were some messages regarding USB.

usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1

Since brltty is software for people with visual impairment, I don’t need it and therefore uninstalled it.

sudo apt remove brltty
sudo apt autoclean && sudo apt autoremove

And after removing brltty, my D1 Mini got recognized immediately. Fortunately, the solution was very simple. 🙂

Update 19.01.2024: If you receive Cannot open /dev/ttyUSB0: Permission denied errors, when writing to the esp, you have to add your user to the dialout group and re-login. (*)

sudo usermod -a -G dialout $USER

[Git] Error on Windows using VSCode Dev Container

After connecting to a local dev container using Visual Studio Code and trying to clone a private project from Github I got the following error:

Cloning into 'myProject'...
warning: url has no scheme: helperselector
fatal: credential url cannot be parsed: helperselector

The only way I could remove this error was deleting the helperselector settings. So open the git config with:

git config --edit --global

and remove the the helperselector block (the first two lines). You will now get asked again for your credentials when cloning a project.