Jun 10

Adding a template for new Python files in Emacs

I wanted my name and email address to appear in the top of the page every time I create a new python file in Emacs. So here’s what I did to achieve that.

First of all create a folder called templates in the .emacs.d directory (the .emacs.d directory is located in your home directory. If it does not exist, just create the directory ). Then create a file named template.py  in that directory. And add the text you want to be included when you create a new python file. An example can be shown as follows.

#Name: This Is My Name

#E-mail: someone@somewhere.lol

Then open the .emacs file in your home directory (if this doesn’t exist, simply create an empty file named .emacs). Then add the following content to the bottom of the .emcas.

 Lisp |  copy code |? 
;To load python templates
(add-hook 'find-file-hooks 'maybe-load-template)
(defun maybe-load-template ()
  (when (and 
         (string-match "\\.py$" (buffer-file-name))
         (eq 1 (point-max)))
    (insert-file "~/.emacs.d/templates/template.py")))

(Use the ‘Lisp’ link above to copy the code).

That’s all…!. Now when ever you create a new python file using Emacs these header info will appear!.

More info:

As you might have observed this trick can be extended to other file types by changing the .py extension in the (insert-file “~/.emacs.d/templates/template.py”) line and creating a relevant template in the templates folder.

Also there are more advanced ways to achieve the same with more functionality in http://www.emacswiki.org/emacs/AutomaticFileHeaders

Share Button
Jan 19

A simple FAT32 bootloader written in assembly to boot from USB drives.

This is an assignment done by me for a second year project  in the university. The goal was to write a bootloader that can boot the given OS ( JOSH ) from a pen drive which is having FAT32 file system( We were supplied with a bootloader that could boot only from a FAT12 file system ). 


What this bootloader can do:


It can load the first file( which should be a file less than 4096 bytes) which is located in a USB drive with a FAT32 file system to the memory and hand over the execution to that program.


Download location:




Steps to use the Bootloader:


Included in the README file in gitHub. 



More information can be found in the pdf in the doc folder. 

Share Button
Jan 19

saveMyStatus – A script to manage the chat statuses in a better way in Empathy

This is a script I wrote long time ago.It will load the last used status when Empathy restarts or when one of the accounts of the user comes online. This functionality was not available in Empathy at the time I wrote this script. Every time I restart Empathy, its chat status was reset to “Available”. But now it seems that the new Empathy versions has the capability to remember the last used chat status (whether it was “Available”, “Busy”, “Away”, or “Invisible”).  But still Empathy cannot remember the chat status message that was used in the last time. This script adds all this functionality to Empathy.

How to use this:

(These guidelines are for Ubuntu 11.04 . But procedure will be lot common
in other Linux flavours too)

0) Get the code from https://github.com/ishanthilina/saveMyStatus

1).Create a folder named “.scripts” in the home directory. Copy this script to that folder.
2).Go to Startup Application Preferences (search for “startup” in dashboard).
3).Click Add.
4).Give any Name you like.
5).In Command, click on Browse and select your script from the file browser (which is in
6).Add a comment if you like.

Now the script will run from the next time you login to the computer. Have fun. And don’t forget to give me feedback 🙂

Share Button