Skip to main content


Showing posts from June, 2014

Code for Php based online Treasure Hunt

Hello guys. Some time back I organized an online treasure hunt as part of an event at my college. I thought of sharing the code with you, as you might find it useful. So, I uploaded it on github and here is the link to my repository. Download it from here , and enjoy organizing the game

Ubuntu: Recursively delete multiple files with specific format

Sometimes we have to delete files of specific format (common extensions, ends with ~, etc) which were spanned over a group of directories. To do so, we follow certain methods. Lets do it by an example. In my case, I've o create the temporary files, i.e., the ones ending with ~. Method 1 : Delete them manually Method 2 : Goto each such directory and run the following command rm *~ Method 3 : rm *~ rm */*~ rm */*/*~ rm */*/*/*~ First two methods need more time and to use third method, we must know the depth of recursion. Following method will solve our problem. Method Friendly : Run the following command from the parent directory from which you are deleting the files. find . -name '*~' -type f -delete This will delete all files ending with ~, from the current directory and also all its sub-directories.

PHP : Set document root to be a subdirectory without .htaccess or Virtualhost

Recently I faced a problem with hosting a website on a server to which I have limited access. I was provided with permission only to a sub-directory on the server. I'm habituated to use relative paths, but my root points to the root of server and not my sub-directory. This forced me to use absolute paths at every point. I searched for the solution and end up with two results: .htaccess ot Virtualhost I never tried to understand .htaccess and I don't have access to set Virtualhost . This forced me to try bit harder and here is the outcome. I've created a file named rootpath.php on root directory of my website. ( Note : this is not root '/' of the web server, but my sub-directory) Its contents are as follows: <?php     $relative_path = "/subdirectory";     $server_url = $_SERVER["SERVER_NAME"];     $root = "http://" . $server_url. $relative_path; ?> Now, I include this file on top of every file. Eg: <?php requi

Find an old archived link on web

In recent past, I'm need of a tool, to which the provider no longer provides the link to download. Previously I've blogged about Openlogic , which serves this purpose. Openlogic contains unofficial fork of the original repository, and to be precise, I haven't found the tool I'm in search of. I found Internet Archive : Wayback Machine , while searching for it. It has got 412 billion stored pages and you may look into older versions of any website or you can get link to any software/tool which used to be a website. All you have to do is, provide a link or part of a link to search. For example, to know how my website used to be in 2013, just type and you can see a calender with some of the dates highlighted, on which they had the snapshot of my website. You can even provide a part of link. For example, to get the link of older version of Android ADT, search using* You can find a set of links and