Enabling Bash auto-completion in Ubuntu

Virtual Private Servers are usually installed with the minimum required software. More often than not this means Bash auto-completion isn’t enabled, which is a tad bit annoying as it slows down navigation.

To fix this you can install theĀ bash-completion package. Like so:

$ sudo apt-get intall bash-completion
Share

Open taskbar apps with Windows key + number

Something I accidentally discovered is that in Windows 8.1 (and probably 8 as well) you can use the Windows key + a number to open an application from your task bar!

So lets say you’ve got Google Chrome at position 1, Thunderbird at 2 and Visual Studio 2012 at position 3. To open Thunderbird simply press Windows key + 2. For the other applications use their position number.

Useful? I don’t know, but it’s nice to know this shortcut exists to keep your hand away from your mouse I guess.

Share

SQL: Find & Replace text in all records

On type of query I always have to run when moving a website from its test environment to its live environment is to replace the test domain in all content pages with the live domain. With SQL this can be easily done with the REPLACE(text, search, substitution) function.

For example:

UPDATE some_table
SET some_field = REPLACE(some_field, 'test.example.com', 'example.com')

This updates all records in the table some_table and replaces test.example.com with example.com in the field some_field.

Knowing which SQL functions exist can really help a lot and save time to update data.

Share

Prevent indentation when pasting from an external source in Vim

Occasionally when I copy and paste something from an external source into Vim every line gets indented, which is probably not something you want when pasting a code snippet.

The solution to this problem is an easy one. Before pasting, first execute :set paste, then paste your content and to return the setting to its previous value execute :set nopaste.

Problem solved!

Share

Keeping VirtualBox Guest Additions in sync with Vagrant

Whenever you’re upgrading the software packages on your VirtualBox machine, managed by Vagrant, you risk VirtualBox Guest Additions render unusable and thus your shared folders don’t work anymore. This usually happens whenever a kernel upgrade is being done which requires the VirtualBox drivers to be recompiled.

Thanks to a Vagrant plugin called vbguest you can now safely upgrade your software packages. If you’ve got this plugin installed every time you run vagrant up it’ll check the installed version of VirtualBox Guest Additions and updates it accordingly.

To install the plugin run the following command from your shell:

$ vagrant plugin install vagrant-vbguest

Share