Today, I had the necessity to embed an iframe on an HTTPS web page and most browsers now won't allow you to embed an HTTP resource on an HTTPS page raising the mixed content warning. Since the code was quite experimental, I didn't want to deploy it out of localhost. So I setup a self-signed TLS certificate for localhost that was accepted by Google Chrome browser.

First, we need to create a key that will be used to sign our certificate. You will be prompted for a password, which you can enter for now:

openssl genrsa -camellia256 -out server.key 2048

Let's remove the passphrase from the key now:

cp server.key server.key.orig
openssl rsa -in server.key.orig -out server.key

Next, we need to create a certificate signing request (CSR) with the above created key. Enter the information you are prompted for:

openssl req -new -key server.key -out server.csr

Create a certificate with validity of 365 days for the above CSR:

openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt

You can use the above server.key and server.crt in any web server or application of your choice.

Create a single file with the certificate and private key to be added into the store:

cat server.key server.crt > localhost.pem

Finally, add this certificate into our trusted store so that Chrome doesn't complain:

certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n "localhost" -i localhost.pem

Your browser shouldn't complain any more with your self-signed certificate successfully added into the store.


Elasticsearch autocomplete on related keywords

Thu 21 April 2016 by Thejaswi Puthraya

Recently, I had to work on a client request to add autocomplete to their site's search based not just on a specific list but on related keywords.

For example, suppose you had a list of TV series like Simpsons, Futurama, Tom and Jerry etc. The autosearch had to suggest ...

read more

Simple Command Line Dropbox Uploader in Python

Sun 10 April 2016 by Thejaswi Puthraya

I don't use Dropbox frequently. In fact, I would prefer not to use it but work requires me to use it from time to time. My only use case was to upload files onto a shared folder. So for my usage, it makes no sense to run the desktop ...

read more

Micro

Mon 21 March 2016 by Thejaswi Puthraya

"Micro" by Michael Crichton (author of "Jurassic Park") is the story of a group of research students who get miniaturized by a company when they get interested in a murder's leads. Does the team survive the world where even insects appear like giants and against time when their bodies ...

read more

Heart of Darkness

Tue 23 February 2016 by Thejaswi Puthraya

What image would the word 'sailor' invoke for you? For me it would be Haddock from Tintin, an alcoholic captain who mouths expletives when sober but a damn good seafarer. But after reading the "Heart of Darkness" by Joseph Conrad, it has changed to Charles Marlow.

Set in the early ...

read more

Don't make me think!

Mon 15 February 2016 by Thejaswi Puthraya

Steve Krug is renowned user experience professional and is the author of several popular books in this area. "Don't make me think!" is his most widely read book. I was recommended this book by a designer in response to my query on designing better online experiences.

I picked up ...

read more

Walden

Fri 22 January 2016 by Thejaswi Puthraya

If you've ever harboured thoughts of retiring to the country side and living off your own small farm, Walden is a book for you. Henry Thoreau, an American philosopher documents his experiences of living in solitude at the Walden lake.

The book lacks a structure but generally discusses a ...

read more

The Element

Tue 24 November 2015 by Thejaswi Puthraya

What does being in one's 'element' mean? How does one get to that state of mind? Before answering these questions, I saw Ken Robinson's TED talk on "Do schools kill creativity?" and resolved to read atleast one book by him to learn more about his ideas.

Now to ...

read more

The suffrage of Elvira

Thu 17 September 2015 by Thejaswi Puthraya

This was my first VS Naipaul novel and I picked it up with a lot of reluctance especially over his chauvinistic views. But boy, this book lived up to it's expectations as a super comedy.

This book describes the first election at Trinidad. The electorate is multi-cultural with Hindus ...

read more

The Little Black book of Innovation

Sun 28 June 2015 by Thejaswi Puthraya

Can innovation be successfully instilled and nurtured within a company? Scott Anthony pulls out quite a few case studies from his career as an "Innovation Expert" and analyzes them for the reader.

This is a book from the HBR stable and is a passable read. The main reason for this ...

read more