I often spend lots of time on setting up the same software over and over again for different purposes. In order to save time, I decide to write down some useful procedures or hints here. Hope that they could be helpful to myself and others who visit here.

Comparison of X11 servers on Windows

posted May 11, 2019, 6:52 AM by Teng-Yok Lee

NOTE: The column Easy so use is based on the amount of configurations needed after installation. More * means more effort. So far it seems that VcXsrv is the best one in terms of all main features I need.

Software Installation Price/ license Clipboard Resizing of windows? OpenGL Easy to use Notes
VcXsrv A single installer. FREE GPL3 Yes Yes Yes w/o native opengl. **
  • Might be blocked by old Micro Trend.
  • Should disable native opengl.
MobaXTerm A single installer. FREE Failed? Yes Yes w/o X extensions. ***
  • For heavy PowerPoint users, it would be better to remove the hotkey Ctrl+M. Ctrl+M is also used to insert new slides in PowerPoint, but by default MobaXTerm grab this hotkey.
  • Better to disable X extensions for OpenGL.
  • See more limits of the free version HERE

$69/yr per user ? ? ? ?
Xming A single installer. FREE Yes No Yes *
  • Or try older versions (REF)?

$20/yr ? ? ? ?
cygwin/X Multiple cygwin packages



Yes Yes Yes with limited & incorrect color depth *****
  • See installation guide HERE.
  • More complicated to configure (e.g. for putty, need to manually specify the path t .Xauthority for each configuration).
  • Might be blocked by old Micro Trend.
  • If the X server restarts, current SSH session will fail and need to re-connect.

OpenGL with X11 servers on Windows

posted May 11, 2019, 6:47 AM by Teng-Yok Lee   [ updated May 11, 2019, 6:53 AM ]

I typically use Windows with ssh -X to access Linux machines so I can avoid dual boot. If I need to run remote applications with X windows, I run VcXsrv (REF) on windows as the X11 server. This typically works except programs that needs OpenGL. If software-based rendering is affordable, my workaround is as follows:

  • On the local windows: Run VcXsrc without native OpenGL supports.
  • ssh to the the remote Linux:
    • Make sure that libgl1-mesa-dev is installed.
      • NOTE: If the nvidia driver is install via .run, it might override libgl1-mesa-dev.
        • To verify, run the following to see whether it is using libGL under mesa or not:
          $ ldd $(which glxinfo) | grep libGL
        • If not, the symlink of /usr/lib/x86_64-linux-gnu/mesa might be broken. In such a case, re-installation of libgl1-mesa-devis needed.
    • Setup env. var. to use mesa's
      $ export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/mesa:$LD_LIBRARY_PATH
    • To confirm, run glxinfo again to see whether direct rendering is Yes:
      $ glxinfo | grep -i direct

New Google Sites

posted Apr 18, 2019, 9:33 PM by Teng-Yok Lee

I did a quick test with the new Google Sites, but I decide to stay with the classic one because:

1. No complete history to rollback. This is the biggest reason.
2. Lose the banner in the left side (I used this to show weather of my current city).
3. The format of my publication list is destroyed.
4. Unsure whether I can post announcement, like what I am doing now.

A related question is: How to re-do the conversion? I created a draft but I disliked it.

The solution is in the page Manage Site/Convert to new site. After entering the stage Review and Publish, open the advanced pane, and choose to disconnect from the current page. Then it will restart from stage 1.

Save the subplot of matplotlib

posted Apr 18, 2019, 7:46 PM by Teng-Yok Lee   [ updated Apr 18, 2019, 7:47 PM ]


The solution is calling ax.get_tightbox() to get the entire region and converting per the figure's DPI. Based on the answer above, I wrote a short function to combine multiple axes:

def SaveAxes(fig, axes, fig_filepath):
    extents = [];
    for ax in axes:
    extent = Bbox.union(extents);
    plt.savefig(fig_filepath, bbox_inches = extent);

How to check a python module path before importing?

posted Jun 24, 2018, 7:01 PM by Teng-Yok Lee


Use imp. For instance,
import cv2 imp.find_module("cv2")

Enable OpenGL direct rendering over ssh after installing nVidia driver

posted Jun 23, 2018, 5:30 PM by Teng-Yok Lee   [ updated Jun 23, 2018, 8:29 PM ]

In my experience, nVidia driver will overwrite Mesa's in /usr/lib/x86_64-linux-gnu/mesa/. However, mesa's support direct rendering over ssh, while nVidia's can't.

A quick fix is copying the of /usr/lib/x86_64-linux-gnu/mesa/ from other host. Then once ssh to the host, set LD_LIBRARY_PATH as follows:

$ export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/mesa:${LD_LIBRARY_PATH}

Then the current session will use mesa's

More detailed explanation can be seen here:

FW: List the revision of a conda environment

posted Feb 12, 2018, 8:05 PM by Teng-Yok Lee

$ conda list --revisions


Git tips

posted Feb 4, 2018, 6:36 AM by Teng-Yok Lee   [ updated Feb 4, 2018, 6:37 AM ]

This is the collection for tips to fix common problems I have.

Ignore the change of file modes

$ git config core.fileMode false

Commonly used dpkg & apt-get options

posted Jan 24, 2018, 6:07 PM by Teng-Yok Lee   [ updated May 29, 2019, 8:51 AM ]

List the versions of a package:
$ apt -a list <package>

Given a file path, query the belonging package (REF):
$ dpkg -S <filepath>

Query files in a package:
$ dpkg -L <package>

List install packages (REF):
$ apt list --installed

FW: How to debug a release build

posted Jul 7, 2017, 6:38 AM by Teng-Yok Lee


With CMake, the same effect can be achieved by modifying the following CMake variables:


1-10 of 113