Wednesday, December 12, 2018

Pushing Git Repositories to Multiple Remotes

According to this post, we configure as follows,

git remote add all URL_1
git remote set-url --add --push all URL_1
git remote set-url --add --push all URL_2
git remote set-url --add --push all URL_N

To push to the N remotes, do,

git push all

Saturday, December 8, 2018

Windows Device Guard and Credential Guard

I enabled Windows Device Guard and Credential Guard at a windows 10 host. The result was that VMWare Player/Workstation and VirtualBox ceased to work. For instance, VMWare Player complains,

VMware Payer and Device/Credential Guard are not compatible. 
VMware Player can be run after disabling Device/Credential Guard.

The error message also provided a URL to a VMWare Knowledge Base article. Following the article, the best solution is actually to use the Windows Defender Device Guard and Windows Defender Credential Guard hardware readiness tool to disable the Device and Credential Guard. The tool is distributed as a zip archive. Having extracted it, we simply issue the following command in the PowerShell session,

DG_Readiness_Tool_v3.6.ps1 -Disable -AutoReboot

You may revise the above command to match the version of the tool downloaded.

Monday, December 3, 2018

Example of Using tcpdump for Capturing and Showing Frame Content

This is just a quick note on an example of using tcpdump.

To capture packets whose TCP or UDP port number is 112233 via interface eth0, and save the captured packets to file packet.cap, we run,

sudo tcpdump -i eth0 -w packet.cap port 112233

To examine the content of the captured the frames including full data-link layer header and payload in the packet.cap file, we run,

sudo tcpdump -nn -xx -XX -r packet.cap

Wednesday, November 28, 2018

CTRL-C Stopped Working on Linux Terminal

I remotely logged in a CentOS 7.5 box via PuTTY. However, somehow, CTRL-C stopped working. It turns out that CTRL-C was being trapped, which we could examine using the trap command, e.g.,

trap -- '' SIGINT
trap -- '' SIGQUIT
trap -- '' SIGTSTP
trap -- '' SIGTTIN
trap -- '' SIGTTOU

To remove CTRL-C, i.e., SIGINT from this list, we can issue a command,

trap - SIGINT

which can be placed in the shell's profile, e.g., for bash, in $HOME/.bash_profile.

Installing pdftk in Ubuntu 18.04 Bionic

The pdftk package is reported missing from Ubuntu 18.04 Bionic. To me, the easiest way to install it out of a few suggested methods is as follows,

sudo snap install pdftk

Read more about snap here.

Sunday, November 25, 2018

Compile and Install HandBrakeCLI on Centos 7

I followed the following instructions,
The compilation and installation were successful. Although it continues and seems to run fine, HandBrakeCLI complains,

Cannot load
Cannot load
Cannot load
Cannot load

Wednesday, November 14, 2018

DTV Reception Maps

FCC has a Web site that shows receptions of Digital Television signal receptions giving an address. The address is,

Wednesday, October 31, 2018

FreeNas Plugins: "No Entry Has Been Found"?

A FreeNas system (FreeNAS-11.1-U6) reports "No entry has been found" on its Web interface. However, running pbi_browser seems to yield the list of plugins, for instance,

$ sudo /usr/local/sbin/pbi_browser  --viewall
Using RepoID: 001
Listing all available PBIs
Application: CouchPotato
Version: autoupdate.9_5
Category: Network - P2P
Created: 20160212 060001
RootInstall: NO
Arch: amd64
Author: RuudBurger
License: GPLv3
Type: Graphical
Keywords: net,p2p,share,nzb
Icon: /var/db/pbi/repo-icons/a5a51ab301916fcacfa9029fc96adff2-CouchPotato.png
Description: An automatic NZB and torrent downloader

To install this PBI:
# pbi_add --rArch amd64 --repo 001 -r CouchPotato

Application: Emby
The solution that worked for me is simply to reboot the system.

Friday, August 10, 2018

Quering Computer's Serial Number

A computer's serial number may be printed on the back of the computer. However, it is inconvenient to locate it while the computer is on. We can query a computer's serial number using a command while the computer is on.

On Windows:

wmic bios get serialnumber

On Linux:

sudo lshw

Thursday, May 3, 2018

Breaking Long URL in LaTeX Documents

Sometimes we wish to break a long URL in a LaTeX document.  I am among many people who have struggled with this. The following summarizes the answers I found online,

  1. Pass hypens to the url package that is referenced in the hyperref package, e.g.,

  2. However, the above would not work when the long URL has hyphens to avoid confusion by design. To break a long URL that has hyphens, we can use


  3. In the above, LaTeX works hard and attempts to break the long URL at some location. If the location is not to our liking, we add the \sloppy command right before the reference to an URL, e.g.,

The above is the summaries of the following two discussions,
  1. How to break long url in an item
  2. Forcing linebreaks in \url
Great discussions, folks. Thanks.

Wednesday, March 14, 2018

PYMC3 Reports "WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions"

When I run PYMC3 on Ubuntu 16.04 LTS, I encounter an error,

WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

This went after I installed,

sudo apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran  

I also notice that the problem persists when I only install the mkl and mkl-service as suggested in the theano documentation and the discussion here

Tuesday, March 6, 2018

Old Bug in open-vm-tools and Git Commit Problem.

There is a known bug in open-vm-tools that can interference with a number of applications when we operate on a vmhgfs-fuse file system. This bug is documented as issue #90, and there are a few other discussion about this, in particular, a discussion on how to install recent release of open-vm-tools on Ubuntu 16.04 LTS since Ubuntu 16.04 LTS at this moment still ships open-vm-tools version 10.0.7 that carries this bug.

You may check your open-vm-tools version with one of many methods, such as,

vmware-toolbox-cmd -v


apt-show-versions open-vm-tools

If the output indicates that you have a version of earlier than 10.1.0, your version of open-vm-tools may have this bug. It causes serious problems in a few rather frequently used applications. In my case, when I use do a git commit, I would observe the following,

$ git commit -m "done something trivial"
error: bad index file sha1 signature
fatal: index file corrupt

After 5 seconds, when I try it again, the git commit is successful. As discussed in issue #90, this is the result that the tools cache file attributes and entries and causes a cache inconsistency. The 5-second delay is the waiting time before the cached items get updated.

Some also observed that this bug causes the npm install to fail.

Perhaps, the more important issue is how we may address this issue before the Linux distributors have a new version of the tools for us to upgrade to. Suggested in the discussions cited is to use a Ubuntu test PPA repository since it does not appear to be problem-free to build the tools from the source. The steps to install from the test PPA are as follows,

sudo add-apt-repository ppa:ci-train-ppa-service/3152
sudo apt-get update
sudo apt-get upgrade open-vm-tools open-vm-tools-desktop open-vm-tools-dkms

In my case, these steps lead to the successful installation of the open-vm-tools version (build-7253323), and it seems to work fine although some seem to observe some issues, such as, a race condition.

Sunday, February 4, 2018

Add/Edit Windows Environment Variable for Non-Administrator User

There are two ways to do this on Windows 10.
  1.  Click the Amplifying glass from the Task bar, type "environment", and select "Edit environment variable for your account", which opens the GUI to edit the Windows environment without prompting for a administrator's password.
  2. Press the "Window" and "R"  keys at the same time to open the "Run" window, and type the following,
    rundll32 sysdm.cpl,EditEnvironmentVariables

Friday, January 19, 2018

Determine Character Encoding on PostgreSQL Database System

PostgreSQL database system has a versatile character set support as described in the documentation. Since an application that uses a PostgreSQL database may run on different systems, it is a good practice to know what character set we are dealing with. We can query a database's encoding scheme in a number of methods.
  1. Via the SHOW SERVER_ENCODING command in psql, e.g., assuming the database is foodb,
  2. Use a SQL query on pg_database, e.g., assuming the database is foodb,
    foodb=>  SELECT pg_encoding_to_char(encoding) 
                FROM pg_database WHERE datname = 'foodb';
  3. Use a SQL query the information_schema, e.g., assuming the database is foodb,
    foodb=>  SELECT character_set_name 
                FROM information_schema.character_sets 
                WHERE default_collate_catalog='foodb'

In the above, the 3rd method is portable across most relational database systems since information_schema is a standard.

Tuesday, January 16, 2018

Command psql of PostgreSQL Complains about Encoding

I have a PostgreSQL database instance configured to use UTF-8. When I connects to it using psql on Windows, it complains with the following,

foopgdb => select * from bar;
ERROR:  character with byte sequence 0xe2 0x86 0x92 in encoding "UTF8" has no 
equivalent in encoding "WIN1252"
foopgdb =>

Method 1

It turns out that we can inform psql the encoding and select proper encoding table when we run psql as follows in a Windows Command Prompt window,

chcp 65001

The explanation about PGCLIENTENCODING is in the PostgreSQL documentation while that of chcp at Microsoft Technet. The reference to the code page 65001 is at this MSDN page.

However, the above method may result in the Not enough memory error on some version of Windows, such as, Windows 7. See this discussion for more.

Method 2

We can also set the encoding in psql as follows,

foopgdb => \encoding UTF8
foopgdb => select * from bar;
foopgdb =>

Tuesday, January 9, 2018

Higher Education: Articles on Ideological Diversity on Campuses

I happened to come cross a few articles on the topic of ideological diversity on college and university campuses. This topic interests me.

Nicholas Kristof writes at the New York Times,
"Universities are the bedrock of progressive values, but the one kind of diversity that universities disregard is ideological and religious. We’re fine with people who don’t look like us, as long as they think like us."
In parallel, Fredrik deBoer argues at the Los Angles Times,
"But academics are at fault, too, because we’ve pushed mainstream conservatism out of our institutions. Sociologists Neil Gross and Solon Simmons have found that about half of professors identify as liberal, versus only 14% who identify as Republican. (At the time of their study, in 2006, only a fifth of American adults described themselves as liberal.)
In my network of professional academics, almost no one recognizes that our lopsided liberalism presents a threat to academia itself."
and suggests that,

"Our public universities are under massive pressure and at immense risk, and those who should be defenders of public universities still don’t understand that they’ve created the conditions for their destruction."