First impressions of Hugo

Hugo is great

Fast, instant refresh, markdown, templates, layouts and great configuration.

What more can we ask for?

I would say more clear guidelines on how to deal with Hugo themes.

Beginner’s difficulties with Hugo themes

The docs describe a sample quickstart site with a predefined theme. If we follow, we’re easily good to go with a new site. Yet, probably we would like to use a different theme.

So we go to https://themes.gohugo.io/ and find a lovely one. I’m using the Jane theme from xianmin.

Google Play Services 10002 Error

The following post may be helpful to resolve the 10002 RESULT_SIGN_IN_FAILED error.

If you have changed or pre-installed your development machine and have installed a fresh Android Studio version, you’ll have a new debug.keystore created by the Android Studio installation.

The apps that are started directly from the IDE during development will no longer be signed with keys registered with Google Play Services. This is no issue if the app doesn’t use Google Play Services like Sign-in, Leaderboards or Achievements, but if it does, these functionalities will no longer work and you may get the 10002 RESULT_SIGN_IN_FAILED error.

Enable Shift+Numpad Navigation for Ubuntu 18.04

Open terminal and execute the following command.

1
setxkbmap -option 'numpad:microsoft'

Other helpful shortcuts are Ctrl+Alt+Arrow when you want to navigate back or forth after peeking into function defintions and going back to previous functions. In Ubuntu 18.04 by default these shortcuts are taken by the system. To make them available for use in text editors, use the following commands.

1
2
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "[]"

Clean Ubuntu Boot Partition

First check the kernel version, so we won’t delete the kernel image in use:

1
uname -r

List installed kernels:

1
dpkg --list 'linux-image*' | grep ^ii

Delete unnecessary kernels (replace the VERSION with kernel that should be removed):

1
sudo apt-get remove linux-image-VERSION

After old kernels are removed, you can remove packages that are not used anymore:

1
sudo apt-get autoremove

Finally update grub kernel list:

1
sudo update-grub

Go composite variant type for JSON marshal

Implement a custom Variant type that can hold either string or int while satisfying the JSON Marshaler and Unmarshaler interfaces to support correct encoding/decoding of the values.

NPM/Yarn 404 Error when Building Docker Image

Sometimes the following error appears on Ubuntu Linux when building docker images for nodejs projects and the project includes privately scoped node packages.

1
An unexpected error occurred: Request failed "404 Not Found"

Initial workaround

The initial naive workaround we used was to manually change our DNS entry in /etc/resolv.conf to point to the local gateway.

/etc/resolv.conf

1
2
nameserver	10.0.0.1
search		npm.ourdomain.com

Then manually stop the systemd-resolved service.

1
sudo service systemd-resolved stop

How to build the Golang Bitcoin Node for Windows 10 (btcd)

The latest btcd release build is from 2015. There is a nice description how to build it for Linux/Mac, but for Windows it’s suggested to download the latest binaries, which are 626 commits behind master as of February 2018. Fortunately, with Golang we can easily build binaries for Windows, and we can follow the steps of the Linux build process. The only issue I faced was a problem in the Glide dependency manager and that’s how this little post was born.

Update Go version on Linux

1. Download the latest (or desired) Go version

1
wget https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz

2. Remove old installation

1
sudo rm -rf /usr/local/go

3. Extract archive into /usr/local/go

1
sudo tar -C /usr/local -xzf go-archive-filename.tar.gz

4. Test if everything is OK

1
go version

Clean up disk space taken by Docker

Show disk space used by docker images, containers and volumes.

1
2
3
4
5
6
7
$ docker system df

TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              5                   5                   1.722GB             784.5MB (45%)
Containers          5                   0                   78.12MB             78.12MB (100%)
Local Volumes       4                   4                   231.5MB             0B (0%)
Build Cache         0                   0                   0B                  0B

The docker prune command may be used with some docker objects like images, containers and volumes to free unused disk space.

Free space used by containers.

1
docker container prune

Free space used by volumes.

1
docker volume prune

In addition, you can use the docker system prune command to clean up multiple types of objects at once.

1
docker system prune -af