Miscellaneous

=====Indent a C/C++ code=====

Indent is a wonderful program to format a c/c++ code in order to improve its readability. It has a lot of options to control formatting of different elements. I use the following options:

<code>

indent -br -brs -npcs -npsl -nsaf -nsai -nsaw -cli3 -l78 -i3 -ts0

</code>

=====Convert a bunch of files=====

Use the //mogrify// command to convert a bunch of files from one format to another. Example: To convert all ps and eps files in some directory to pdf format, use

<code>

mogrify -format pdf *.ps *.eps

</code>

=====Forcing file system check=====

Performing file system check periodically is important to maintain integrity

of your data. Sometimes you may want to force a file system check due to some

data corruption. You can use //dumpe2fs// and //tune2fs// to accomplish this.

First check the mount count using //dumpe2fs//

<code>

dumpe2fs -h /dev/hda4

</code>

The following results gives the required information.

<code>

Mount count:              19

Maximum mount count:      33

</code>

"Mount count" refers to the number of times the partition has been mounted since the last check while "Maximum mount count" is the number of times the partition has to be mounted before a check takes place. In order to force a check set the "Mount count" to the "Maximum mount count".

<code>

tune2fs -C 33 /dev/hda4

</code>

You can rerun //dumpe2fs// to check that "Mount count" has been set to 33. Now reboot your computer and wait for the file system check to complete.

=====Capture streaming realmedia=====

You want to save (capture) a RealAudio or RealVideo stream to a file for later viewing or listening.

<code>

mplayer -noframedrop -dumpfile out.rm -dumpstream rtsp://url/to/file.rm

</code>

You can then watch or listen to out.rm with realplay or mplayer. 

=====Gmail css hacks=====

Here are a few things you can put in your userContents.css file to modify the look of gmail.

<code css| userContent.css>

/* For gmail */

@-moz-document url-prefix(https://mail.google.com),

               url-prefix(http://mail.google.com)

{

   /* Hide spam count in gmail */

   #ds_spam b {

      visibility: hidden;

   }

   #ds_spam b::before {

      content: "Spam";

      visibility: visible;

      font-weight: normal;

   }

   /* Destroy ads in GMail */

   div.rh {

      display: none !important;

   }

   /* Some useless stuff at the botton */

   div.ft, div.fcs {

      display: none !important;

   }

   /* Gmail message hover */

   /* yellow colour for hover is #ffc */

   table.tlc tr.ur:hover, 

   table.tlc tr.rr:hover {

      background-color: #fcc !important;

   }

}

</code>

=====Linux tips and trips=====

  * [[http://www.ibm.com/developerworks/linux/library/l-job-scheduling.html |Job scheduling with cron and at]]