Month: August 2013

vim maps – simple commands to do stuff.

Some time back, I was working on some script for logging and I wanted to change the class to function like this:

$logger->Debug("Test string");
loggerFunc("Debug", "Test String");

As you can see, this change could be quite frustrating if you have quite a few references. And thus vim comes to rescue.

Simple map like ::

:map ,mm :s/(.*)$logger->(.*)((.*)).*/1loggerFunc("2",3);/

and then I can do “/$logger->” and then “n” to go to next match. Just do “,mm” and the line is re-factored.

Break down of the regex :

.* :search for any spaces before $logger->

(.*) :match anything

( : upto (

(.*) :match anything

) : till )

and then replace as required.

 

Enhanced by Zemanta

pkgwat -search packages for Fedora.

pkgwat is a nice utility to search the fedora packages websearch.

Description : Pronounced "package WAT", pkgwat is a fast CLI tool for querying
: the fedora packages webapp.
: https://apps.fedoraproject.org/packages/
:
: You can make its search even better by helping us tag packages.
: https://apps.fedoraproject.org/tagger

And to search forĀ  a package, you can use ::

pkgwat search 
pkgwat -h # get help on package.

 

Enhanced by Zemanta

power save mode for battery in Fedora 19.

I was getting really bad battery life on my Fedora 19 system, and did not find much on how to tune it. Finally I found something that just does not need much configuration but works pretty well. So, here is what you need to do:

sudo yum install tuned tuned-adm

The second package, tuned-adm installs additional themes for power saving. It is optional and not mandatory. Once you have installed these, you can do the following:

tuned-adm list #List all the profiles
tuned-adm  # Set the profile.

 

Enhanced by Zemanta