is now secure

I went on a course of The Best TLS Training and thought i should implement what i learn on my domain. Previously, was Grade A on and Grade ‘F’ on

But special thanks to, i was able to make it Grade ‘A+’ on both security analyser websites.

Its very easy to do, i only spent 5 minutes to achieve this. You can do it to even if you don’t have access to nginx server you can do it via passing headers in PHP like i did:

//If the HTTPS is not found to be "on"
if(!isset($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != "on")
    //Tell the browser to redirect to the HTTPS URL.
    header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
    //Prevent the rest of the script from executing.

header("strict-transport-security: max-age=31536000; includeSubDomains; preload");
header("X-Frame-Options: SAMEORIGIN");
header("X-Content-Type-Options: nosniff");
header("X-XSS-Protection: 1; mode=block");
header("Referrer-Policy: no-referrer");
header("Content-Security-Policy: upgrade-insecure-requests");

And if you want to go one step further you can also submit your website to which will make all browsers always open your website in HTTPS but becareful about it as you can break things as your http endpoints will stop working.


Using \addbibresource or \biblography with Texmaker

Using the default quick build option of the Texmaker did not work for me. So i had to run the `biber` command separately before i could \cite the reference from the bibresource.

So here is what i did,

Go to user -> user commands and choose Edit User Command.

We will create two commands here; 1. Biber, 2. Compiling.

So click on Command 1 and enter the Menu Item “Biber” and Command “biber %”

Now click on Command 2 and enter the Menu Item “Compiling” and from the wizard select Pdflatex which will automatically generate something like this for the command

"pdflatex" -synctex=1 -interaction=nonstopmode %.tex

Now you can see these commands in the drop down build menu:

Before doing a quick build you will need to run these two commands and it will automatically pick up the reference where you have done the citation.

What kind of Tech resources do I need to work on IOT?

I have been asked this question several times. I could give you a diplomatic answer that it depends and it could differ from person to person but in this post i will answer this question in a general sense.

Arduino UNO
Arduino UNO

IoT devices are physical hardware that can connect to the Internet and can collect, exchange data with the network. Also in some cases they can act upon that data to react to the physical world.

So here is a general list that can get you started:

  1. Switch/Router Connected to the internet  (if its a wifi router make sure it can support 2G Frequency)
  2. An Arduino module (For starters i would go for Ardunio UNO)
  3. A Basic Starter kit containing (LEDs, Jumper wires, Breadboard, maybe some sensors)

I will be publishing some youtube videos soon where i would walk through the basics but feel free to search youtube for other tutorials to get you started.

FIOT – Chapter 3 – The Demo

Following is the demo that i presented at the Lambda Lounge.

Slides that i prepared but never presented as audience was seeking more excitement, so i went freestyle.



FIOT – Chapter 2 : Controlling multiple ESP-01 – Success !!

Previously, i was controlling the ESP-01 over TCP/IP using NodeJS but my main target from the beginning was to control it using Clojure. I have finally made it just two days before the actual demo in Lambda Lounge.

So all the details are in my previous post, the only difference is that this one is a Clojure version, i will build on top of it to create the demo that i would be presenting on Monday.

Here is a summary if you don’t want to read the previous post, i have flashed StandardFirmataWifi onto an ESP8266 IOT Module, to be specific the module is ESP-01. I am controlling the GPIO pin 0 of that module using Clojure without using any external library.

The communication is carried out using the messages in MIDI format. The IP Address of my ESP-01 on the network was and the port open in the flashed version of StandardFirmataWifi was 3030.

So here is the code:

(import ( Socket))

(def socket (Socket. "" 3030))

(def SET-PIN-MODE     0xF4)
(def PIN              0x00)
(def OUTPUT-MODE      0x01)
(def LOW              0x01)
(def HIGH             0x00)

(defn send-command [& bs]
  (let [out (.getOutputStream socket)]
    (doseq [b bs]
      (.write out b))
    (.flush out)))

(send-command SET-PIN-MODE    PIN  OUTPUT-MODE)

I am going to start building the main demo now and will add pictures for it. Stay in touch with the blog feed if you are interested or just show up in the Lambda Lounge to see the LIVE DEMO.

Functional Programming with IOT – Chapter 2 : Controlling multiple ESP-01

In my previous blog posts, i was verifying the theory of using a functional programming language like Clojure with a very well-known IOT module ESP8266. It was a great success and we can see that we can now control that module’s GPIO pins by sending HIGH and LOW signals.

Now begins the next chapter. In this chapter we shall explore how we can control multiple of them. I would be asking myself questions like is it possible to control them synchronously and asynchronously? Can i use Clojure pipelines ? How about using Kafka ?

Traditionally, MQTT brokers are used for controlling multiple IOT modules. You can read more about using them on Intel’s blog post Using Intel® Edison: Securely Connect IoT Sensor to the Internet with MQTT. This is a widely supported protocol and therefore you don’t have to setup these brokers yourself, you can simply use Amazon’s MQTT Message Broker.

My next steps are basically using that and understanding how they fit with Clojure and Firmata.

I have a speech at Lamda Lounge where i would be demonstrating my findings LIVE. You can also follow this blog to see updates.

Functional Programming with IOT (FIOT) – Day 13

After yesterday’s success with Firmata installation i decided to progress and test the ESP-01 with Clojure.  The idea was to test each pin and see if i can send HIGH and LOW signals on the output.

I wrote the following piece of code to test it. The full project can be found on my github.

(ns firmata-test.core
  (:require [clodiuno.core :refer :all]
            [clodiuno.firmata :refer :all]))

(defn -main []
  (let [board (arduino :firmata "/dev/tty.wchusbserial1450")]
    ;;allow arduino to boot
    (Thread/sleep 1000)
    (pin-mode board 0 OUTPUT)
    (while true
        (doseq [x (list 0)]
          (println x)
          (println "HIGH")
          (digital-write board x HIGH)
          (Thread/sleep 6000)
          (println x)
          (println "LOW")
          (digital-write board x LOW))
          (Thread/sleep 6000))
    (close board)))

Using the Cloudiuno library, this code is testing the HIGH and LOW signals on PIN 0 with a 6 seconds delay.

I used a voltmeter to see if the voltage was changing after 6 seconds. So this is what i could see on my terminal while it was running.

Pin 0 Test with Clojure
Pin 0 Test with Clojure

And i had a voltmeter attached to the PIN 0 of ESP-01 to see if the voltage was actually changing. You would need a voltmeter to check if the voltage is changing after 6 seconds.

PIN 0 at Low voltage
PIN 0 at Low signal

Then after 6 seconds,

PIN 0 at High signal
PIN 0 at High signal

During this experiment i noticed that the signal value was inversely proportional to the voltage that was being displayed on the multi-meter. I am still not sure why that happened. Could it be a bug in the library ?

Anyways, this is a great success as now we can finally use Clojure (The Functional Language of our choice) to program hardware such as the famous IOT module called “ESP8266” or to be more specific ESP-01.

I ordered few more of these from China which has now been delivered so i am thinking of a way to use them to prepare a good demo.

Wish me luck.. this is not the end, this is just the start so keep following !

Functional Programming with IOT (FIOT) – Day 12 – Firmata Success !!!

Alhamdulilah ! Success! After 12 days of continuous struggle of trying to make Firmata work with ESP-01, it is finally working. The following screenshot is a working proof.

Firmata Test Program Screenshot
Firmata Test Program Screenshot

So here is how i did it, I cleaned up all the Firmata instances from Arduino. This means i deleted Firmata from Libraries folder, in my case the path was :


and another location was:


Then i followed the solution presented in the firmata arduino github issue 257 which i interpreted as following steps :

  1. You need to install ESP8266 board in our arduino, follow installing the ESP8266 Arduino addon
  2. Clone the ESP8266 Firmata repository onto your local machine.
  3. Open the boards.h file into your editor.
  4. Add the ESP-01 board support by copy/pasting the following lines on Line 165 of the boards.h specified in step 2.
    // ESP8266 generic
    #elif defined(ARDUINO_ESP8266_ESP01)
    #define TOTAL_ANALOG_PINS 0
    #define TOTAL_PINS 17
    #define VERSION_BLINK_PIN 4
    #define IS_PIN_DIGITAL(p) ((p) == 0 || (p) == 2 || (p) == 4 || (p) == 5 || (p) == 12 || (p) == 13 || (p) == 14 || (p) == 15 || (p) == 16)
    #define IS_PIN_ANALOG(p) (false)
    #define IS_PIN_PWM(p) (false)
    #define IS_PIN_SERVO(p) ((p) >= 0 && (p) < MAX_SERVOS)
    #define IS_PIN_I2C(p) (false)
    #define IS_PIN_SPI(p) (false)
    #define PIN_TO_DIGITAL(p) (p)
    #define PIN_TO_ANALOG(p) ((p) - 17)
    #define PIN_TO_PWM(p) PIN_TO_DIGITAL(p)
    #define PIN_TO_SERVO(p) p
  5. Run the ./ which will generate the
  6. Open Arduino, go to Sketch -> Include Library -> Add Zip and add that zip.
  7. Then go back to the repository folder and open StandardFirmata example into Arduino.
  8. Upload it onto ESP-01.
  9. Open Firmata Test program.
  10. Select the correct port and you will see the result as shown in the screenshot above.

Next step is to use Clojure to control ESP-01 (which has StandardFirmata firmware).

Functional Programming with IOT (FIOT) – Day 11

Today, i am going to start with a fresh mind-set and i am going to reiterate some of the things just to make sure i am going in the right direction.

I started with the basic sanity tests.

Test # 1 : Hardware 
So i have ESP-01, i have just verified that i haven’t burnt the IC yet by uploading the blinking example.

Test # 2 : Code
I went to Firmata Github and cloned the latest version of the code in my Arduino. For those who are not aware of how to do it the steps are listed in the readme of the linked github also i am copy/pasting them here:

  • Navigate to the Arduino application
  • Right click on the application icon and select Show Package Contents
  • Navigate to: /Contents/Resources/Java/libraries/ and replace the existing Firmata folder with latest Firmata release (note there is a different download for Arduino 1.0.x vs 1.6.x)
  • Restart the Arduino application and the latest version of Firmata will be available.

while reading through the code i saw the following note which suggests that we cannot use Serial.print() with ESP-01 which means it is hard to debug on ESP-01

Note: “The blue LED on the ESP-01 module is connected to GPIO1(which is also the TXD pin; so we cannot use Serial.print() at the same time)”

Test # 3 : Upload
To test the code is uploaded properly, i uploaded the blinking example first so that i can see the internal LED blinking and then uploaded the StandardFirmataWifi version that stopped the blinking.

Test # 4: Firmata Test
I used the same firmata test program that i used in my previous test to check if Firmata is loaded properly on the ESP-01. But again there were no buttons even though i had selected the correct port.

Looking at all those test results, i believe that Firmata Test Program is expecting ESP-01 to operate on a certain baud rate and it is not able to meet its requirements so TX and RX rate is very low and therefore no buttons are loading. But this is a hypothesis which i still need to test. So that will be my Test 5.

Next post will be about this test 5. Stay tuned !