Friday, June 14, 2013

Linux Util 4

Hmm, I had to open this new post because I cannot have more than 20 tags for a post.

1) June 14, 2013: Unresponsive system administrator, connection speed is slow and I am sitting in my PNNL intern office, not knowing how to see pdf files created using pdflatex in Natty - this is for my first ever paper from my internship. 

Home directory based xpdf installation in Natty failed because of some missing software or dependencies - only admin could fix this. After losing hope here, today I tried my luck with evince, a medium-weight software, but definitely lighter than acroread, in Google for solutions to
"cannot parse arguments, cannot open display" problem.

And Bingo, thanks to StackExchange, all I had to do was to copy the evince binary from global directory to my home bin directory and set the alias for evince in bashrc. Phew!!! Wish I had known this before. Long live user Gilles!! He answered his own question, incidentally. A proper fix for this could be done only by the admin, apparently and well, then in my case, I have to wait indefinitely for this.


My months long wait is finally over :). Is it not good that we have something called home directory in linux?


2) About 8 years back (around 2006, 2007, way long back, huh), firefox used to save the bookmarks automatically to a file called bookmarks.html, that I  used to just copy to the desired location, all in the command line itself. Did not realize this has changed with the recent versions. Now, I am looking for one url (Aeolus/ganglia, specifically) available in my office natty to my PNNL box, but I find my bookmarks.html file (at ~/.mozilla/firefox/profilename/) is actually way smaller than the number of bookmarks I find in my browser. Thanks to MozillaZine, I understood that the default behavior is not to save the bookmarks and that you have to edit the config file to force firefox to do that. Here is what I did:


  • find the prefs.js file in .mozilla directory (should be available in the same location as your other profile specific files). The file header says you are not to edit the file, but I tried and it worked :)
  • type the following as the last line of that file:
    • user_pref("browser.bookmarks.autoExportHTML", true);
  • save it. Reopen firefox and close it. This will update the local files.
  • Now, open the bookmarks.html file and you will find all your saved bookmarks.
Some things to note:
  • Though you might have typed the 'user_pref' line towards the end, after the open-close of firefox, you will find that line sitting in a different place.
  • Please follow the instructions at the header of the file prefs.js and the mozilla's about:config page, if you are not comfortable editing the .js file directly.
3) I got a coupon from Quiznos for a free small sub and I didn't expect the machine I was given at PNNL will not have the option of selecting an area of the window to do screenshot. Here is what I did to print only the coupon (remember, my entire yahoo account screen was taken as screenshot).
  •  Open the image in gimp and note the pixel information of the top, left and bottom, right corners. (Just hover your mouse to these places and you will see the pixel information in the bottom left corner in gimp changing.) Let us say you got, x1, y1 for top left and x2, y2 for bottom right.
  • Calculate the width and height of the image from this information (subtract the smaller left value with larger left value and right with right). x2-x1 is the width, y2-y1 is the height.
  • mogrify -crop widthxheight+x1+y1 imagename.png
That's all.....

Note the letter 'x' between the width and height values, it is not '*', the asterisk. Warning: the original image will be modified. Image quality was not modified at all.

Thanks to the stackoverflow question for this.

No comments:

Post a Comment