linux ubuntu

Real time folder monitoring in CLI Linux

I needed to see the changes to a folder in realtime and after a bit of looking around, i’ve found this solution:

 watch -d -n 1 'df; echo " "; echo "Local folder updates:"; ls -FIAt;'

If you want to refresh at longer intervals (not 1s as it is now) all you have to do is change the value of the -n parameter as so:

 watch -d -n 10 'df; echo " "; echo "Local folder updates:"; ls -FIAt;'

This will show you the changes to the current folder every 10s.

linux ubuntu

Cannot See Video For Google Plus Hangout on Linux

After installing the Google Talk plugin, run the following to add an override for your video settings.

sudo echo "O3D_OVERRIDE_RENDER_MODE=2D" >> /opt/google/talkplugin/envvars

Use sudo if necessary. Restart your browser after doing this and check to see if you can see video streams now.


Netbeans 7.1 integration in Unity

Go to Tools -> Plugins -> Settings -> Add

Name: Java Ayanata

then install the plugin

more details:


Create PDF from multiple image files on Linux

I had a bunch of image files A01.jpg, A02.jpg and so forth that i needed created into a PDF. ImageMagick to the rescue:

cd /path/to/jpgs
convert -define pdf:use-trimbox=true *.jpg batbox.pdf

Sublime text 2 Unity Launcher

I’ve looked into Sublime text 2 today, mostly unhappy with the speed Java based IDEs have on linux 64bit. When launching it, although I chose “keep in launcher”, the icon does not stay there, so i created a custom launcher.

Create a file sublime2.desktop and save it in ~/.local/share/applications. The file should look like this:

#!/usr/bin/env xdg-open

[Desktop Entry]
Name=Sublime Text Editor
Comment=Sublime Text Editor
Exec="/usr/bin/sublime" %F

You can find the link to the icon here:

Make sure to change the Exec path, to where you have installed Sublime2. I’ve installed in /opt but i’ve symlinked in /usr/bin

linux ubuntu

Perl recursive replace in files

While working on a ZF application, i had some models under the wrong namespace, and changing all the files from Default namespace to Application would have taken me ages. After a bit of google-ing i’ve found this great perl onliner:

perl -p -i -e 's/Default_/Application_/g' `find ./ -name '*.php'`

Install synergy client on Lion

I do most of my work on my Ubuntu laptop but i also have one mac mini next to it so i can debug websites in Safari or iPhone/iPad. In Snow Leopard i had setup synergy server on the laptop and the client on my mac, and i could easily use laptop’s mouse and keyboard to control both machines. Here is how you can setup this:

On Ubuntu machine (server):

# install synergy 1.3.6 (other versions seem to have all sort of bugs)
# if 1.3.6 is not in repo anymore, check the download page:
sudo apt-get install synergy

Now create the server config file (you might need to adapt this according to your setup

section: screens
		ctrl = super
		alt = alt
		super = ctrl
section: options
        mousebutton(7) = keystroke(control+right)
	mousebutton(6) = keystroke(control+left)

section: links
           left = io.local
           right = orion

Add this line to startup:

/usr/bin/synergys --config /home//synergy.conf -f

On Mac mini (client):
First of all, you’ll need to install brew, if you haven’t already ( For that check the installation at:

After you have brew installed open a terminal and install synergy:

brew install synergy

Now create a .profile file in your home directory and add:

if [ "$(pidof synergyc)" ]
    echo "Synergy is already started";

First and last day of the month in PHP

I’ve been working with dates today and i’ve found a pretty neat snippet to show the first and the last day of the month using php

		$firstDoM = date("Y-m-01"); //01 -> first day of month
		$lastDoM = date("Y-m-t"); //t -> last day of month
internet explorer web browsers

Force IE to use the latest engine

If by some unknown reason IE8/9/10 are rendering your site in compatibility mode, ie IE7 mode or something lame like that, just force it to use the latest engine available:

note that the code added right before the doctype declaration. the using_ie() boolean function below (credits to Simeon for this solution:

function using_ie() 
    $u_agent = $_SERVER['HTTP_USER_AGENT']; 
    $ub = False; 
        $ub = True; 
    return $ub; 

Magento get all products

Here is an easy way to return all the products from a magento store.

$collection = Mage::getModel('catalog/product')

foreach ($collection as $product) {
    echo $product->getName() . "
"; }