99% problems in electronics are related to power supply

Arduino FTDI chip

My dad, who has worked a lot in electronics always says this one thing:

99% of problems in electronics are because of a bad power supply

Today, a real experience of this: In 2014 I bought a GSM signal booster to solve the call drop problem at home. It was working fine for all these 2 years, but since a few weeks the calls started dropping again. The booster had come with an 5V 1A adapter which powered it and I never switched off the booster. When I went to check it, the small screen on it showing the signal strength was blank and even after restarting it a couple of times it didn’t turn up again.

So I replaced the power adapter with my old Nexus 4 charger which can supply 1.2A at 5V. And boom, it works. Signal strength improved and calls are clear again. So always need to keep this in mind, whenever there’s a problem in electronics, first check the power supply.

Advertisements

Results of an online survey about preferred tyres

I am facing some instability on my car rides and after showing it to numerous mechanics, wheel alignment centers everyone said the same: The tyres have gone bad and they need replacement. The car hasn’t had that much running to justify a tyre replacement so I started looking online for solutions. Finally I have to conclude after much online research that the tyres have gone bad.

With so many tyre brands available in the market at different price points it’s difficult to make a good selection by just reading stuff online and knowing about experiences of friends / mechanics. In a commission driven business model like India where every tyre vendor sells tyres of every company they would obviously try to sell the tyre that will fetch them most profits (exceptions exist, I know!). So to make a good choice I decided to run a survey on Twitter and Reddit. Posting the results of the same. I received total 41 responses.

Continue reading “Results of an online survey about preferred tyres”

Call Rate comparison: Per second vs Per minute

A simple graph I made using spreadsheet to compare call rate in per second vs per minute. There was a similar graph somewhere around, but I lost the link and hence I made my own graph 😛

call_rate

1.5 paisa/second and 45p/minute are common rates in per second and per minute plans offered across India, so used that as base for creating my graph. If you are interested in downloading the spreadsheet I used for this calculation, you can do so here. It’s an OpenDocument Spreadsheet. I don’t use Windows nor MS Office. 🙂

Group based HTTP basic authentication using Nginx and MySQL with help of Lua

Recently I moved from Apache to Nginx on one of my servers due to increase in traffic. But I was using HTTP Basic authentication with group based authorization on Apache in this manner:

However, there’s no AuthGroupFile  in nginx. But LUA, a programming language is supported in nginx. So here’s how I used LUA and MySQL for achieving this:

Now the real magic comes in the authenticate.lua  script, I’m posting the code below which is available in Github as well:

The group authentication script looks for users and groups in a table called http_users. Since this is a script you can modify the way users are searched for in the database or change the database altogether!
The lua modules required to run this script are: resty.mysql, resty.session, resty.string and cjson. Though the passwords are stored in the database as a SHA224 hash, the comparison of the password is done by the database itself. I did not convert the password to hash before sending it to database, so you may want to review this in case you are using remote database. I’m using local database over Unix socket so it doesn’t matter much.

The table and triggers I have for the same:

The triggers are required to convert the INSERT  or UPDATE statements into SHA224. I’m using MySQL’s SET data type to ensure that the group value is fixed. The same values can be used by Nginx in $user_group  variable before specifying the access_by_lua_file  directive.

Linode, you need a spam filter

I got this usual money scam email not directly, but via Linode Forum! Who even deploys Web applications without basic spam protection?!

Hello nileshgr,

The following is an email sent to you by joy kone via your account on
“Linode Forum”. If this message is spam, contains abusive or other comments
you find offensive please contact the webmaster of the board at the
following address:

https://forum.linode.com/memberlist.php?mode=contactadmin

Include this full email (particularly the headers). Please note that the
reply address to this email has been set to that of joy kone.

Message sent to you follows
~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: Joy Kone

I have sent you this e-mail because of the need to open discussions with
you. I don’t want you to misunderstand this offer in any aspect…if it is
okay with you, I ask for your full cooperation. I have contacted you base
on trust to handle an investment in your country/company on my behalf as a
prospective partner.

My name is Joy Kone. a citizen but resides here . It might interest you to
know that I have US$10.500,000.00 deposited with a financial institution to
be invested in your country/company. It is pertinent to let me know if you
can handle this fund/investment with you in your country so as to furnish
you with all the necessary details about the financial institution for more
information. Meanwhile, i am very honest in my dealings with people and I
also demand the same from you as a Partner to be. Can I trust you with this
fund?

I want you to note that this is a mutual business venture as t here is a
reward for your assistance. I shall let you know your benefit for your
assistance as we proceed. For a more comprehensive details and source of
fund, please contact me as soon as possible. If you find this letter
offensive, please ignore it and accept my apologies.

Regards,
Joy Kone

Okay I received a reply from someone working at Linode, apparently it is possible to turn off the ability of others to send email to you via the forum: