Google is feeling lucky

2018-05-10 06:44:00 +0000

Let’s assume for a moment that google search is so good that if you have a specific enough question, then it can show 1 or “very few” results. Then “I’m feeling lucky” should be default option on search. However if it is in the interest of the search engine to show you as many results as possible, so that there are some chances you could look at something else which could lead to you spending more time there and also possibly give some business to the company. Then it stands to reason that you are asked to be as vague as possible, even if you could be specific and show you many results even if it’s possible to show few. The default page should be called “Google is feeling lucky” that you might click something else and spend more time in the browser, on other websites etc.

Now it might not be designed with the motive I just descibed, but with the incentives of free search in return for attention, it could just be that the system evolved in this way.

VS Code Extension: timed-themes

2018-04-05 12:44:00 +0000

VS Code is now my primary IDE, it’s the IDE I use the most and really like. At home I use a laptop hooked to a large monitor. This setup is in a room with lots of windows and skylights. So during the day, the room lights up a lot and there are a lot of reflections on the screen. So I use a dark theme with lots of contrast during the day. But at night I use a lighter theme with less contrast. I used to switch manually with a two lines in my settings for the IDE theme which I would switch on or off.

This looked like something which could be easily automated and fun to do. And I wrote this extension called timed-themes which does just that. You specify two themes, and time ranges for the two themes in the configuration. The extension takes care of changing the theme at the appropriate times.

Here’s the url to the marketplace -> timed-themes

Install gcloud-sdk and Docker on Ubuntu 16.04 on VirtualBox

2018-02-15 03:26:00 +0000

I use Windows 10 Home on my laptop, so docker integration is a challenge, espescially running all the builds written in shell scripts won’t run nicely on Ubuntu on Windows or MSYS2.

So I’ve had to fallback on installing ubuntu on virtualbox, with docker and gcloud-sdk. I’ve documented the steps below.

Get VirtualBox

Download VirtualBox

Install Ubuntu on VirtualBox

Get Xubuntu 16.04 ISO. Xubuntu is lightweight and provides a standard desktop. Ubuntu or other flavours should also work.

Download Xubuntu LTS

VirtualBox Guest Config

Config suggested for guest:

  1. Min Disk: 30GB
  2. RAM: 2GB
  3. LVM Partitioning
  4. Xubuntu desktop installer

Post-install

Enable shared clipboard Host-Guest and Reboot

Devices->Shared Clipboard->Host to Guest

Install VirtualBox Guest Tools

  1. Insert Guest Additions ISO
  2. Run /media/am/VBox_…/autorun.sh
cd /media/am/VBox_.../
sudo ./autorun.sh

Update and Upgrade

sudo apt-get update -y
sudo apt-get upgrade -y

Install aptitude, vim, emacs etc.

sudo apt-get install aptitude vim emacs -y

Install Docker

Install instructions are here Installl Docker CE on Ubuntu

Run docker as user

Add current user to docker group, and verify that it works

sudo usermod -aG docker $USER

Reboot ubuntu for changes to take effect.

sudo reboot

Verify that the changes work

docker run hello-world

See Post-install step for linux for further details.

(Optional) Install Docker Compose

See instructions at Install Docker Compose for Linux

Install gcloud-sdk

Install instructions are here Install gcloud-sdk on Ubuntu

SSH/github setup

Use this gist to setup multiple keys if required. Github multiple ssh keys

(Optional) Install nodejs using package manager

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

For details see instructions at Install nodejs via package manager

Copy the VM before using it

Take a backup of the VM folder if you have space, so that you don’t need to go through these steps again. You can just start from a clean copy where all tools are setup.

Exploring turtle graphics

2018-01-31 03:45:00 +0000

This week I started exploring turtle graphics with my son as he is very interested in drawing and crafts (he calls his room “art room”). We wrote one program together in python’s turtle graphics library. It’s here - face.py , and this is what it looks like :)

So this got me reading and exploring a bit more about turtle graphics, especially since the tools and language python were not really easy enough to use for my son. So I decided to create my own turtle environment (currently I’m thinking about doing this in electron so that it’s available on all platforms - I use windows, linux and mac at home).

Here’s a list of turtle resources I compiled - Turtle Graphics Resources

More on this soon.

A GCD Game!

2017-05-08 04:44:00 +0000

Recently I’ve again started reading Dijkstra’s book “A Discipline Of Programming”. In the very first chapter “Chapter 0 on executional abstraction”, he mentions a board game which when played correctly produces the GCD of two numbers. It is just an implementation of Euclid’s Algorithm. I wanted to write a program to play this game.

I’d also discovered a library to produce svg animations called vivus, which I wanted to try.

So here’s my implementation of the GCD game in html/javascript - GCD Board Game. Note that the numbers are provided using URL params to the html (x, and y are the param names.)