grep is a ubiquitous command-line tool for searching plain-text data sets for lines that match a regular expression.
Ripgrep
is a modern alternative to grep that is designed to be faster and more efficient at recursive text file searches common to code developers.
Ripgrep is used internally by
VS Code
for its search functionality.
Install ripgrep with:
Windows: winget install BurntSushi.ripgrep.GNU
macOS: brew install ripgrep
Linux: apt install ripgrep or similar
The rg command is used to invoke ripgrep, and it supports a wide range of options for customizing search behavior.
Examples:
Search for the term “TODO” in all .cpp files in the current directory and its subdirectories:
rg "TODO" --glob "*.cpp"
Case-insensitive search:
rg -i todo
Show line numbers and filename only:
rg -n TODO
Search only certain file types:
rg TODO -g "*.cpp" -g "*.hpp"
Include hidden and ignored files (like .gitignore):
Valgrind
is a dynamic analysis tool that can detect memory leaks and other problems in programs including C, C++, and Fortran.
Valgrind is available on Linux and BSD for x86 and ARM CPU architectures.
For macOS on Intel x86 CPUs, Valgrind is available in
Homebrew.
For macOS on Apple Silicon ARM64 CPU, Valgrind can be used from an aarch64
Linux virtual machine
in native mode for best performance.
There is a development
fork
of Valgrind for Apple Silicon, but it may not yet ready for production use.
Weather radio broadcast alerts
USA NOAA NWR
are receivable on dedicated 162 MHz weather (WX) radio receivers.
Many two-way communications radios such as CB radio, GMRS, and MURS can also have 162 MHz WX radio receiver capability.
The advantage of these alerts is that mobile phone service is not required, just a small portable radio and a clear path to the WX radio transmitter, so audio alerts are heard only when a selected hazard type is determined to be in the area.
162 MHz WX radio is a one-way broadcast radio service carrying weather information and emergency alerts across much of the USA and
Mexico.
Unfortunately, the Canada WX radio service was
shutdown in March 2026.
Currently, Canadian weather broadcasts use the Coast Guard
Continuous Marine Broadcast
(CMB) to relay weather information.
When determining which WX channel to receive on, it can be confusing because there is no standard WX channel number to 162 MHz frequency mapping.
Use the NOAA
USA search
to find nearby WX radio transmitter frequencies.
WX radio channel number to frequency mapping: a common practice is to start with the lowest frequency and go up across the 7 WX radio frequencies.
This is perhaps the most common channel number to frequency mapping.
WX Channel
Frequency (MHz)
1
162.400
2
162.425
3
162.450
4
162.475
5
162.500
6
162.525
7
162.550
Non-sequential channel order is used by some CB radios such as Radioddity / Anytone radios made by Qixiang.
WX Channel
Frequency (MHz)
1
162.550
2
162.400
3
162.475
4
162.425
5
162.450
6
162.500
7
162.525
Comparing reception performance on a known frequency vs. a handheld radio can give a quick indication that an antenna system is working OK, even if, as with 27 MHz CB radio, the designed antenna frequency is far from the 162 MHz weather radio frequency.
Comparing WX radio reception on a CB radio with base or mobile antenna versus a handheld radio on the same 162 MHz WX radio frequency indicates that the CB radio antenna coax is perhaps not severely damaged or lossy, and the radio is working OK.
Modern receivers may allow arbitrary VFO tuning.
This is important in Canada, where marine weather broadcasts are not always on WX radio frequencies.
Some WX radios are
10 channel
and may include frequencies like 161.650 MHz, 161.775 MHz and 163.275 Mhz or such, which may help in Canada, but other VHF frequencies are also used for weather broadcasts, so VFO tuning is important to receive all broadcasts.
On macOS, when started from the Applications icon, Matlab does NOT source shell configuration files.
Any environment variables set in these files such as those added by package managers like Homebrew or Conda will not be available in the Matlab environment.
On macOS, only if Matlab is started from the Terminal like /Applications/MatlabR20*.app/bin/matlab will Matlab source the shell configuration file, leading to the expected environment variables as default in an interactive login shell also available in Matlab.
Instead of depending on how the user launched Matlab, a more uniform approach is to have users set environment variables in the Matlab startup.m script, which will be sourced regardless of how Matlab is launched.
Set desired environment variables in the Matlab startup.m script like:
In larger projects, one might not remember if they or a colleague has opened or commented on a prior Issue topic.
To search the issues by a username, use this search syntax in the GitHub Issues search bar:
Issue created by a user:
is:issue author:username
Issue commented on by a user:
is:issue commenter:username
Note that the search term is not user:.
This maps into the GitHub API as a query parameter:
?q=is:issue+author:username
For example at the Bootstrap project for one’s self “@me”:
C has long had the __FILE__ macro, which expands to a string literal containing the name or path to the current source file.
C++ provides a much more powerful mechanism to programmatically determine the source file location via
source_location
in the <source_location> header introduced in C++20.
This capability is particularly powerful for logging and debugging, as shown in the example linked above that a function’s caller can be located by source file and line number without the caller needing to explicitly pass that information.
Sometimes when opening the Matlab Desktop, the Command Window where one types commands might not be visible.
This can be restored from the “Home” tab on the top ribbon, click the “Layout” button on the Environment section,
and click “Two Column (default)”.
Notice that one can also “Save Layout” to store the current layout for future use and easily select between layout suitable for different tasks.
At the the writing, UTM didn’t have a known way to work with RISC-V, so we use QEMU directly on macOS (or Linux).
Obtain QEMU - on macOS via brew install qemu or on Linux via the package manager (e.g. apt install qemu).
We need a uboot.elf.
One way to get it is from a Linux machine or VM if on macOS by apt install u-boot-qemu and then copy the file from /usr/lib/u-boot/qemu/riscv64/uboot.elf to the machine where you want to run QEMU.
It’s important to increase the disk size, otherwise the image will run of space quickly when installing compilers etc.
Add say 10 GB of virtual HD space by:
qemu-img resize -f raw ubuntu-*-preinstalled-server-riscv64.img +10G
Then run QEMU like (perhaps make a little script):
When using Git
pre-commit hooks
with the wide range of files typical of scientific computing, it may occur that the hooks modify files that should be excluded, such as FITS files that have a text header and a binary data part.
Exclude such files by using case-insensitive regex patterns in the .pre-commit-config.yaml file by top level
exclude key,
for example to case-insensitively exclude files with the .fit or .fits extension, use:
exclude:(?i)\.fits?$
Because it’s considered an
anti-pattern
to have a global pre-commit config, such exclusions and all other pre-commit configuration on a per-repo basis.
To compile legacy Fortran code, certain compiler flags can be used to enable non-standard Fortran syntax that was common before the Fortran 95 standard became widely adopted.
It’s hard to pin an exact year for when developers transitioned to more standard Fortran code, but the mid-2000s is a reasonable estimate for when Fortran codebases started to modernize in significant numbers.
Gfortran took over from g77 as the default Fortran compiler circa 2005 and was the first widely used free Fortran compiler capable of the Fortran 95 standard.
Here are legacy-enabling flags for currently maintained Fortran compilers.
In addition to the flags below, it may be necessary to provide default real and / or integer precision flags to compile old code that relies on the default precision being different than the modern default of 4 bytes for real and 4 bytes for integer.