Grammarly in Visual Studio Code

Currently, Grammarly does not have an official API. Rahul Kadyan reverse-engineered a Grammarly API and made a Visual Studio Code Grammarly Plugin.

For those with a Grammarly subscription this plugin may be useful for:

  • documenting code
  • Markdown Readmes
  • Markdown-based blogs

Matlab / Python 3D meshgrid scatter plot

Simulations with spatial grids in 3D can be visualized via scatter plots. The grid may have irregular spacing such that each of the x, y, z dimensions is itself a 3-dimensional array. This can be visualized in Matlab or Python by reshaping the 3D arrays to a vector in the plotting command.


Scatter plots are one way to visualize 3D data in Matlab.

scatter3(x(:), y(:), z(:))


Python Matplotlib has several 3D visualization methods. Matplotlib scatter() also requires 1D vectors, which can be obtained at O(0) cost by the Numpy ndarray ravel method.

from matplotlib.pyplot import figure

ax = figure().gca()
ax.scatter(x.ravel(), y.ravel(), z.ravel())

Extracting a page from PDF

We use the free Poppler tools instead of using Acrobat, despite a work/school license. Extracting one or more pages from a PDF file can be done with paid Adobe Acrobat. The free Adobe Reader or FoxIt Reader cannot extract pages. Adobe Acrobat is a large and cumbersome program that installs startup daemons that are not trivially disabled.


To extract pages 2 to 3 from in.pdf using Poppler:

pdfseparate -f 2 -l 3 in.pdf out.pdf

Note: you must leave a space after -f and -l as shown.


If you can’t get Poppler, GhostScript can also extract pages from PDF, but it’s a more complicated command:

gs -sDEVICE=pdfwrite -dFirstPage=2 -dLastPage=3 -dNOPAUSE -dSAFER -dBATCH -sOutputFile=out.pdf in.pdf

Install Poppler

extract raw full-quality images from PDF

Windows battery time remaining disabled in 20H2

Battery time remaining estimates for computing devices can vary widely in accuracy. The estimates are based on assumptions about future behavior based on prior usage trends, from a mix of current and prior charge usage. Windows updates can disable battery time remaining, and some devices (including Microsoft Surface) may come from the factory with battery time estimates disabled. Even though the battery time remaining estimates on Windows have limited accuracy, I prefer to have the estimate shown.

Registry edit

The usual precautions on modifying the Windows Registry apply–do a Windows System Recovery milestone first. These keys are under:


These settings “worked for me” across multiple models of Microsoft Surface devices and other laptops. Reboot after making these changes.

Set to 0 if present

If these registry keys exist, set their value to 0. If they don’t exist, that’s fine too.

  • EnergyEstimationDisabled
  • UserBatteryDischargeEstimator

Create / set to 1

Create this DWORD32 value (if not existing) and set to 1




GitHub Python dependency check practical details

GitHub CodeQL semantically analyzes Python code for security issues. Also, CVE Lists are checked vs. your GitHub repo’s dependency graph. CodeQL can install the Python package for more fidelity.

This approach finally fixes the concerns we had with the previous implementation that simply did CVE scans versus dependency graphs. The prior method of extracting dependencies did not work for modern Python packages. The new CodeQL method is much more robust and useful.

Logitech on Linux with Solaar

The Solaar program manages connections with Logitech Unifying receiver on Linux, including pairing/unpairing. This means wireless keyboards and mice, including wireless trackballs work well on Linux. Logitech wireless firmware updates are provided seamlessly in Linux. The Unifying receiver “just works” on Linux upon plugging in, with trackballs being recognized as an HID device.

Solaar is strictly a GUI program, so you will need a display or VNC graphical desktop to perform operations like

  • pairing/unpairing
  • configuring buttons
  • monitoring battery level
  • checking firmware version of Unifying receiver and connected devices

Logitech Unifying receivers can be paired with multiple devices. This allows one to carry a laptop from home to office without dragging the wireless keyboard or mouse along.

Python cumtrapz vs. Matlab

The 0-based indexing of Python and Numpy versus the 1-based indexing of Matlab is perhaps the most obvious difference when working between the languages. Other, more subtle defaults come into play and may not be immediately caught within functions except by manual checks.

In atmospheric science among other fields, cumulative integration implemented as cumulative trapezoidal numerical integration is a common function named “cumtrapz”. Distinctive behavior between Matlab cumtrapz and SciPy cumtrapz might not be immediately caught inside a function, although it’s obvious when manually checking. Specifically, SciPy cumtrapz needs the initial=0 argument to match Matlab. Let’s show this by example:


In both languages, suppose

x = [-2.5, 5, 10]

Matlab (or GNU Octave) outputs:

y = cumtrapz(x)

[0, 1.25, 8.75]

Here comes the wrinkle–SciPy cumtrapz output one element less than the input by default:


[1.25, 8.75]

To match Matlab output from SciPy, add the initial=0 argument:

scipy.integrate.cumtrapz(x, initial=0)

[0, 1.25, 8.75]

HDF5 CMake build

We strongly recommend using CMake to build HDF5 rather than autotools. For those building HDF5 on Windows, CMake is required. There is a slight quirk with current (HDF5 1.10.7, 1.12.0) HDF5 CMake scripts in that the “new” cmake -B build flags don’t work properly–the CMake build will fail partway through with weird platform-dependent errors. HDF Group is working to improve CMake and has merged pull requests from us with CMake improvements for HDF5.

These CMake options build HDF5 for Fortran as fast as possible by omitting optional items. If these seems too complicated, try our one-step Python build HDF5 script.

mkdir build
cd build


This creates static and dynamic HDF5 libraries under the user install prefix–we don’t show the library suffixes for simplicity. Note: the *stub files may not be present.


The Fortran .mod files that need to be included are under



Tell CMake to use this HDF5 from your project by:

cmake -B build -DHDF5_ROOT=~/.local/hdf5

cmake --build build