Facebook Look Who Just Died Scam Is Targeting Users Here Is What Happening And How To Remain Safe

Facebook Look Who Died Scam: The cases of cybercrime are increasing continuously. The more careful the people are being made by the government and the media, the more advanced the hackers are…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Building phone number validation system with AWS Pinpoint

Random image with dirty laptop

At $0.006 per call (at the time of writing), it does not cost much. There may be other free tools out there, but I am skeptical about how shady they turn out to be, caching my valuable database; Plus, if I am already using other AWS components for various needs, it is a really quick integration to verify phone numbers with something as simple as a CLI call, with AWS credentials/profile already setup —

Output looks like this-

This is good enough for randomly checking phone numbers. But I have a mammoth CSV of few Gigabytes to process. A quick and dirty solution in RoR since I already have a rails project running -

Add required AWS SDK in Gemfile

Drop this method wherever it fits appropriately, probably in under /lib under a class-

This is simply pretty-printing the responses to screen, not much useful. Lets create another CSV file with only those rows which satisfy a certain condition, say only mobile numbers. Modify the above file to write a row to new CSV conditionally.

Next, I open that CSV to write and loop through conditionally

Now I actually have a CSV file with only rows that contain mobile numbers! And yes, I have a flag in my log. ⛳️

What if I had multiple rows having same number? What if it was a user/people database where multiple people shared same number? What if AWS threw error? (It does sometimes if you send a bad number)

Cache it. Catch it.

For this, I separate out the AWS query part and validating part to new functions.

The original method should now look like this to make use of above-

These, I leave it as exercise to the reader!

Add a comment

Related posts:

Money is the key

Inspired by this week’s Chalkboard one line poem prompt.. “Money is the key” is published by Kathy Jacobs in Poets Unlimited.

Misfired Story

This is a true story of what happened when I decided to do a kindness for an early reader. Rather than foist a digital manuscript on a person who only reads paper, I printed out the pages after…

NASA SPACE APPS

Space Apps is an international hackathon for coders, scientists, designers, storytellers, makers, builders, technologists, and others in cities around the world, where teams engage with the National…