Monday, April 22, 2013

Load hash from YAML with keys as symbols in Ruby

The most easy way is to start keys with colon ':'

:db:
  - :host: db.host.com
    :port: 5210

Now when you load this

db_config = YAML::load(File.open(File.expand_path('../config/database.yml', File.dirname(__FILE__))))

it will be "symbolized"

Thursday, April 11, 2013

Ubuntu crash after kernel or Nvidia proprietary drivers updates

How to restore Ubuntu if it crashes after kernel or Nvidia drivers updates

  1. Press Ctrl+Alt+T (or Ctrl+Alt+F1) to run terminal
  2. Install linux kernel source and headers
    sudo apt-get install linux-source
    sudo apt-get install linux-headers-<kernel version>-generic
  3. Remove Nvidia drivers
    sudo apt-get remove nvidia-current
    or
    sudo apt-get remove nvidia-current-updates
    or
    sudo apt-get remove nvidia-experimental-<version>
  4. Reinstall Nvidia drivers
    sudo apt-get install nvidia-current-updates
  5. Reboot
    sudo -r now