Force http to https redirection using .htaccess

There are lots of things you can do using the .htaccess file with Apache. One of the most frequently used directive by me is the RewriteRule for redirecting all http requests to https. The easiest way to force redirect any request received on http to https and maintaining the URI request is added below

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

Google-Chrome + CentOS stuck in full screen mode?

If your google chrome is stuck in full screen mode in any of the linux flavors and F11 is not working to sort the issue then you need to look at this fix.

I am not too sure if you guys have experienced this but this is something that keeps on happening with me reguarlarly on different flavors of Linux. The Google chrome browser just gets stuck in full screen mode on the secondary screen. Pressing F11 just does not help. So what do you do if this happens? How do you recover your beloved chrome? Going through I realized that you could just remove all the settings in your profile for Google chrome and the browser would reset to default. You will loose your bookmarks and settings but atleast you can use the browser again. Use Google sync to save your time and you can just log into Google account and get your bookmarks and apps back.

All you need to do is go to /home/user/.config/ and here you will get your google-chrome folder. You can just do a rm -rf /home/user/.config/google-chrome/ and then try launching the browser. It should be the way it launched the first time. This is not a perfect solution but a decent work around I guess.

Merge multiple pdf’sinto a single pdf

Handling multiple pdf’s can be a pain, and combining multiple pdf’s is not as easy as merging doc files. So how to achieve this?

The simplest and the fastest way is using pdftk. Install Ubuntu if you are not a regular user, install this on a VirtualBox image and install pdftk on your instance by typing

sudo apt-get install pdftk

Once the installation is complete, you can now start merging pdf files on the fly by using the following command

pdftk *.pdf cat output merged.pdf


pdftk 1.pdf 2.pdf 3.pdf cat output merged.pdf

There are mutiple options to this which you can find out using man or using google 🙂

How to setup Linux VNC Server with KDE or Gnome

The default desktop for the VNC Server is “TWM”, though most people are used to KDE or Gnome instead. Here is how to change it:

Edit ~/.vnc/xstartup
For KDE, replace “twm &” with “startkde &”
For Gnome, replace “twm &” with “exec gnome-session &”
Kill any existing VNC servers with “vncserver -kill :xxx” where xxx is the display number.
Start a new server.

Gnome – multiple monitor taskbar (Ultramon alternative)

If you are using Linux on multiple monitors you are surely going to miss Utramon, but don’t worry. Gnome has the option of Ultramon in built so no extra application needed.

You can get your task-bar on multiple monitors using the following instructions

1.) Right click on anywhere on the launch-bar, click “New Panel”
2.) Drag that to any monitor.
3.) Right click on that panel, and click “Add to Panel”
4.) Select “Window List” under Desktop and Windows
5.) Click Add.
6.) Click Close, and you’re done.

No more having windows from all monitors listed on the primary monitor itself 🙂

Installing LAMP on Ubuntu

Installing LAMP (Linux – Apache – MySQL – PHP) on Ubuntu is pretty straight forward.

1st we install Apache.
Go to your Terminal and type in sudo apt-get install apache2

2nd step
sudo apt-get install php5 libapache2-mod-php5

3rd step
sudo apt-get install mysql-server

4th step
Just make sure Apache is running 🙂 In your terminal enter
sudo /etc/init.d/apache2 restart

And if you are stuck, google is always available 🙂

How to make all applications use a single proxy in Ubuntu

If you are trying to connect all the apps and bash on your Ubuntu setup to use a common proxy, the easiest way to achieve this is via Network Proxy Preferences. Go to System -> Preferences -> Network Proxy and select the Proxy Configuration and the Ignored Hosts as per your preference. Once done, select Apply System-Wide and you are done. Each and every application including the bash will now use this proxy that you have entered.