Start GoLand From Terminal

With Visual Studio Code and other text editors, we can directly open the editor from the terminal shell with the current folder opened as a project.

For example, I can change to a folder and start it like this:

1
2
$ cd myfolder
$ code .

To make GoLand support the same workflow, we can do the following steps.

Hugo Gitlab CI for Gitlab Pages

We’ll describe how to integrate a Hugo project repo with Gitlab CI and deploy the built site on Gitlab Pages automatically. If you host your static site on another platform/server, the actions you’ll need to do might be slightly different. In all cases, the major thing is to specify how the public folder of the project will be uploaded to the frontend server. These configurations are declarative and abide to the rules of the .gitlab-ci.yml specification.

tip

Gitlab Pages is a free service to host one static web site per Gitlab project. The site will have a default domain consisting of our Gitlab username and project name: https://myusername.gitlab.io/myproject

Custom domains are supported.

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