Software - Notes on my favorite programs

mail

How to embed a cover art image into an MP3 file ?

  1. get a song as MP3 :
    yt-dlp --extract-audio --audio-format mp3 --audio-quality 0 https://music.youtube.com/watch?v=Oj0sOJ4BVJ0
  2. find a cover art image to embed (works better with square-shaped images)
  3. embed the image :
    ffmpeg -i song_withoutImage.mp3 -i image.jpg -map 0 -map 1 -c copy -disposition:v:1 attached_pic song_withImage.mp3
  4. should you need to retry embedding the image, VLC will display a cached version of the embedded image. You may clear its cache in ~/.cache/vlc
mail

How to enable an extra keyboard layout on a minimal Debian install ?

Reboot-proof method (source) :

  1. If this is the first boot of a freshly installed system : apt update
  2. apt install keyboard-configuration console-setup
  3. follow on-screen instructions

Alternate solution

For the current session only (source) :

  1. apt install console-data
  2. dpkg-reconfigure console-data is triggered automatically, select the corresponding keyboard layout from the list
For all subsequent reboots :
loadkeys fr
mail

Black screen after a successful graphical login

Situation

  1. my Debian Buster workstation boots normally and displays the graphical login window, as usual
  2. I enter my credentials, then
  3. the screen turns black
  4. there's nothing more I can do, the CTRL-Alt-Fn keys have no effect

Details

The context :

Solution

A few things to remember :

  • /var/log/Xorg.0.log may report errors such as :
    (EE) Failed to load module "vboxvideo" (module does not exist, 0)
    (EE) modeset(0): glamor initialization failed
    These look unrelated to the current problem (source).
  • Getting the graphical login screen means that Xorg is fine and the problem is at the "what-comes-after-the-graphical-login" level (for me : XFCE)
  • XFCE writes its error logs in ~/.xsession-errors

Solution :

  • rm ~/.Xauthority
  • ~/.xsession-errors says :
    (xfsettingsd:9776): xfsettingsd-WARNING **: 10:35:57.524: Unknown mode '1360x703 @ 59.9' for output VGA-2, aborting.
    Looks like one of my screen is presented as a 1360x703 screen to XFCE (), which doesn't know what to do with it.
  • Edit ~/.xprofile :
    xrandr --auto --output VGA-1 --mode 1920x1080
    xrandr --auto --output VGA-2 --mode 1920x1080
    xrandr --output VGA-2 --left-of VGA-1
    So that XFCE won't have to "guess" the screen mode the next time.
  • Then load it :
    source ~/.xprofile

Last words :

  • the 3rd line of ~/.xprofile is used to specify the relative position of screens, so that the mouse cursor can easily move from one screen to the other
  • even though the external screens are physical connected via HDMI to the docking station, they are named VGA-n because this is how VirtualBox exposes them to the guest machine.
mail

How to mount an .iso file as any removable media ?

mount -t iso9660 -o loop /path/to/file.iso /mount/point/
mail

How to remove line breaks inside cells in LibreOffice Calc ?

  1. Select the cells containing the line breaks you want to remove (or don't select anything if you want to alter the whole datasheet)
  2. CTRL-h (or Edit | Find & Replace)
  3. In the Find field, enter \n
  4. In the Replace field, enter whatever you would like to replace line breaks with
  5. Then click Other options
  6. Tick Current selection only if you wish to alter selected cells only
  7. Tick Regular expressions
  8. Then Replace (or Replace All if you're brave enough)
mail

X2Go

Table of contents

What is X2Go ?

X2Go enables you to access a graphical desktop of a computer over a low bandwidth connection (full details).

Server install on Debian (source, procedure for Stretch) :

Preliminary notes :

  • All commands below must be run as root, use sudo accordingly.
  • The installation process itself can be run via SSH

for Jessie

  1. Add the X2Go Debian repository :
    apt-key adv --recv-keys --keyserver keys.gnupg.net E1F958385BFE2B6E
  2. Create a dedicated sources.list-like :
    cat << EOF > /etc/apt/sources.list.d/x2go.list
    # X2Go Repository (release builds)
    deb http://packages.x2go.org/debian jessie main
    # X2Go Repository (sources of release builds)
    deb-src http://packages.x2go.org/debian jessie main
    EOF
  3. apt-get update
  4. apt-get install x2go-keyring && apt-get update
  5. Install the server package : apt-get install x2goserver
    This also installs x2goserver-xsession.

for Stretch

  1. add the repository key
    Should you get a gpg: keyserver receive failed: No dirmngr error, it can be fixed with (source) :
    apt install dirmngr
  2. declare the repository :
    cat << EOF > /etc/apt/sources.list.d/x2go.list
    # X2Go Repository (release builds)
    deb http://packages.x2go.org/debian stretch extras main
    # X2Go Repository (sources of release builds)
    deb-src http://packages.x2go.org/debian stretch extras main
    EOF
  3. apt update && apt install x2goserver x2goserver-xsession

Client install

On Windows 7 :

Just follow these instructions.
On my side, the "install without admin rights and without a start menu entry" hack didn't work

On Stretch (source) :

apt install x2goclient
Bug : the connection closes instantly : Status: finished
Debug server-side :
  1. ls -lrt /var/log/*log
    
    -rw-r----- 1 root	adm	97K	Dec 22 11:43 /var/log/user.log
    -rw-r----- 1 root	adm	1.3M	Dec 22 11:43 /var/log/syslog
    -rw-r----- 1 root	adm	67K	Dec 22 11:44 /var/log/auth.log
  2. tail -f /var/log/auth.log + retry opening a client session
    
    Dec 22 11:51:38 myX2goServer sshd[27225]: Accepted publickey for kevin from my.public.IP.address port 16531 ssh2: RSA SHA256:0afdoG/gObils6+n8zzo5mycmiqAaOwT0qSHJgOWTZH
    Dec 22 11:51:42 myX2goServer sshd[27286]: refused local port forward: originator localhost port 56810, target localhost port 44406
    Dec 22 11:51:42 myX2goServer sshd[27286]: channel_by_id: 0: bad id: channel free
    Dec 22 11:51:42 myX2goServer sshd[27286]: Disconnecting: Received ieof for nonexistent channel 0.
  3. Let's try :
    iptables -P FORWARD ACCEPT
    No change
  4. Let's try something else : in /etc/ssh/sshd_config, change :
    AllowTcpForwarding no
    into
    AllowTcpForwarding yes
    then
    systemctl reload sshd
    and try again opening a client session :

Usage :

The idea is to connect from anywhere I'm forced to use Windows 7 to any remote server (via TCP 443). I've not been able to make the X2Go client go through the corporate web proxy, so to workaround this, I've created a local SSH tunnel between my workstation and the distant TCP 443.

You can use SSH keys to authenticate to the remote host (guess you've already been there via PuTTY ), but don't forget to use private keys at the OpenSSH format, not .ppk files (PuTTY private key format).

mail

How to recover the WebLogic web console admin password ?

  1. View the boot.properties file :
    cat /appli/projects/myApplicationName/weblogic_10.0MP1/wl-domains/DOMAINE-WLS-MYAPP/boot.properties
    #Mon Mar 21 17:00:17 MET 2011
    password={3DES}sRO9OiEXAWNw2AE7UfkAxw\=\=
    username={3DES}kpclVYTJKNeNXN1ZPNzfNQ\=\=
    And save the encrypted password for later.
  2. Move to the security child directory of the directory containing the boot.properties file :
    cd /appli/projects/myApplicationName/weblogic_10.0MP1/wl-domains/DOMAINE-WLS-MYAPP/security/
  3. Make sure there is a SerializedSystemIni.dat file in this directory (this file will be read by the script below) :
    ls -l SerializedSystemIni.dat
  4. In this directory, create a Python script :
    cat << EOF > script.py
    from weblogic.security.internal import *
    from weblogic.security.internal.encryption import *
    
    # Remind user about how to use
    raw_input("Please ensure SerializedSystemIni.dat is in the current directory now, and press ENTER to continue.")
    
    # Get encryption service
    encryptionService = SerializedSystemIni.getEncryptionService(".")
    clearOrEncryptService = ClearOrEncryptedService(encryptionService)
    
    # Get user to enter password
    pwd = raw_input("Enter encrypted password (Eg. {3DES}Y1fA34S...): ")
    
    # Remove unnecessary escape characters
    preppwd = pwd.replace("\\\\", "")
    
    # Decrypt the password
    print "Recovered password is: " + clearOrEncryptService.decrypt(preppwd)
    EOF

    There are extra \ in the line : preppwd = pwd.replace("\\\\", "") to escape the regular \ when writing the file with cat and heredocs.
    The real line will be : preppwd = pwd.replace("\\", "")

  5. Then run :
    • as webadm, the user owning the WebLogic processes : ${WL_HOME}/common/bin/wlst.sh script.py
    • as root : /logiciels/bea/weblogic_10.0MP1/wlserver_10.0/common/bin/wlst.sh script.py
      (or /export/logiciels/bea/weblogic_10.0MP1/wlserver_10.0/common/bin/wlst.sh ???)
    ... and enter the encrypted password when prompted.
  6. Enjoy !
mail

SVN

For all SVN commands requiring login and password :
svn --username userName --password 'password' svnCommand
Download sources from the SVN repository :
svn checkout http://SVN_repository_url/project/tagName[@revision] destinationDirectory
Register new files into the SVN repository :
svn add newFile1 newFile2 ...
Unregister files from the repository (details) :
  • schedule files for deletion from repository upon next commit + remove files from working copy : svn del /path/to/oldFile1 /path/to/oldFile2 ...
  • delete files from the repository (immediate commit) : svn del protocol://url/to/oldFile1 ...
Apply local changes to the repository :
  • save ALL changes : svn commit -m "description of changes"
  • OR save listed files only : svn commit file1 file2 ... -m "description of changes"
Update working copy after a commit by one of the project contributors :
svn update
Get information on working copy :
svn stat (or svn status)
Parameters :
Parameter Usage Example
--depth empty|files|immediates|infinity Investigate not only the current directory svn stat --depth infinity
Output :
Output Meaning
? file file is unknown to SVN
D file file has been marked for deletion with svn del
M file file has local modifications that are not yet saved into the repository
Information on local file :
svn info localFile
Discard local changes : roll back to the previous repository version :
svn revert path/to/file
Roll back to any previous repository version (source : 1, 2, SVN book) :
  1. Testing : svn merge --dry-run -r currentRevision:revisionToRevertTo path/to/file
  2. Same as above without --dry-run
  3. Verify that the change is removed : svn diff
  4. svn commit -m "Reverted to revision xxx."
Show differences between the working copy and the latest revision :
svn diff file
Differences between 2 revisions :
svn diff -r rev_n:rev_m file
Show modification author :
svn blame file
Show commit messages :
svn log file
mail

How to concatenate video files (ffmpeg, mencoder) ?

The cat method :

cat 01.mpg 02.mpg 03.mpg >> final.mpg

  • This only works with real MPEG files.
  • The displayed video duration may be the duration of 01.mpg instead of the sum of the concatenated videos duration. The progress bar will reach 100% at the end of 01.mpg.

The ffmpeg method (source) :

This was used to convert Quicktime videos (in .mpg files ?) into MPEG videos :

ffmpeg -i 02.mpg -deinterlace -sameq 02.mpeg

ffmpeg + cat (tested on Quicktime to MPEG):

oldExtension='.mpg';newExtension='.mpeg';for vdo in *$oldExtension;do ffmpeg -i $vdo -sameq $(basename $vdo $oldExtension)$newExtension;done;cat *$newExtension > final$newExtension

The files to convert + concatenate must be separated from others in a work directory.

mail

How to change the font size in xterm ?

  1. Pick a font from xfontsel. Get its specification string into the clipboard with .
  2. Append your chosen font specification string into ~/.Xresources :
    xterm*font:	*-fixed-medium-r-*-*-18-*
  3. Restart X or reload settings immediately : xrdb -merge ~/.Xresources