Saturday, May 4, 2019

Building Visual Studio Code on Jetson Nano

Here are the steps for building Visual Studio Code on Nvidia Jetson Nano.

Install nodejs

Visual Studio Code needs node version between 8 and 10. To install node 10 and yarn:

curl -sL | sudo -E bash -

sudo apt-get install -y nodejs

curl -sL | sudo apt-key add -

echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt-get update && sudo apt-get install yarn

Install libraries 

We also need some libraries:

sudo apt-get install libx11-dev libxkbfile-dev libsecret-1-dev 

Clone and build Visual Studio Code

In a working directory, clone the source code and build.

git clone

cd vscode

scripts/ install

Edit 2019-06-15: To enable extensions, edit the product.json file and add the following:

"extensionsGallery": {
  "serviceUrl": "",
  "cacheUrl": "",
  "itemUrl": ""

To run Visual Studio Code:


Friday, May 3, 2019

ROCm OpenCL with openSUSE Tumbleweed

With Tumbleweed running Linux kernel 5.0, it is easy to install ROCm OpenCL with upstream kernel.

- Go to and download the latest version of following packages:


- Install them without checking dependencies, assuming you already have libc etc packages installed, e.g.:

sudo rpm --nodeps -ivh hsakmt-roct-1.0.9-135-g34da614-Linux.rpm hsa-rocr-dev-1.1.9-64-g619177ee-Linux.rpm rocm-opencl-1.2.0-2019040803.x86_64.rpm rocm-opencl-devel-1.2.0-2019040803.x86_64.rpm rocminfo-1.0.0-Linux.rpm

- That's it! Optionally, install clinfo with zypper to check the available platform.  If you have been using Mesa OpenCL, you may want to uninstall it.

Saturday, April 20, 2019

OpenCL hangs with mesa-opencl and Radeon

OpenCL applications (e.g. clinfo and gimp etc) will hang when running under openSUSE Tumbleweed. This is with Mesa-libOpenCL 19.0.1 running on Radeon Sea Islands with amdgpu driver (radeon.cik_support=0 amdgpu.cik_support=1 amdgpu.dc=1).

Seems hitting this same bug.

EDIT: Fixed in Mesa 19.0.3.

Monday, March 25, 2019

NVIDIA Jetson Nano first impression

Just received my NVIDIA Jetson Nano developer kit today.  Here are my first impressions:

- the mounting holes on the board are tiny.  M3 pole won't fit.  The package does come with a paper (!) stand though

- the board is picky on the power supply.  Tried several USB chargers and the board will shutdown during boot.  Ended up using the barrel plug.  Needed to short jumper J48 to enable power supply via the barrel plug.

- during first boot, after configuring the keyboard etc, the machine froze when trying to login.  Needed to recycle the power.

- Need to manually install Tensorflow for python3 (this should install the CUDA accelerated Tensorflow)

- When trying to install scipy with pip3  (compiling from source), the heatsink was too hot to touch and the machine eventually locked up.  Needed to cycle the power to reboot.

- the cpuinfo:

- dmesg:

- lsusb (with keyboard and mouse attached):

- first successful login:

Sunday, February 24, 2019

Windows 7 update error 0x8000FFFF

Just found that my Windows 7 box failed to install the monthly quality rollup since Sep 2018.

There are many discussions on the error code 8000FFFF.  From modifying registry to restarting services.

But in my case, it turns out that the monthly rollups depend on another package KB3177467.  Once manually install KB3177467, the latest monthly rollup can be installed successfully.

Microsoft, please learn to set up dependencies.

Sunday, January 27, 2019

Playing with Google Apps Script

Long time no post!

Here is a little piece of Javascript code that I recently wrote on a Sunday evening.  To be exact, it is a Google Apps Script.

The script processes credit card purchase notifications in my Gmail inbox and logs the data on a Google Sheet.  From there, I could further analyze my spending.

First time using Google Apps Script.  Seems quite powerful and a handy tool for automation.

Sunday, October 7, 2018

A GUI desktop application to read export files from AndSafe

From time to time, there are people contacting me asking about how they can read the export files from AndSafe.

So here it is. A quick hack put together with PyQt5:

Monday, June 4, 2018

Measuring film camera shutter speed with Beaglebone Black

Here is a simple circuit utilizing the ADC input on Beaglebone Black to measure camera shutter speed.

A photoresistor is used to detect the light when shutter open, and hence changing the values read by ADC pin P9_40.  The push button is used to trigger the Python script to start reading the ADC input.

Testing on breadboard and the final build on through-hole board:

Note that this is by no mean an accurate measure of absolute shutter speed.  The response time (rise/fall) of photoresistor will affect the result (see the graph below).  Nevertheless, it is useful to compare different shutter speeds.

Source code is available on Github.

Quick start:

git clone
cd bbb-adc-measure
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
python -t 10 > result.csv

Plot the output using gnuplot:

set mxtics 10
set grid
plot 'result.csv' with lines

Here is an example output of measuring 1/15 and 1/8 shutter speeds of my Pentax MX.

Saturday, May 12, 2018

openSUSE Tumbleweed boot problem

After recent update (20180502) of openSUSE Tumbleweed, my machine failed to boot.  A quick check in the dracut emergency shell seems to indicate that somehow the root volume is mounted as /kdump/mnt0 and so cannot be mounted as root again.

Here is a quick fix.

Boot the system with LiveCD or any emergency tool.  Mount the Tumbleweed system (here I mounted it under /mnt/temp).  Go to the boot directory and find the initrd file.  We are going to extract and modify the fstab inside.

cd /mnt/temp/boot
mkdir initrd-mod
cd initrd-mod
/usr/lib/dracut/skipcpio ../initrd > initrd.xz
xz -d initrd.xz
cpio -idv < initrd
cd etc
# edit the fstab file, comment out the mount of /kdump/mnt0
vi fstab

Now, repackage the initrd file

cd /mnt/temp/boot/initrd-mod
find . 2>/dev/null | cpio --quiet -c -o | xz -9 --format=lzma >"../initrd-mod.img"
chmod go-r ../initrd-mod.img

The original boot/initrd should be a symbolic link to the current kernel version.  Remove it and point it to the modified initrd

cd /mnt/temp/boot
rm initrd
ln -s initrd-mod.img initrd
# Depends on your setup, you probably also need to
# backup and link specific kernel version of initrd. e.g.
# mv initrd-4.16.6-1-default initrd-4.16.6-1-default.bak
# ln -s initrd-mod.img initrd-4.16.6-1-default

Sync, umount, and reboot.  There will be error messages saying /kdump/mnt0 can't be mounted but at least the system can boot up.

Tuesday, April 24, 2018

SSL connections with RTL8710

If you tried to compile any SSL example (e.g. WiFiSSLClient) that comes with Ameba Arduino, you will probably get an error saying "RTL8710 do not support SSL".

Some people say it is because RTL8710 is not powerful enough (!?) to handle SSL.  But in fact, you edit the gcc linker blacklist file to get around it.  On Linux, the file is probably at


The original file contains:

rom_ssl_ram_map RTL8710 do not support SSL
analogReadResolution RTL8710 do not support ADC
analogRead RTL8710 do not support ADC

You can see that the RAM table referenced by SSL ROM is being blacklisted.  Make a backup of the file and delete the first line.

Tried to compile WiFiSSLClient and it work probably on my RTL8710.