Nodemcu Blink Example

Nodemcu Working LED Blink Example

-- Blink using timer alarm --
timerId = 0
dly = 1000
-- use D4
ledPin = 4
-- set mode to output
ledState = 0
-- timer loop
tmr.alarm( timerId, dly, 1, function()
ledState = 1 - ledState;
-- write state to D4
gpio.write(ledPin, ledState)

Posted in IoT | Leave a comment

Setting up Redis High Availability (HA) cluster using Sentinel

We were running redis server in one of our machine which serves one of our mirco service. The redis service was running happily for 3 months. One day suddenly redis server stopped responding because machine ran out of disk space. Initially, Redis was used by only one service. Over the months many service started using the same redis. When redis went down almost all our components came stand still.

Redis has grown to be the critical component of our system. We wanted it to be highly available and fault tolerant. We started exploring the HA options. There are two ways we can go with:

  1. Since our whole infra runs on AWS we can go with Elasticache
  2. We can setup our own HA cluster in EC2 machines.

The workload on the redis is very minimal regarding cpu , network, and memory with occasional bursts on load. We have decided to setup our own redis-server because the minimum cost required to run  a redis HA cluster in Elasticache is 130$.

Sentinel is very light on resource usage and easy to configure.  Our current setup goes like the following

1 Master (us-east-1a  zone)<— 1 Slave (us-east-1b zone)

3 sentinel servers in 3 availability zone.

After the setup when we killed the redis master the automatic promotion of slave didn’t happen. After lots of frustrating hours we found out that we have disabled SLAVEOF Command in the redis server config. Since we disabled the SLAVEOF Command, sentinal has no way of promoting the slave to master.  After we fixed the issue  sentinel promotion worked way cool.



Posted in Application Development, Cloud Computing, Database, elasticache, Linux, NoSQL, redis, sentinel | Leave a comment

mysql ssh tunneling on ec2 instance

ssh -L -i .ssh/MyKey.pem


This will connect to mysql running on on port 3306 through this  host with user name ec2-user whenever we connect localhost port 4000.

To connect to mysql server just point your mysql-workbench with hostname localhost and port 4000

Posted in Cloud Computing | Tagged , , , | Leave a comment

Setting up play framework 2.2.x with Intellij IDEA 13.x.x

Recently i tried to prototype an application with Play Framework 2.2. After going through official document i was able run the quickstart application. I want to integrate play development work with intellij IDEA 13 because IDEA is my preferred IDE after moving out from eclipse. I was using intellij IDEA 13 ultimate edition.

The IDEA should have following plugins installed.

scala , play framework , play framework 2.0(available only in ultimate edition)

To create a new app in terminal

play new fixit
cd fixit
play idea

I was faced with issue saying Cannot resolve symbol ‘index’ in IDEA. To fix

Open the myApp folder in IDEA. File –> Open Project–> [fixit]

Goto  File–> Project Strucuture –> Modules –>Select [fixit] –>  Sources [Tab]

Remove the following two folders from excluded.

target –> scala<version> –> classes_managed

target –> scala<version> –> src_managed

And add the src_managed and classes_managed to sources.

Final project structure should look like this.


Tip: Instead of creating new play application using idea I recommend you to use play command line.

Posted in Application Development | Tagged , | Leave a comment

How to install weighttp in Ubuntu?


a lightweight and simple webserver benchmarking tool.

To install weighttp in ubuntu we need to install libev (It is libev not libdev) using the following command

sudo apt-get install libev4 libev-dev

or we can install libev for any linux and unix oses  from source using the following set of commands

tar xvf libev-4.11.tar.gz
cd libev-4.11
sudo ./configure
sudo make
sudo make install

Get the source code of weighttp from the github using the following command.

git clone

cd weighttp
./waf configure
./waf build
sudo ./waf install

to uninstall
sudo ./waf uninstall

To run weighttp use the following command


Posted in Linux, webserver | Tagged , , , , , , , | Leave a comment

How to install dotcloud CLI in Fedora?

Hi Everyone,
I would like to share my experience in setting up dotcloud CLI(Command Line Interface ) in fedora 15 (LoveLock).

Step 1 :
We need to install easy_install to fetch & install python modules easily . Execute the following command
sudo yum install python-setuptools
Step 2 :
Then execute the following commands to install dotcloud CLI
sudo easy_install pip && sudo pip install dotcloud
Step 3:
Run dotcloud by executing following command
When you launch for the first time it will ask for the API Key which can be found under settings tab of your account
Please enter the API key , then it will create folder under your home directory with a name of .dotcloud which contains two files dotcloud.conf which contains URL and API Key in json format and dotcloud.key which used to upload your files to dotcloud git repo through ssh.

After that you can follow with the official documentation link.

Problems Faced:
i got the following error when i tried to push the contents to dotcloud server.
2012-01-04 16:16:40 [api] Deploy testhtml scheduled for revision = git-a92a5cf
2012-01-04 16:16:40 [api] Expected a type dictionary but got a type string in "dotcloud.yml", line 2, column 3

The above error is caused because of invalid dotcloud.yml .
contents of my dotcloud.yml are

The mistake i did was not giving a space between semicolon and static in the above code.
Corrected dotcloud.yml as follows
type: static

Posted in Cloud Computing | 1 Comment

My First FireFox Addon(Reliance NetConnect+ Data Usage)

Demo Reliance Netconnect Firefox Addon
Recently i bought a Reliance Netconnect+ Wireless Dongle. So far The service is good in my area .
My Data Usage Plan is 2GB day Usage and 10GB night usage.
To Keep myself from not going beyond the usage limit i keep on checking the reliance Website.
Initially i searched for any Reliance Netconnect+ Data Usage Addon in Mozilla Addons website.I didn’t found anything. So i started designing this addon . After 3 night sit-outs i completed a working addon. Now i have submitted it to the mozilla Addon developers site for review . Hopefully my addon will be reviewed within 3 days.
You can download my addon in the following Link

Code Clean up is not done fully and as always known Comments are welcome😉


Hi All,
Since firefox review team is taking more to complete the review of recent version 1.4 you can download it immediately in the following link

I thank everyone for their support , motivation and comments.

Release Notes:

  • Added capability to specify the billing date.
  • Decreased the number of decimal values from four to two.
Posted in Firefox Addon | Tagged , | 35 Comments