Leonard Topno https://blog.leonardtopno.com Techical Blogs : Tech With Leo Thu, 10 Aug 2023 08:49:09 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 214496674 Windows and Mac Commands for development https://blog.leonardtopno.com/windows-and-mac-commands-for-development/ Thu, 10 Aug 2023 08:45:45 +0000 https://blog.leonardtopno.com/?p=239 On Windows: type nul > <file_name> You can check the version of the virtual environment installed by typing the following 2. To create Virtual Environment navigate to the folder where you wish to create Virtual Environment and type:Syntax: python -m virtualenv...]]> Problem Statement: Installing virtual environment in Windows:

1. To create a file using terminal :
Syntax:
In Mac:
touch <file_name>

On Windows:
type nul > <file_name>


                                  In Mac

touch code_improvizer.py

                                 In windows

C:Users\leo\projects\code_improvizer>  type nul > code_improviser.py

You can check the version of the virtual environment installed by typing the following



C:Usersleo>  virtualenv --version 

2. To create Virtual Environment navigate to the folder where you wish to create Virtual Environment and type:
Syntax: python -m virtualenv <name-of-the-virtual-environment>
or
virtualenv<name-of-the-virtual-environment>




C:Usersleocodingutilities>  python -m virtualenv venv 

                            OR

C:Usersleocodingutilities>  virtualenv venv



2. To Activate the Virtual Environment type [specific to Windows (Not for MacOS)]:
Syntax: .<name-of-the-virtual-environment>Scriptsactivate.bat
or
.<name-of-the-virtual-environment>Scriptsactivate



C:Usersleocodingutilities>  .venvScriptsactivate.bat

                           OR

C:Usersleocodingutilities>  .venvScriptsactivate

]]>
239
How to keep your machine awake using this simple python script https://blog.leonardtopno.com/how-to-keep-you-machine-awake-using-this-simple-python-script/ Wed, 05 Apr 2023 08:14:28 +0000 https://blog.leonardtopno.com/?p=223 Problem Statement: Python script to keep your windows/mac awake


import pyautogui
import time


def remain_awake():
    while True:
        pyautogui.FALLSAFE = False
        pyautogui.move(0,2)
        time.sleep(58)


# Driver Code
if __name__ == "__main__":
    remain_awake()

Practice Problem Link:

]]>
223
How to install and create Virtual Environment in Windows https://blog.leonardtopno.com/how-to-install-virtual-environment-in-windows/ Tue, 04 Apr 2023 15:56:26 +0000 https://blog.leonardtopno.com/?p=207 or virtualenv<name-of-the-virtual-environment> 2. To...]]> Problem Statement: Installing virtual environment in Windows:

1. To install Virtual Environment, type the following in terminal:
Syntax: pip3 install virtualenv



C:\Users\leo>  pip3 install virtualenv 

You can check the version of the virtual environment installed by typing the following



C:\Users\leo>  virtualenv --version 

2. To create Virtual Environment navigate to the folder where you wish to create Virtual Environment and type:
Syntax: python -m virtualenv <name-of-the-virtual-environment>
or
virtualenv<name-of-the-virtual-environment>




C:\Users\leo\coding\utilities>  python -m virtualenv venv 

                            OR

C:\Users\leo\coding\utilities>  virtualenv venv



2. To Activate the Virtual Environment type [specific to Windows (Not for MacOS)]:
Syntax: .\<name-of-the-virtual-environment>\Scripts\activate.bat
or
.\<name-of-the-virtual-environment>\Scripts\activate



C:\Users\leo\coding\utilities>  .\venv\Scripts\activate.bat

                           OR

C:\Users\leo\coding\utilities>  .\venv\Scripts\activate

]]>
207
Mac Shortcuts For Productivity https://blog.leonardtopno.com/mac-shortcuts-for-productivity/ Fri, 23 Sep 2022 13:59:48 +0000 https://blog.leonardtopno.com/?p=165 Switch between Virtual Desktops:

  • Ctrl-Right Arrow: Navigate to the Desktop on the Right of Current Desktop
  • Ctrl-Left Arrow: Navigate to the Desktop on the Right of Current Desktop
  • Ctrl-Up Arrow: Be able to see the see all the Virtual Desktops in the Current Screen
  • Ctrl-Down Arrow: Does Nothing

Ctrl-Left Arrow: Navigate to the Desktop on the Left of Current Desktop

Ctrl-Up Arrow: Navigate to the Desktop on the left of Current Desktop

Ctrl-Down Arrow: Does Nothing


Other Similar Link:

]]>
165
Find two non-overlapping pairs with the same sum in a list https://blog.leonardtopno.com/find-two-non-overlapping-pairs-with-the-same-sum-in-a-list/ Fri, 23 Sep 2022 12:52:19 +0000 https://blog.leonardtopno.com/?p=131 Problem Statement:

Given an UNSORTED integer array, find two any two non-overlapping pairs having the same sum.

Sample Input:

[1, 7, 9, 3]

Output:

1 9

7 3

Explanation:

They both sum up to 10


"""
Given an UNSORTED integer array, find two non-overlapping pairs in it having the same sum
"""

# Function to find two non-overlapping pairs with the same sum in a list


def find_pairs(myarr):
    # create an empty dictionary
    # key -> sum_of_pair of a pair of elements in the list
    # value -> list storing an index every pair having that sum_of_pair
    mydict = {}

    # consider every pair (myarr[i], myarr[j]), where `j>i`
    for i in range(len(myarr)-1):
        for j in range(i+1, len(myarr)):
            # calculate the sum_of_pair of current pairs
            sum_of_pair = myarr[i] + myarr[j]

            # check if the sum_of_pair is already present in the dictionary
            if sum_of_pair in mydict:
                # check every pair for the desired sum_of_pair
                for m, n in mydict[sum_of_pair]:

                    # check if pairs don't overlap, print and return them
                    if (m != i and n != j) and (n != i and n != j):
                        print('First Pair:', (myarr[i], myarr[j]))
                        print('Second Pair:', (myarr[m], myarr[n]))
                        return

            # We have a "return" in the previous condition (does not overlap ) so the control will get into this section
            # only if the above conditions is not true

            # Insert current pair into the dictionary
            mydict.setdefault(sum_of_pair, []).append((i, j))

    print('No non-overlapping pairs present')


# Driver Code
if __name__ == "__main__":
    myarr = [3, 4, 7, 3, 4]
    find_pairs(myarr)

Similar Problem Link:

]]>
131
Planning Trees from our hands https://blog.leonardtopno.com/planning-trees-from-our-hands/ Mon, 08 Aug 2022 09:22:47 +0000 https://bizbergthemes.com/green-globe/?p=38 Lorem Ipsum is simply dummy text of the printing and typesetting industry.

]]>
105
Plants Saving Life Providing Fresh https://blog.leonardtopno.com/plants-saving-life-providing-fresh/ Mon, 08 Aug 2022 09:21:03 +0000 https://bizbergthemes.com/green-globe/?p=35 Lorem Ipsum is simply dummy text of the printing and typesetting industry.

]]>
104
Love the nature green https://blog.leonardtopno.com/love-the-nature-green/ Mon, 08 Aug 2022 09:11:41 +0000 https://bizbergthemes.com/green-globe/?p=30 Lorem Ipsum is simply dummy text of the printing and typesetting industry.

]]>
102
3 Simple configuration set up to have your emails hosted at mail server other than your web server https://blog.leonardtopno.com/test-blog/ https://blog.leonardtopno.com/test-blog/#respond Thu, 24 Jun 2021 10:18:24 +0000 https://blog.leonardtopno.com/?p=5 You will need to deal with

A Record

MX Record

]]>
https://blog.leonardtopno.com/test-blog/feed/ 0 5
Hello world! https://blog.leonardtopno.com/hello-world/ https://blog.leonardtopno.com/hello-world/#comments Thu, 24 Jun 2021 10:13:43 +0000 https://blog.leonardtopno.com/?p=1 Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

]]>
https://blog.leonardtopno.com/hello-world/feed/ 1 1