All posts by jahans

How to write a lambda function in Python

To write a lambda function (technically inline function) in Python, you can use the “lambda” keyword. You can following example to see the basic usage of a lambda function:

Python 3.7.0 (default, Jun 29 2018, 20:13:13)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> add_function = lambda a,b: a+b
>>> add_function(2,3)

Connect to Wifi with nmcli

I had to connect to a new wireless network recently. I have done this several times, but every time I have to go through man pages to find the arguments for the command. So I have decided to document this for everyone:

To view the list of wireless connections:
nmcli device wifi

To connect to the preferred wireless connection:
nmcli device wifi connect Jahans-Wifi password Jahans-Password

Ofcourse you will need to replace Jahans-Wifi with the essid of the connection and Jahans-Password with the actual password for the wifi.

How to install Consul on CentOS

Get the download URL from:

On terminal type:
#Download Consul binaries
#Download Consul web app

# Uzip the archives
unzip && unzip

How to test SSL Protocols and Ciphers on local machine

I generally use SSL Labs qualsys to test servers for cipher strength and supported protocols. However, recently I was presented with a requirement to test a HTTPS server locally.

In past, I have tested such servers via openssl and it does a great job. This time around I came across something called CipherScan:

  • CipherScan is a great utility to test your SSL configuration specially to enable/disable weak/strong ciphers.

    Clone the project and give it a go.