Hide Mac OS X Recovery partition

Sometimes the Mac OS X Recovery partition can be seen because it’s mounted automatically on boot. This is usually caused because you moved the operating system to another disk (clone) or because you used an app that changed the disks partitions (rEFInd in my case).

Recovery HD

To fix this you can run this script:


PARTITION=`mount | grep "Recovery HD" | awk '{print $1}'`
if [ -n "$PARTITION" ]; then
    sudo diskutil unmount $PARTITION
    sudo asr adjust --target $PARTITION -settype Apple_Boot

Then SHUTDOWN (don’t just reboot) and turn on the computer.

You can also unmount that partition from the Disk Utility if you enable the debug option from the command line, but this will only work one time as it will be mounted again on next boot:

$ defaults write com.apple.DiskUtility DUDebugMenuEnabled 1


Ref: http://automatica.com.au/2013/11/hide-recovery-hd-after-cloning-an-os-x-installation/

Remove old Linux kernels in Ubuntu

As time goes new kernel versions are released. After a kernel update old installed versions are not removed automatically, they are keep in case something goes wrong so you can boot again to a previous version.


But you may end up having lots of old versions you’ll never use. To remove them first you need to find all the installed versions:

$ dpkg -l | grep linux-image | grep -v extra | awk '{print $2}'

Then remove all the unwanted versions using apt-get autoremove:

$ sudo apt-get autoremove linux-image-3.16.0-30-generic linux-image-3.16.0-31-generic linux-image-3.16.0-34-generic

You should probably leave at least the latests 2 versions just in case.

Ref: https://help.ubuntu.com/community/Lubuntu/Documentation/RemoveOldKernels

Deactivate VCS (Version Control System) in PHPStorm

You can enable VCS (Version Control System) in PHPStorm from the VCS menu but, how do you deactivate it?


I didn’t found an option for that anywhere so this is the solution: Remove the .idea/vcs.xml file and restart PHPStorm.

Ref: How to disable version control in phpstorm?

Unserialize strings with special characters in PHP

After several hours having problems with serialized object with spanish texts in it, finally this function I found in magp.ie worked like a charm:

function mb_unserialize($string) {
    $string = preg_replace_callback(
        function ($matches) {
            if ( isset( $matches[2] ) )
                return 's:'.strlen($matches[2]).':"'.$matches[2].'";';
    return unserialize($string);

For example:


class stdClass#1 (1) {
  public $text =>
  string(12) "áéíóúñ"


vi-vim options

You can change vi-vim options using the set command. To see current options just execute this:


To see all available options:

:set all

To set a value for an specific option, for example ruler:

:set ruler

Or file encoding:

:set fileencoding=utf-8

This is how it looks if you set ruler (display some info about the file and cursor position at the bottom) and number (display line numbers on the left side):


To set the default value for some options edit ~/.vimrc:

set ruler
set number