Git Cherry Picking Across Forked Repos and Empty Commits

Recently I found myself in a situation where I wanted to bring in a specific upstream commit into a forked repository. Although these repos share a common history, the two repos had diverged enough that it wasn’t a straight-forward cherry-pick between branches. Instead, with clones of the two repositories I managed to cherry-pick as follows:

git --git-dir=..//.git format-patch -k -1 --stdout | git am -3 -k
Read more

Merging a git repository from upstream when rebase won’t work

I use a lot of open source software in my research and work.

In recent months I’ve been modifying the source code of some of open source repositories to better suit my needs and I’ve contributed a few small changes back to the DeepLearning4J and the Snacktory projects.

This morning I’m starting to work on a further patch for the DeepLearning4J repository and I needed to bring my local repository up to date before committing the change. However, at some point over the past few months the DeepLearning4J repository has been rebased and my fork of it will no longer merge.

Read more

Reverting VirtualBox Guest Additions 5.0.22 on Ubuntu 16.04

Earlier today I upgraded my installation of Virtualbox on Windows 10 from 5.0.20 to 5.0.22. This also came up with an update to the guest additions which I installed into my Ubuntu 16.04 guest machine.

After a reboot Ubuntu would no longer boot and instead would flicker as it tried to change the screen resolution inside the virtual machine. This is a known problem in VirtualBox (see: https://www.virtualbox.org/ticket/15526).

I’ve managed to revert VirtualBox and the guest additions back to 5.0.20 using the following steps:

Read more

Git logs and commits across multiple branches

Like any good computer scientist I use git for many research and personal projects. My primary use of git is for code backups rather than collaborating with others. However, in some of my recent work I’ve been sharing repositories with colleagues and students which has caused me to improve my git skills.

The following is some of the functionality I’ve only recently discovered that has been extremely helpful:

git cherry-pick commit-id-number
Read more

Code Structure, Random Number Generation and Conditional Probability

I had an interesting discussion this afternoon which highlighted how important it is to understand conditional probability and how code structure can produce unexpected results.

The code contained three lists and a random number generator. The random number generator was meant to randomly chose which list to take something from with equal probability (that is 1/3 chance of selecting from each of the lists). However, somehow one of their lists was being selected far more than the others.

Read more

Completely destroying all data on a Hard Drive

A few days ago while clearing through some old boxes of computer equipment I discovered an old hard drive. This drive had been removed from an old computer that had been disposed of. At the time of disposal I copied all information from the old computer its replacement and kept the old hard drive as a backup in case something went wrong.

Now more than five years later I no longer need the backup and want to dispose of the physical hard drive. But first, I want to ensure that the drive is completely clear of the old data. Connecting the drive to my current computer it can still mount and read the old drive and I can see all the old files on it. It’s good that the backup has lasted this long but to completely wipe the drive of all this old personal data is a little more complex than just selecting all the contents and pressing the delete button or doing a reformat under Windows.

Read more

The Control Centre – 2013

For the past seven years, every two years, I have posted a photo of my “control centre”, aka my home computer setup. Only this time, by mistake, it has been three years since I last posted. So below is the control centre in 2013.

Control Centre 2013
Control Centre 2013

The changes since the last post have been the addition of a 23in monitor, new keyboard and mouse and a new main system.