Skip to main content

Posts

how to setup password for an AWS EC2 running instance

The AWS EC2 Linux instance uses a .pem private key file to authenticate the default ubuntu user account. Let us learn about how to set up a password on your running EC2 instance, Prerequisites You have ec2 instance running You have root access to ec2 instance Step 1 Connect to your Linux ec2 instance via putty (/ssh). Step 2 Login to your running instance Step 3 Execute below command: sudo passwd ec2-user And write the password Step 4 Now it’s time to go to the directory /etc/ssh and follow below command sudo vim sshd_config Step 5 After you apply the command,  Press “i” and Now go to the “passwordauthentication” and write “yes” After change, it please save it Perfect Step 6 Last command is sudo service sshd restart and disconnect and login again using username and password 

How to debug Python code in VS Code with arguments passed from command line

 Debugging Python code in VS Code with arguments passed from the command line is a straightforward process. Here are the steps you can follow: 1. Open the Python file that you want to debug in VS Code. 2. Set breakpoints in the code where you want to pause and inspect variables. 3. Open the Debug panel in VS Code by clicking on the Debug icon in the Activity Bar or by pressing `Ctrl+Shift+D` on Windows or `Cmd+Shift+D` on Mac. 4. Click on the "create a launch.json file" button and select "Python" as the environment. 5. In the launch.json file that opens, modify the "args" attribute to include the command-line arguments you want to pass to the Python script. For example:    ```    "args": ["arg1", "arg2"]    ```    Replace "arg1" and "arg2" with the actual arguments you want to pass. NOTE: Add the below property in the launch.json file.     "purpose" : [ "debug-in-terminal" ] 6. Save the ...

Regular Expressions

Regular Expressions List of meta characters: . ---> Any one character ? ---> Zero or one + ---> One or more * ---> zero or more ^ ---> at the beginning of the string $ ---> at the end of the string [abc] ---> any one of a b c {m} ---> 'm' times {m,n} ---> at least m times, at most n times | ---> or \ ---> escape sequence character \s ---> a space \d ---> a digit \w ---> a word \b ---> a word boundary examples: \d ---> a single digit number (0 to 9) \d\d ---> a two digit number (0 to 99) \d\d\d ---> a three digit number (000 to 999) NOTE: ?, +, *, {} are used as Quantifiers (to represent quantity) \d{3} ---> same as above \d{3,5} ---> either 3 digit or 5 digit number hell?o ---> helo | hello hell+o ---> hello | helllo | helllllo | ... hrll*o ---> helo | hello | helllo | helllllo | ... he(ll)+o ---> hello | hellllo | hellllllo | ... S = "hi hello how are hello" hello ---> Yes ^hello ---> No h...

Go error: go : go.mod file not found in current directory or any parent directory; (working on GOPATH/src)

As of Go 1.16, the   GO111MODULE   environment variable is treated as "on" by default, meaning Go expects to find a   go.mod   file, and no longer falls back to pre-module   GOPATH   behavior. If you want to go back to the pre-1.16 behavior, you now have to explicitly specify  GO111MODULE=auto , but you're far better off creating a  go.mod  file. See  https://golang.org/doc/go1.16#go-command  and  https://golang.org/ref/mod Source - https://stackoverflow.com/questions/67929883/go-error-go-go-mod-file-not-found-in-current-directory-or-any-parent-director 

𝐈𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐐𝐮𝐞𝐬𝐭𝐢𝐨𝐧𝐬 | Amazon 2022

 Amidst the massive layoffs in Tech industry in these tough times, there are many of us preparing right now for interviews. LeetCode is a good source to look at the current level of questions. Below is the list of questions currently being asked by Amazon in the last 3 to 4 months. -- 𝐆𝐫𝐚𝐩𝐡𝐬 1) Process Ordering - https://lnkd.in/dN4ErKyE 2) Number of Islands - https://lnkd.in/dHQJGhPJ 3) k Jumps on Grid - https://lnkd.in/dKM_ETsM) -- 𝐓𝐫𝐢𝐞 1) Finding Prefix in Dictionary - https://lnkd.in/dpRvFDq5 -- 𝐓𝐫𝐞𝐞 1) Binary Tree Top Down View - https://lnkd.in/dmun-Pn3 2) Traversing binary tree in an outward manner. 3) Diameter of a binary tree [Path is needed] - https://lnkd.in/dH-w_DQV -- 𝐒𝐥𝐢𝐝𝐢𝐧𝐠 𝐰𝐢𝐧𝐝𝐨𝐰 1) Contains Duplicates III - https://lnkd.in/djcWHTaX 2) Minimum Window Substring [Variation of this question] - https://lnkd.in/dPfnQZmr -- 𝐋𝐢𝐧𝐤𝐞𝐝 𝐋𝐢𝐬𝐭 1) Reverse a Linked List II - https://lnkd.in/diHAJZUJ 2) Remove Loop From Linked List - https://lnkd...