full of … these

Shell tools, today is sed’s day

Posted: December 4th, 2010 | Author: | Filed under: shell | Tags: , , , , , , , | No Comments »

When you have to deal with shell scripting and task automation you need powerful tools.

I will post some basic usage examples to prove how useful sed can be when you have to modify a large number of files.

Here the simple one.
You have several files and you want a word replaced in all of them.

sed -i 's/apache2/httpd/g' files*.conf

This will modify the file matching the pattern files*.conf replacing “apache2” with “httpd”
Removing -i will print the result on the console.

Now, the really useful one, the one that will save you a lot of time.
The problem you have is: 100+ config files that needs to be modified by adding four lines in a special position in the files.

sed -i '/RewriteEngine/i \
\n<Location \/aaa>\n\tProxyPass ajp\:\/\/127.0.0.1\:8019\/aaa\n\tProxyPassReverse ajp\:\/\/127.0.0.1\:8019\/aaa\n\<\/Location\>\n' files*.conf

-i will modify the files by adding before “RewriteEngine" the text:


empty line
<Location/aaa>
<tab>ProxyPass ajp://127.0.0.1:8019/aaa
<tab>ProxyPassReverse ajp://127.0.0.1:8019/aaa
</Location>
emptyline

Now think about adding these lines in every single file, one by one, from 1 to 100, each in an exact position, some of the configs having two or more sections to be added.

Piece of cake with sed.


Firefox, you lost

Posted: October 4th, 2009 | Author: | Filed under: madabout, online | Tags: , , , , , , | No Comments »

Sadly but I don’t have a computer at home, occasionally, I read news or I write posts like this on an old Tecra A3: 512MB RAM, super slow HDD, intel 915GM video card and extra large resolution 1400×1050.
I’ve been using Firefox for ages, but after I read a post about using IE8 instead of Firefox 3.5.x+AdBlock Plus I was curious about the results.

I went home and I have installed IE8.
And, it’s true.
IE8 on old computers is faster than firefox.
I have enough free memory for my tabs, no more than ten.

On the computer at work I have about 60 tabs open, anytime, I didn’t felt like I have a problem, slow computer, not enough memory.
But, on this one, old one, IE8 is faster.

So, Firefox you lost this battle on old computers.
Sorry. Moved to IE8.

And another thing, there are no adblock features comming with IE8, but you can install a local proxy to filter your web traffic like I did, BFilter.


Adobe Reader 9 – make it incredible faster

Posted: May 9th, 2009 | Author: | Filed under: fun, howto, idiots | Tags: , , , , , | 1 Comment »

I don’t own a new computer so I have to use an old tecra A3 with an old HDD but a very good screen 15″ with a huge resolution: 1400×1050.

Because the hard drive is so slow Adobe Reader 9 starts in several seconds after I double click the pdf file.
So, if you have to read docs this a little bit annoying to have to wait a lot just to start Adobe.
After Reader is loaded the pdf file is loaded quite faster…

So I have googled a bit and I have found a few software apps to speed up adobe reader at start up.
But. Why to install another piece of software when you can do it yourself?!?

Here is how if you only want to read docs, no search, no other stuff:

Go to C:\Program Files\Adobe\Reader 9.0\Reader\ and create a directory “old” or “backup”.
Move the following directories in it: plug_ins, plug_ins3d and SPPlugins.

Start Adobe Reader. How is it? Mine it starts in lass than a second.

Here is how if you want to read docs and you want “Comment and markup” toolbar to be available:
Move all plugin dirs as you read before, but, keep in the plug_ins dir the following files:
AcroForm.api
AcroSign.prc
Annots.api
EScript.api
IA32.api
Search.api
Search5.api
weblink.api

Start Adobe Reader, read your books, educate yourself.

HTH and enjoy.

Later edit:
You can use PDF-XChange Viewer to view, markup text or add comments to your pdf files.