Showing posts with label tech. Show all posts
Showing posts with label tech. Show all posts

Thursday, January 5, 2012

Blog visitor information

I experimented with

1) statcounter
2) sitemeter

for collecting information about visitor who visit my blog. Both offer free as well as paid version of their widgets. For better usage of those widgets, a good knowledge of javascript/html scripting would help a lot. I am planning to experiment with widget from Feedjit in future. Will update this post once I get to know more.

Novice bloggers like me need to read Google Webmaster tools page if they are interested to make their blog visible in searches.

Friday, December 30, 2011

Rogue spyware XP Home Security 2012 removal

Got into XP Security 2012 spyware problem when browsing for an old tamil movie and thanks to Bleeping Computer, could successfully fix it. Though there are only few steps involved, the whole process took hours, so you may want start a step and go ahead with other works to save time.

What's great about this solution - the fix is through free software. The only issue here is you need a second clean computer to download the files, take it the one that is infected and run them there.

Here is what I did:
(btw, I had a second clean computer)

1) Try to mute the pop-ups from the spyware by doing a fake registration by giving the activation codes available from pcrisk.com. But, if you are not able to open web browsers, then you have to somehow download registry fix software - pcrisk.com provides this fix. Try to download through start->run and type www.pcrisk.com/xp-fix. Fixing the registry entries is the important first step.

2) When internet itself does not work, you will have to follow the manual removal instructions to begin with - this is available from many websites; be sure to boot the system in 'Safe mode with Networking' for this. This is a tedious process but not so tedious as formatting and installing all softwares again. For me, manual removal was like a preprocessing step, since even after verbatim following those instructions didn't solve the problem. Basically you will have to some how fool the rogue software into believing that you are going to register and not doing anything to remove it.

3) pcrisk.com speaks about proxy fix too. I didn't have this problem, so didn't have to worry about it.

4) General tips for XP Security 2012 removal is available here

5) Once the internet connection is up, follow the steps I did from Bleeping Computer

6) Do not forget to download and install MBAM from cnet.com. Perform a full scan using MBAM and remove the rogue spyware.

That's it.  

Monday, December 26, 2011

vi tips

1) To convert a dos text file to unix file, in the escape mode of vi editor, type:

:set ff=unix

This removes the additional carriage return "\r" at the end of each line

2) To search and replace, in the escape mode:
:.,$s/pat1/pat2/g

This replaces pat1 by pat2 in all occurrences starting from the current position of the character to the end of the file. The current position indicated by . after : and end of the file is given by $ sign after the comma.

3) In command mode, to move to the beginning of the next line, type '+' and '-' to move to the starting of the previous line

4) To remove space from the beginning of all lines in vi editor:

:%s/^b\+//g

5) To replace a bunch of characters to newline in vi editor, use \r for searching.
For example, (1,2,3), ('a','b','c'), ('.....) : this list of tuples all printed in one line can be split as
(1,2,3)
('a','b','c')
....
by typing in escape mode in vi editor:

:%s/), /\r/g

Note the space following ), characters. Note also that there is no need to escape \ in \r.

5) So, during the initial days of my cooking, I used to just  copy and paste the recipes from web to my editor. This editor was Notepad during my W7 days and when I installed Mint 16, I naturally switched to vi. Because of this transition, I started seeing a lot of Windows specific metacharacters in the recipe file. They look like this: <96> or <97>. You cannot search for this combination of characters as they are not separate. For this, I found the solution from SuperUser by this user

:%s/[\x96]//g

This syntax deletes all the occurrences. You can add additional characters as follows:

:%s/[\x96\x97]//g

It is important to have \x in the syntax to indicate you are searching for special characters in their hex code. If you know the exact equivalent character you may add it in the 'replace' part of the command.

Sunday, December 25, 2011

Linux Util 1

1) To paste one of the columns of a multi-column file as one other column in the same file:
cut -f3 -d' ' fname1|paste -d' ' - fname1 > fname2

This command takes the 3rd column of file fname1 and pastes it as first column and writes the content to file fname2. Rename the file fname2 to fname1 to avoid keeping duplicate copies. The hyphen in the paste command can be switched to last to make the 3rd column as the last column instead of first. Here the column separator is the space character given after the '-d' switch.


2) I forget to leave space around binary operator used in expr command in shell scripting.

3) I  keep forgetting about the rules of double quotes and single quotes usage in shell scripting. If you give a single quoted word inside double quoted sentence, the single quote is not interpreted, but a $variable is substituted with its value.

4) To find all C/C++ program files and related header files:

find . -regex '.*\.\(c\|h\|cxx\|cpp\)' -print

This command fetches files with extension .c, .h, .cxx, .cpp and prints their path from the current directory. Please note the extra characters ".*." in the front. The second dot is escaped and so is the first open parenthesis and logical OR symbol '|'.

5) A modification to the above command is by replacing the last 'print' option to 'print0'. That is append number zero to print word. This will display all the file names in one line as against the previous output that prints one file name in one line.

6) If you want the contents of all these files in one go, give the following:

find . -regex '.*\.\(c\|h\|cxx\|cpp\)' -print0|xargs -o cat

7) To remove all spaces in the filenames of a directory, get inside the directory and type in command line:

rename 's/ //g' *

Here, the single space after first '/' is important. Replace '*' with other names if you do not want to apply this change to all files.