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:

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

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

mogrify -format pdf *.ps *.eps

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

dumpe2fs -h /dev/hda4

The following results gives the required information.

Mount count:              19
Maximum mount count:      33

“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”.

tune2fs -C 33 /dev/hda4

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.

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

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.

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;
   }
 
}

Linux tips and trips

 
comp/misc.txt · Last modified: 2007/07/20 11:54 by pc     Back to top
Get Firefox! Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
This site will render correctly in Mozilla/Firefox.