On Unix-like systems such as Linux and macOS, Python can detect if a script is being run as sudo / root from the
UID,
which is by definition zero for root.
On Windows, the ctypes module can be used to check if the current user is an administrator.
Its convenient to flip an image vertically or horizontally from Terminal.
In general, modifying an image in any way including cropping, flipping, rotating, etc. is a lossy process if the image compression algorithm used is lossy such as JPEG.
Lossless compression formats such as PNG will remain lossless with this operation.
Here are examples using
ImageMagick
or
IrfanView.
Assume the input image is named “in.png” and the modified image is written to “out.png”.
IrfanView has been popular for decades on Windows and
WINE
as a no-cost (not open source) image viewing and simple modification program that handles many formats.
IrfanView can also be used from the command line.
Install IrfanView directly, not via the Microsoft App Store:
winget install IrfanSkiljan.IrfanView
The order of the commands is important.
These commands do not open the IrfanView GUI–they are “headless” operations.
If there are spaces in the file paths, they must be enclosed in quotes like
"c:/data pics/in.png"
The POSIX functions
nanosleep()
and
clock_gettime()
useful in games and other programs needing repeatable time delay and time measurement is not available in the standard C library on Windows with Visual Studio and certain MinGW CPU architectures.
The clock tick for Windows is 100 ns.
The practical achievable timer resolution on Windows is in the
millisecond range.
This presents a floor on the accuracy achievable for sleep timers.
Virtual Machine running of Windows makes the sleep accuracy significantly worse.
In general across general-purpose operating systems, high accuracy sleep timer performance is not guaranteed.
For high accuracy sleep timers (i.e., beyond what is needed for gaming and abstract high-level control of hardware interfaces), consider using a real-time operating system (RTOS) or a dedicated microcontroller.
CMake can use MUSL slim libc natively (e.g. Alpine Linux), in a Docker container, or by cross-compiling.
Cross-compiling in CMake generally uses a toolchain file to set critical variables that can’t be detected automatically.
For example, using the x86_64 MUSL binaries from musl.cc, extract the tar file say to ~/musl and then create file ~/musl/musl-toolchain.cmake like:
set(CMAKE_SYSTEM_NAMELinux)# target system
set(CMAKE_SYSTEM_PROCESSORx86_64)# target architecture
set(CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_LIST_DIR}/x86_64-linux-musl-native)# These cross-compilers come from the toolchain downloaded from musl.cc
set(_bin ${CMAKE_FIND_ROOT_PATH}/bin)set(CMAKE_C_COMPILER"${_bin}/x86_64-linux-musl-gcc")set(CMAKE_CXX_COMPILER"${_bin}/x86_64-linux-musl-g++")set(CMAKE_Fortran_COMPILER"${_bin}/x86_64-linux-musl-gfortran")set(_lib ${CMAKE_FIND_ROOT_PATH}/lib)set(CMAKE_SYSTEM_LIBRARY_PATH ${_lib})set(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_FIND_ROOT_PATH}/include)set(CMAKE_EXE_LINKER_FLAGS_INIT-Wl,-rpath-link=${_lib},-rpath=${_lib})set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAMNEVER)set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARYONLY)set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDEONLY)set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGEONLY)
Use this to cross-compile a CMake project with MUSL like:
When turning on an old Windows PC that hasn’t been used for a while, the Windows OS may be several versions out of date.
Windows may be so old that using Windows Update doesn’t automatically give an option to upgrade Windows, or may offer a non-latest Windows release.
Instead of discarding the PC, consider manually upgrading Windows to the latest release via the
Windows Upgrade Assistant.
Typically the Assistant will have a PC Health Check that it will ask to have run first.
The Health Check will tell among other things the current maximum capacity of the laptop battery.
The PC can still be used during the upgrade, which doesn’t take too long.
It’s important to use a currently supported version of Windows to be better protected from cybersecurity concerns and to avoid unsupported or non-working software configurations.
This entire article involves spoilers for the original 1949 book and 2024 miniseries adaptation of “Earth Abides” by George R. Stewart.
The 2024 MGM miniseries adaptation of George R. Stewart’s novel “Earth Abides” has several distinctions from the original study facilitated by 2020’s technology not available in the 1949 book.
This technology enables a more comfortable, modern-like existence while still facing many of the same challenges as the book.
A key plot element involves the 2 meter amateur radio band VHF radio frequency 147.225 MHz.
However, most of the radios used and antenna notebook designs are specifically for HF.
The antenna ultimately erected is consistent with a VHF antenna.
The radio powered on is an HF radio, with a possible old signal generator capable of generating a VHF signal being shown.
I suppose the lack of modern radios having direct key entry was a factor in the movie production.
In my opinion, showing an actual VHF radio being tuned in say 5 kHz steps would have been more realistic and not at all detracting from the story.
While millennials and younger generations are decreasingly familiar with tuning a radio dial, it is still not a foreign concept to them and easy to film and understand for world audiences.
Using 50% spot probability and ideal site locations not locally obstructed by terrain or buildings as indicated on the TV show, it is possible with a typical inexpensive VHF mobile transceiver to communicate with adequate FM SNR as shown on the show.
It is especially possible during periods of tropospheric ducting experienced in this region that communications would be possible between two base stations.
Path profile for the Earth Abides radio frequency communication.
Intel oneAPI / oneMKL
includes
Scalapack.
MKL Scalapack
library & include files
are found under the
MKLROOT environment variable.
Scalapack MKL is used in CMake via MKLConfig.cmake (found under $ENV{MKLROOT}/lib/cmake/MKLConfig.cmake) like:
set(ENABLE_BLACStrue)set(ENABLE_SCALAPACKtrue)set(MKL_INTERFACE"lp64")# "lp64" is the 32-bit interface, "ilp64" is the 64-bit interface
set(MKL_SYCL_MPIfalse)set(MKL_SYCL_LINKfalse)# for Intel oneAPI 2025.2, we don't need SYCL
find_package(MKLCONFIGREQUIRED)add_executable(mytestmain.f90)target_link_libraries(mytestPRIVATEMKL::MKL_SCALAPACK)
The
MKL_SYCL* variables
control whether SYCL is enabled for Intel oneAPI 2025.2 and later, which usually we don’t want.
The exact link flags and compile flags (that are automatically handled by MKLConfig.cmake) for a particular system are obtained from Intel
Link Line Advisor.
On Windows the most commonly used MPI libraries are MS-MPI and
Intel MPI.
MSYS2 is a popular choice to use GCC, Clang and many other developer tools from the Windows Command Prompt, PowerShell or the MSYS Terminal itself.
Continuous Integration for Windows MPI applications on GitHub Actions is accomplished as in fortran-mpi-examples
Set inter-step environment variables using GitHub Actions
environment files.
GNU Octave and other interactive terminal program use GNU
Readline
for command line editing.
If the Readline library is incompatible with GNU Octave, it may become unusable by not being able to type in GUI or non-GUI modes.
A workaround for non-GUI mode only is to disable interactive console input like:
octave --no-line-editing
For example Readline 8.3 has a
known bug
with a patch already released.
SSH-agent
remembers SSH Public Key authentication, which can be time-limited by the user.
This avoids the user having to type the password for each SSH connection, especially relevant to using Git over SSH.
Windows has SSH built-in from Microsoft including SSH-agent.
WSL also can use SSH-agent within each of the WSL images.
SSH-agent works well with
Git over SSH.
To use SSH-agent, add SSH keys like:
ssh-add ~/.ssh/mykey
This will persist the key in the SSH-agent until the SSH-agent is stopped, the user logs out,or the key is removed.