How to install Google Chrome and fix the goddamn icon after it?

  1. Navigate to:
  2. Download deb file using Download Chrome button.
  3. Run terminal and type:
    cd ~/Downloads
    sudo dpkg -i google-chrome-stable_current_amd64.deb
    sudo apt-get update && sudo apt-get -f upgrade
  4. If you don’t have proper icon in your menu nor plank:
    sudo nano /usr/share/applications/google-chrome.desktop
  5. Find [Desktop Action NewWindow] and add text below after all language declarations:
  6. Press both CTRL + X and save your changes. That’s it 🙂

How to install Spotify on Loki 0.4.1?

Run terminal and type:

sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-add-repository "deb stable non-free"
sudo apt-key adv --keyserver hkp:// --recv-keys 94558F59 D2C19886
sudo apt-get update
sudo apt-get install spotify-client

In case of a problem please comment below. Official instruction can be found here (it was incomplete at the moment of writing).

How to list all PostgreSQL databases and their sizes in MB

You must provide proper database name and user:

File: gistfile1.txt

psql -c "SELECT pg_database.datname, pg_database_size(pg_database.datname), pg_size_pretty(pg_database_size(pg_database.datname)) FROM pg_database ORDER BY pg_database_size DESC;" -d  

How to find Raspberry Pi using MAC address

When you want to find your headless but networked Raspberry Pi and you’re lazy like me use nmap:

sudo nmap -sP | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}'

Mask /24 means that addresses from to will be searched. You can extend that to /16 if you don’t know subnet of your device.

Permission denied when script is trying to execute ps_files_cleanup_dir

This is pretty common problem. I’ve encountered it on recent version of the Debian operating system. When you see something like that:

Notice:  session_start(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) in /mnt/www-data/htdocs/raportMNW/inc/bryanjhv/slim-session/src/Slim/Middleware/Session.php on line 110

You can fix that easily with following Linux commands:

sudo nano /etc/php5/apache2/php.ini

Now use CTRL+W to find following string session.save_path and configure it like that:

session.save_path = "/tmp"

Save your file using CTRL+X and restart Apache2 service:

sudo service apache2 restart

And voilà!

How to delete file permanently in Linux?

Most of Linux distributions have shred already installed. So it’s really easy to delete a file in a secure manner:

shred -u -z -n 26 topsecret.txt

Meaning of used switches:

-n [N] Overwrite a file N times. For example, -n 20 will perform twenty passes over the file’s contents.
-u Remove the file after you’ve shredded it. You’ll probably want to use this option in most cases.
-z After shredding a file with random bits (ones and zeros), overwrite the file with only zeros. This is used to try and hide the fact that the file was shredded.

There is a Windows gui alternative available at