Notes about IP Address and Subnet Mask

Everything is working on binary number system in computers, so it is valid in IP addresses as well.

Assume that IP address is in dotted-decimal format is equal to 11000000.10101000.00000001.00000000 in dotted-binary format.

Assume that Subnet Mask is in dotted-decimal format is equal to 11111111.11111111.11111111.00000000 in dotted-binary format. Subnet Mask is shown in /24 in slash notation(known as CIDR notation)

IP Address with Subnet Mask can be shown in CIDR notation

CIDR gives a concise way to represent both an IP network and its size using a combination of an IP address and a number after a slash.

Subnet Mask is 24 after slash in decimal representation. In order to find out 24, Subnet mask should be represented in binary number system like 11111111.11111111.11111111.00000000. So, just count how many 1 bit there are in Subnet Mask.

IP Address and Subnet Mask in Decimal format:
IP Address:
Subnet Mask:

IP Address and Subnet Mask in CIDR format:

IP Address and Subnet Mask in Binary format:
IP Address: 11000000.10101000.00000001.00000000
Subnet Mask: 11111111.11111111.11111111.00000000

Continue reading

How to create AWS Lambda with AWS SAM CLI

According to my experience, if you want to create an AWS Lambda without interactive mode, 15 templates below don't exists for each runtime, for example, Data processing template only exists for dotnet and nodejs.

Notice that third template name is Hello World Example with Powertools for AWS Lambda in below output, but if you want to create a project with python runtime and third template in the below sam init output, you have to use hello-world-powertools-python as a template name. But it is not mentioned in help. So, i just used sam init in interactive mode and output of this command showed me template name.

sam init --name my-data-processing-app --runtime python3.9 --dependency-manager pip --app-template hello-world-powertools-python

$ sam init

You can preselect a particular runtime or package type when using the `sam init` experience.
Call `sam init --help` to learn more.

Which template source would you like to use?
	1 - AWS Quick Start Templates
	2 - Custom Template Location
Choice: 1

Choose an AWS Quick Start application template
	1 - Hello World Example
	2 - Data processing
	3 - Hello World Example with Powertools for AWS Lambda
	4 - Multi-step workflow
	5 - Scheduled task
	6 - Standalone function
	7 - Serverless API
	8 - Infrastructure event management
	9 - Lambda Response Streaming
	10 - Serverless Connector Hello World Example
	11 - Multi-step workflow with Connectors
	12 - Full Stack
	13 - Lambda EFS example
	14 - DynamoDB Example
	15 - Machine Learning
Template: 1

Use the most popular runtime and package type? (Python and zip) [y/N]: 
Continue reading

How to create AWS Lambda, Azure Function, Google Cloud Function with Serverless Framework CLI

Serverless framework is a CLI to build cloud applications. There are more than 10 Serverless Infrastructure Providers like AWS, Azure and GCP as shown below screenshot.

Find more Serverless Framework CLI command in Azure Serverless TypeScript project in GitHub

According to my experience, Serverless Framework gives a better support for AWS provider, for example, if you see project template below, there are many project templates for AWS but very less support for other providers.

Find more details in

Continue reading

Visitor Design Pattern Notes

Visitor classes are commonly used to perform operations on a set of objects without modifying the structure of their underlying classes.

Visitor Design Pattern allows you to add new operations(behaviours) via Visitor classes to existing classes without modifying their structure. Instead of adding the operation within the existing class, you create a visitor class named as operation you want to have in existing class, so that the operation is externalised from a set of objects without modifying the structure of their underlying classes.

Visitor Design Pattern is more about adding new operations to existing classes via Visitor classes without modifying their structure, rather than adding new fields or methods directly to the classes themselves.

Consider a system where you have a hierarchy of classes representing different shapes, like Circle, Rectangle, and Triangle. Each of these shapes implements Visitable interface(or its equivalent) to allow visitor classes to operate on them.

Continue reading

How to install .NET with dotnet-install script

Find more details in Microsoft scripted installation

  1. .NET SDK (Software Development Kit): The SDK includes everything you need to build and run .NET applications. This means it includes the runtime, but also includes other tools for developing, building, running, and testing .NET applications. This includes the .NET CLI (Command Line Interface), compilers, and libraries. You need the SDK to develop and build .NET applications.
  2. .NET Runtime: The runtime includes just the resources required to run existing .NET applications. It does not include the tools and libraries used for building applications. It's a smaller installation package compared to the SDK. When you deploy a .NET application to a server or a client machine, you usually only need to have the appropriate .NET Runtime installed on that machine, not the full SDK.


$ curl -sSL >
$ chmod +x
$ echo 'export DOTNET_ROOT=$HOME/.dotnet' >> ~/.zshrc
$ echo 'export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools' >> ~/.zshrc

dotnet-install Script Reference

find reference for dotnet-install script reference in dotnet-install script reference

find options for dotnet-install script in dotnet-install script options

Continue reading

Python Azure Function Debugging in Pyenv-virtualenv virtual environment

Creating virtual environment

$ mkdir python_demo
$ cd python_demo
$ pyenv local 3.9.16
$ pyenv virtualenv 3.9.16 python_demo-3.9.16

# OR pyenv-virtualenv will use local python runtime with the following command
$ pyenv virtualenv python_demo-3.9.16

setting pyenv local version to created virtual environment will allow to activate virtual environment automatically when we enter project folder, so exiting from project folder will deactivate virtual environment.

$ pyenv local python_demo-3.9.16

Activating virtual environment

$ pyenv activate python_demo-3.9.16
Continue reading

Python listing virtual environments for conda, pipenv, pyenv-virtualenv


$ conda env list

# conda environments:
base                     /opt/homebrew/Caskroom/miniconda/base
python_azure_function_conda_virtual_env-3.9  *  /opt/homebrew/Caskroom/miniconda/base/envs/python_azure_function_conda_virtual_env-3.9
python_demo-3.9          /opt/homebrew/Caskroom/miniconda/base/envs/python_demo-3.9
test34-3.9               /opt/homebrew/Caskroom/miniconda/base/envs/test34-3.9
test35-3.9               /opt/homebrew/Caskroom/miniconda/base/envs/test35-3.9
test36-3.9               /opt/homebrew/Caskroom/miniconda/base/envs/test36-3.9


$ pyenv virtualenvs

  3.10.3/envs/test31-3.10.3 (created from /Users/kenanhancer/.pyenv/versions/3.10.3)
  3.10.5/envs/test31-3.10.5 (created from /Users/kenanhancer/.pyenv/versions/3.10.5)
  3.10.5/envs/test32-3.10.5 (created from /Users/kenanhancer/.pyenv/versions/3.10.5)
  3.11.4/envs/python_demo-3.11.4 (created from /Users/kenanhancer/.pyenv/versions/3.11.4)
  3.11.4/envs/test31-3.11.4 (created from /Users/kenanhancer/.pyenv/versions/3.11.4)
  3.11.4/envs/test32-3.11.4 (created from /Users/kenanhancer/.pyenv/versions/3.11.4)
  3.6.15/envs/test31-3.6.15 (created from /Users/kenanhancer/.pyenv/versions/3.6.15)
  3.9.1/envs/test29-3.9.1 (created from /Users/kenanhancer/.pyenv/versions/3.9.1)
  3.9.1/envs/test30-3.9.1 (created from /Users/kenanhancer/.pyenv/versions/3.9.1)
  3.9.1/envs/test31-3.9.1 (created from /Users/kenanhancer/.pyenv/versions/3.9.1)
  3.9.17/envs/python_demo-3.9.17 (created from /Users/kenanhancer/.pyenv/versions/3.9.17)
  3.9.17/envs/test29-3.9.17 (created from /Users/kenanhancer/.pyenv/versions/3.9.17)
  3.9.17/envs/test30-3.9.17 (created from /Users/kenanhancer/.pyenv/versions/3.9.17)
  3.9.17/envs/test31-3.9.17 (created from /Users/kenanhancer/.pyenv/versions/3.9.17)
  python_demo-3.11.4 (created from /Users/kenanhancer/.pyenv/versions/3.11.4)
  python_demo-3.9.17 (created from /Users/kenanhancer/.pyenv/versions/3.9.17)
  test29-3.9.1 (created from /Users/kenanhancer/.pyenv/versions/3.9.1)
  test29-3.9.17 (created from /Users/kenanhancer/.pyenv/versions/3.9.17)
  test30-3.9.1 (created from /Users/kenanhancer/.pyenv/versions/3.9.1)
  test30-3.9.17 (created from /Users/kenanhancer/.pyenv/versions/3.9.17)
  test31-3.10.3 (created from /Users/kenanhancer/.pyenv/versions/3.10.3)
  test31-3.10.5 (created from /Users/kenanhancer/.pyenv/versions/3.10.5)
  test31-3.11.4 (created from /Users/kenanhancer/.pyenv/versions/3.11.4)
  test31-3.6.15 (created from /Users/kenanhancer/.pyenv/versions/3.6.15)
  test31-3.9.1 (created from /Users/kenanhancer/.pyenv/versions/3.9.1)
  test31-3.9.17 (created from /Users/kenanhancer/.pyenv/versions/3.9.17)
  test32-3.10.5 (created from /Users/kenanhancer/.pyenv/versions/3.10.5)
  test32-3.11.4 (created from /Users/kenanhancer/.pyenv/versions/3.11.4)


$ ls -lat ~/.local/share/virtualenvs/