How to install GVM and latest Go (One-Liner)?

The gvm a.k.a. Go Version Manager is an excellent tool to maintain multiple version of Go in your system.

Instruction

If you are using zsh

Assuming that latest go at the moment is 1.14.4 and you are using zsh

zsh < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) \
      && echo "source /home/$USERNAME/.gvm/scripts/gvm" >> ~/.zshrc && source ~/.zshrc \
      && gvm install go1.4 -B && gvm use go1.4 --default \
      && gvm install go1.14.4 && gvm use go 1.14.4 --default

If you are using bash

bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) \
      && echo "source /home/$USERNAME/.gvm/scripts/gvm" >> ~/.bashrc && source ~/.bashrc \
      && gvm install go1.4 -B && gvm use go1.4 --default \
      && gvm install go1.14.4 && gvm use go 1.14.4 --default

The above one liner works with Ubuntu as well as Debian.

Explanation

First line (below) will install gvm.

zsh < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)

Second line will ensure loading of gvm in your shell and it will load shell configuration again for this instance

echo "source /home/$USERNAME/.gvm/scripts/gvm" >> ~/.bashrc && source ~/.bashrc

Third line will install the go version without source (-B is for Binary) which will be loaded then as default

gvm install go1.4 -B && gvm use go1.4 --default

Fourth line will install the go specified version with source and compile it using go1.4

gvm install go1.14.4 && gvm use go 1.14.4 --default

Tell your network!

How to stress test your CPU?

At the moment, I am using Ubuntu. It has an amazing package which is stress to give some stress testing to your new machine. Like any other stress testing, idea here is to simply make sure that your machine is running at its full capacity and you are going to observe the temperature of CPU as well as the fan’s rpm.

Install stress

sudo apt-get install stress -y

Command

stress --cpu $(grep -c ^processor /proc/cpuinfo) --timeout 60

The grep -c ^processor /proc/cpuinfo will just tell you how many cpu cores are there. This will spawn that number of cpus.

Tell your network!

Sanity in Insanity

Upon showing an App we developed, my good friend from service based company said that he could make that app in a week. I said – of course you can. He was a bit sceptical with my comment and tried to validate his point. He shown me some of his codes and then talk about how he created a bunch of libraries which he just imports to the project. The language he is talking about is PHP. This is a sane way to do things right? Of course!

It is easy to build an app. He said he can create that app in a week, I say, I can make that app in 5 days. Some, who can type even faster would make that app in few hours. But what about benchmarking?

A few weeks earlier, I had a LinkedIn comment giving the more efficient way to do the code. The guy commented that under the hood everything is probably the same. Then I shared the link: https://jsperf.com/from-vs-spread-map/1 The codes were 1% faster. This is insane – just that a bit right? No!

Insanity in Attitude!

As I said, it is just a matter of typing speed who will finish the app first! But is it really a race? I don’t think so! I am sure most of you would agree with me.

A programmer who is doing benchmark his codes, profiling the code even the bit which has absolutely shown no alerts will create a nearly perfect app. Every day he will be learning which is more efficient. This will look insane but after say over 300 benchmarking and recognizing over 1000 places of these small bits, he will be writing the efficient codes right? Then it will come down to typing speed! But the result will be more efficient codes. I strongly recommend you hire these insane people, that will be the sanest thing to do!

Tell your network!