get all the urls in html file (local or on server).

2014-02-17 1 min read bash Fedora
To use this, you will need the lynx tool, so install that first. sudo yum install lynx Now, to get list of all the URLs in local html file or some URL, just execute this: lynx -dump -listonly Related articles Trouble in using file_get_contents() How to send image to server with url in ios Endangered species of the Web: the Link

Fix typescript files generated with script command

2013-12-18 1 min read Learning Linux
Generally quite a lot of us would have used the script command. This generates the logs for the session. But the problem with the logs is that it contains a lot of un-readable characters. These characters are mostly from the color codes, and as such can be removed very easily with a single command: cat typescript | perl -pe 's/e([^[]]|[.*.*?[a-zA-Z]|].*?a)//g' | col -b > typescript-processed This assumes the input log file is named as typescript and the output is kept as typescript-processed. Continue reading

pdfjs – html5+javascript based pdf viewer for Firefox.

2012-09-05 1 min read Firefox
Firefox 15 has arrived and there is lot to brag about. Since there are already many blogs on this, so just giving you a link to one of those. But what is most interesting is the integration of PDF.js. It is a new html5 + javascript based pdf viewer. GHacks Link And to enable this viewer all you need to do is go to “about:config“. Search for pdfjs and set pdfjs. Continue reading

Benchmarking the system/CPU performance

2012-01-15 2 min read bash Fedora Learning
Have you ever wanted to have a quick check on your CPU performance. I know that lot of people will say that this is not the right way to do this, but here is something that you can use to check the CPU speed. #!/bin/bash - #=============================================================================== # # FILE: # # USAGE: ./ # # DESCRIPTION: Benchmark the CPU # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Amit Agarwal (aka), amit. Continue reading

g flag in :s useless in vim

2011-11-05 1 min read Vim Tips
Some time back there was a post on vim_use list about the “/g” flag for the search and replace functionality of the vim. And the response of “Tim Chase” on the same was very elaborate and interesting. I always knew that “/g” is only for replacing multiple occurrences on the same line, but here are few things that I did not know. :0/this/s//that This one will only replace the first occurrence of this in the whole file. Continue reading

better bash debugging

2011-09-16 1 min read bash Linux
I was trying to debug some bash scripts yesterday and learnt something new 😉 There are lot of things in bash that you can use to debug and to start with you can enable xtrace mode as follows: set -x With this set you will see that all the commands are printed along with all other information as they are executed. This you can do for any line or for the function or for the whole script. Continue reading

/bash debugger

2011-02-27 5 min read bash Linux
9.2. A bash Debugger In this section we’ll develop a very basic debugger for bash.[10] Most debuggers have numerous sophisticated features that help a programmer in dissecting a program, but just about all of them include the ability to step through a running program, stop it at selected places, and examine the values of variables. These simple features are what we will concentrate on providing in our debugger. Specifically, we’ll provide the ability to: Continue reading
Older posts