All posts by ZJ Laczik

STM32CubeProgrammer and STM32_Programmer_CLI fail complaining about missing STM32_Prog_DB_0xNNN.xml or 0xNNN.stldr files

This problem can be caused by not reading the correct device ID, in which case the 0xNNN above will be 0x000. Obviously those files do not exist. See solution here.

Another reason reason might be that STM32CubeProgrammer and STM32_Programmer_CLI try to use the incorrect (relative) paths. Some versions of the programs relied on using paths relative to the current directory and not the install directory.

A workaround is either to run the programs from the installation directory or symlink the missing files to a location where the programs try to look for them. The debug log messages give an indication for what these locations are.

The files actually are in the $(STM32Cube)/STM32CubeProgrammer/ Data_Base/ and $(STM32Cube)/STM32CubeProgrammer/bin/FlashLoader/ directories.

Colour less pipes

By default less will display colour escape codes directly and will not interpret them. Some programs will only output colour when running in a colour capable terminal; by default a linux pipe is not considered colour capable. We have to tell them explicitly to generate and process colour escape sequences:

ls --color=always | less -R

For further details see askubuntu link.

Zoom function in Calibre e-reader

There does not seem to be one.

Control + mouse scroll will adjust the font size, but not the overall scale of the display. This is especially annoying when at the default zoom level some of the text falls outside the the e-reader window:

Cumbersome, but at least the text will become readable: CSS to the rescue.

  • Right click in the reader window
  • Select ‘Preferences’
  • Select ‘Styles’
  • Add a new scaled body style in the text box
  • Click OK
  • Close the ‘Preferences’ menu
  • Start reading

The CSS properties added are:

body {
  transform-origin: top left;
  transform: scale(1.0);
}

Why this is not available via the GUI… ?

P.S. The new style is stored in .config/calibre/viewer-webengine.json

Unpack, modify and repack an epub file

Although epub format e-books are simple ZIP archives, care has to be taken in how unzip and zip are used to manipulate them.

mkdir wrk && cd wrk
unzip -O UTF-8 old.epub
nano OEBPS/one_of_the_files.xhtml
zip -rX ../new.epub mimetype META-INF/ OEBPS/

Without using the -O option when unpacking UTF-8 file names are likely to get corrupted. For the repack, use of -X is required and the directory order in the archive has to be as given above, otherwise the epub file will not be recognised by most e-readers.

As an aside, modifications can be easily tested using a web browser. Each page in the e-book is represented as an xhtml document, which can be opened by pointing the browser to file:///home/user/wrk/OEBPS/one_of_the_files.xhtml (for example).

Check server temperature using HP iLO

ssh Administrator@10.1.0.235 -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostkeyAlgorithms=+ssh-rsa
</>hpiLO-> show /system1/sensor1
/system1/sensor1
  Properties
    DeviceID=01-Inlet Ambient 
    OperationalStatus=Ok
    RateUnits=Celsius
    CurrentReading=31
    SensorType=Temperature
    HealthState=Ok
    oemhp_CautionValue=42
    oemhp_CriticalValue=46
</>hpiLO-> show /system1/sensor5
/system1/sensor5
  Properties
    DeviceID=05-Chipset 
    OperationalStatus=Ok
    RateUnits=Celsius
    CurrentReading=61
    SensorType=Temperature
    HealthState=Ok
    oemhp_CautionValue=105
    oemhp_CriticalValue=Not Applicable
</>hpiLO-> show /system1/sensor12
/system1/sensor12
  Properties
    DeviceID=12-Sys Exhaust 
    OperationalStatus=Ok
    RateUnits=Celsius
    CurrentReading=46
    SensorType=Temperature
    HealthState=Ok
    oemhp_CautionValue=68
    oemhp_CriticalValue=73

HP iLO ssh access

Even the most recent version of iLO is trying to use cypher algorithms that have been deprecated in OpenSSH:

ssh Administrator@10.1.0.235
Unable to negotiate ... no matching key exchange method found.
Their offer: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
ssh Administrator@10.1.0.235 -oKexAlgorithms=+diffie-hellman-group1-sha1 
Unable to negotiate ... no matching host key type found.
Their offer: ssh-rsa,ssh-dss
Unable to negotiate ... no matching cipher found. Their offer: aes256-cbc,aes128-cbc,3des-cbc

… and the winner is:

ssh Administrator@10.1.0.235 -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostkeyAlgorithms=+ssh-rsa -oCiphers=+aes256-cbc

Make your own QR codes

Install the tools:

sudo apt install qrencode zbar-tools

Create the source:

nano text_for_QR_code.txt
MECARD:N:Dr AN Other;TEL:+441234123456;EMAIL:AN Other <ANOther@other.org>;NOTE:Director;ADR:123 Other Street, London, A1N 2OT, United Kingdom;URL:https://other.org;

Generate the corresponding QR codes:

qrencode -t PNG -r text_for_QR_code.txt -l H -o QR.png
convert QR_2023.png QR_2023.jpg
qrencode -t ASCII -r text_for_QR_code.txt -l H -o QR_2023.txt
cat QR_2023.txt | sed 's/#/█/g' > QR_2023_utf8.txt

Useful links:

OUCS VPN

Install:

  1. The AnyConnect VPN Client for Linux is available from the OUCS Software downloads page for Linux; see release notes for details.
  2. Unpack the downloaded file using an archive manager or type tar -xzvf filename from a terminal window (replacing filename with the file’s name).
  3. In a terminal window, navigate to the newly created directory beginning ‘anyconnect’, then to the VPN directory.
  4. Start the installation by typing sudo ./vpn_install.sh

Connect:

  1. To start the client either: • Select Cisco AnyConnect Secure Mobility Client from the Applications menu.
    • Type vpnui at the command line in the installation directory (for Ubuntu this is /opt/cisco/bin).
  2. Provide vpn.ox.ac.uk then Connect.
  3. Provide your Oxford username in the format abcd1234@ox.ac.uk and your Single Sign-On (SSO) password.

Disconnect:

  1. Select the VPN icon in the system tray.
  2. Select Disconnect.

Advanced settings:

The Cisco AnyConnect VPN client requires an SSL tunnel (TCP port 443) and optionally a DTLS tunnel (UDP port 443).

VPN clients contact the VPN servers in the netblock 192.76.7.64/27.

VPN clients will be given an IP address from the private IP ranges of 10.1.32.0/20 or 10.10.64.0/18.  These private addresses will be mapped to a public IP in the 129.67.116.0/22 netblock by the use of dynamic PAT.

Further details are available on the OUCS VPN page.

Disable snap and switch from snap to deb packages for Firefox in Ubuntu 22.04

Disable snapd

Remove Firefox (and other) snap packages:

snap list
snap remove firefox

Stop snapd service:

systemctl stop snapd.service
systemctl stop snapd.socket
systemctl stop snapd.seeded.service
systemctl disable snapd.service
systemctl disable snapd.socket
systemctl disable snapd.seeded.service

Remove snap related packages and directories:

apt autoremove --purge snapd chromium-browser* chromium-browser-l10n* gnome-software-plugin-snap* liblzo2-2* snapd* squashfs-tools*
rm -rf /var/cache/snapd
rm -rf /root/snap/
rm -rf /snap /var/snap /var/lib/snap

Install non-snap version of Firefox

Disable snap version

nano /etc/apt/preferences.d/mozilla-firefox
Package: firefox*
Pin: release o=Ubuntu*
Pin-Priority: -1
add-apt-repository ppa:mozillateam/ppa
apt update
apt install firefox
How to Install Latest Firefox as classic Deb in Ubuntu 22.04 | UbuntuHandbook
https://ubuntuhandbook.org/index.php/2022/04/install-firefox-deb-ubuntu-22-04/

How to Install Firefox as a .Deb on Ubuntu 22.04 (Not a Snap) - OMG! Ubuntu!
https://www.omgubuntu.co.uk/2022/04/how-to-install-firefox-deb-apt-ubuntu-22-04

Change X11 window title

A typical use case is when an editor is setting its window title to the full long path name such that the actual important part, the file name, falls off the edge on the right and becomes invisible. Unfortunately the X11 window title is normally set internally by the application and its format is hard coded. A solution is to monitor the editor window title and modify it if its becomes too long.

Continue reading Change X11 window title