How to scrape a web page using chrome developer tools

Sometimes I need to scrape a webpage for some information that I don’t want to copy paste. There are several ways but I wanted something quick and easy.

So here is how you can scrape a webpage in ad-hoc basis for quick and dirty copy paste.

Open the page for example: https://www.google.com/search?q=css+selector+innertext+of+array&rlz=1C1GCEA_enUS931US931&oq=css+selector+innertext+of+array&aqs=chrome..69i57j69i64l3.7807j0j4&sourceid=chrome&ie=UTF-8

Now open the chrome developer tab using ctrl+shift+I, then on the “Elements” tab use Ctrl+F to search and search for the css element that you want to select, In our example I am searching for LC20lb. Once you see it select all the elements you need, to get all the innerText elements matching the above search term go to the “Consol” tab and use the following expression.

Array.from($$(‘.LC20lb’).map(x=>x.innerText))

This will show you all the text entries for all elements matching the CSS regular expression in our case the class id matching LC20lb.

Free online Rx coupon for high deductible insurance plans

When our parents come and visit us from India, we generally take a high deductible travel insurances. These travel insurances generally don’t have any Rx benefits. So whenever the doctor prescribes anything we pretty much have to pay it ourselves.

Last time my parents came to visit us, he had to go thru a surgery here. After the surgery the doctor prescribed some medicine for his recovery. So I went to Walgreen to get those. The medicine was like $6 with Rx insurance but for his we had to pay $100 for it. The pharmacist in Walgreens was super helpful and he used a coupon he already had and it came down to like $60. At least we saved $40 on the medicine.

But just I got a message in one of our WhatsApp group that GoodRx had free online coupons. So I was curious and checked it out. Indeed they have very nice coupons for Kroger, Walgreens etc. I highly recommend if you have to buy medicine for your parents or anyone who have high deductible travel insurance to use those coupons.

Good Rx free online coupon is here.

Java code example

Here is a Java code snippet.

int N = Integer.parseInt(f.readLine());
String johnString = f.readLine();
String masterString = f.readLine();

int[] johnKeys = Integer.parseInt(johnString.split(" ")[0]),
Integer.parseInt(johnString.split(" ")[1]),
Integer.parseInt(johnString.split(" ")[2])};
int[] masterKeys = Integer.parseInt(masterString.split(" ")[0]),
Integer.parseInt(masterString.split(" ")[1]),
Integer.parseInt(masterString.split(" ")[2]);

धर्म रक्षति रक्षितः (Dharma protects those who protects dharma)

I like Bhante Henepola Gunaratana and his discourses. One day I saw this:

I have no doubt this is absolutely true. Yesterday I came across another site which quotes the same (धर्मं रक्षति रक्षितः) from the मनुस्मृति.

It’s true that all the masters are saying the same thing. I don’t think it’s coincidence or repeats.  There are some fundamental rules to this universe and no matter how many century passes by they seems to hold true. Why else the same thing that is said thousands of year ago is said again in the current generation.

 

Python code example

Here is a Python code snippet.

 
indentCount = 0 
textChars = [] 
suffixChars = [] 
# convert the line into a list of characters 
# and feed the list to the ReadAhead generator 
chars = ReadAhead(list(line)) 
c = chars.next() 
# get first while c and c == INDENT_CHAR: 
# process indent characters 
indentCount += 1 
c = chars.next() 
while c and c != SYMBOL: 
# process text characters textChars.append(c) 
c = chars.next() 
if c and c == SYMBOL: 
c = chars.next() 
# read past the SYMBOL while c: 
# process suffix characters 
suffixChars.append(c) c = chars.next() 

A few characterstics of lucky people

I got this in a junk mail, surprisingly it’s not junk at all. Deep insight. My favorite sentences:

1. “Lucky people are more relaxed and open, and therefore see what is there rather than just what they are looking for.”

2. “The happiest people in the world are not those who have no problems, but those who learn to live with things that are less than perfect.”

I set out to examine luck, 10 years ago. Why are some people always in the right place at the right time, while others consistently experience ill fortune? I placed advertisements in national newspapers asking for people who felt consistently lucky or unlucky to contact me.

Hundreds of extraordinary men and women volunteered for my research and over the years, have been interviewed by me. I have monitored their lives and had them take part in experiments. The results reveal that although these people have almost no insight into the causes of their luck, their thoughts and behaviour are responsible for much of their good and bad fortune. Take the case of seemingly chance opportunities. Lucky people consistently encounter such opportunities, whereas unlucky people do not.

I carried out a simple experiment to discover whether this was due to differences in their ability to spot such opportunities. I gave both lucky and unlucky people a newspaper, and asked them to look through it and tell me how many photographs were inside. I had secretly placed a large message halfway through the newspaper saying: ‘Tell the experimenter you have seen this and win $50’.

This message took up half of the page and was written in type that was more than two inches high. It was staring everyone straight in the face, but the unlucky people tended to miss it and the lucky people tended to spot it.

Unlucky people are generally more tense than lucky people, and this anxiety disrupts their ability to notice the unexpected.

As a result, they miss opportunities because they are too focused on looking for something else. They go to parties intent on finding their perfect partner and so miss opportunities to make good friends. They look through newspapers determined to find certain types of job advertisements and miss other types of jobs.

Lucky people are more relaxed and open, and therefore see what is there rather than just what they are looking for. My research eventually revealed that lucky people generate good fortune via four principles. They are skilled at creating and noticing chance opportunities, make lucky decisions by listening to their intuition, create self-fulfilling prophesies via positive expectations, and adopt a resilient attitude that transforms bad luck into good.

I wondered towards the end of the work, whether these principles could be used to create good luck. I asked a group of volunteers to spend a month carrying out exercises designed to help them think and behave like a lucky person. Dramatic results! These exercises helped them spot chance opportunities, listen to their intuition, expect to be lucky, and be more resilient to bad luck. One month later, the volunteers returned and described what had happened. The results were dramatic: 80 per cent of people were now happier, more satisfied with their lives and, perhaps most important of all, luckier.

The lucky people had become even luckier and the unlucky had become lucky. Finally, i had found the elusive ‘luck factor’. Here are four top tips for becoming lucky:

1) Listen to your gut instincts ^ they are normally right.

2) Be open to new experiences and breaking your normal routine.

3) Spend a few moments each day remembering things that went well.

4) Visualise yourself being lucky before an important meeting or telephone call.

Have a Lucky day and work for it.

The happiest people in the world are not those who have no problems, but those who learn to live with things that are less than perfect