Skip to content

Instantly share code, notes, and snippets.

View Navid-JL's full-sized avatar
📡

Navid Jalili Navid-JL

📡
View GitHub Profile
@Navid-JL
Navid-JL / notes.md
Created August 17, 2025 05:00 — forked from Delta456/notes.md
Fundamental of Backend Communications and Protocol

Fundamental of Backend Communications and Protocol

Design Patterns

Request - Response

Client sends a request, then server parses and then processes the request, finally send a response to the client, which parses it and consumes.

Where it is used?

  • Web, HTTP, DNS. SSH
  • RPC (Remote Procedure Call)
@Navid-JL
Navid-JL / how-to-ssh-into-windows.md
Created August 18, 2024 10:50 — forked from teocci/how-to-ssh-into-windows.md
How to SSH into Windows 10 or 11?

How to SSH into Windows 10 or 11?

The latest builds of Windows 10 and Windows 11 include a build-in SSH server and client that are based on OpenSSH. This means now you can remotely connect to Windows 10/11 or Windows Server 2019 using any SSH client, like Linux distros. Let's see how to configure OpenSSH on Windows 10 and Windows 11, and connect to it using Putty or any other SSH client.

OpenSSH is an open-source, cross-platform version of Secure Shell (SSH) that is used by Linux users for a long time. This project is currently ported to Windows and can be used as an SSH server on almost any version of Windows. In the latest versions of Windows Server 2022/2019 and Windows 11, OpenSSH is built-in to the operating system image.

@Navid-JL
Navid-JL / console-loading-animation.markdown
Last active May 16, 2024 11:06
console loading animation

console loading animation

Uses Jquery to write console-style output to pretend stuff is happening.

Code is a dmesg grabbed randomly from PasteBin.

A Pen by Andrew Tunnecliffe on CodePen.

License.

@Navid-JL
Navid-JL / main.py
Created March 4, 2024 09:30
Finding Palindromes
from requests import get
response = get("https://inventwithpython.com/dictionary.txt")
dictionary: list[str] = response.text.strip().split("\n")
palindromes: list[str] = []
for word in dictionary:
if word.lower()[:] == word.lower()[::-1]:
palindromes.append(word)
@Navid-JL
Navid-JL / script.py
Last active February 4, 2024 09:52
True Randomness
# Python 3.6 and later have the secrets module, which uses the operating system’s source of truly random numbers (often gathered from random events, such as the time between the user’s keystrokes). The function secrets.randbelow() can return truly random numbers between 0 and up to but not including the argument passed to it.
# The functions in secrets are slower than the functions in random, so the functions in random are preferred when true randomness is not needed. You can also use the secrets.choice() function, which returns a randomly chosen value from the string or list passed to it.
import secrets
def main() -> None:
secrets.randbelow(10)
secrets.choice(['cat', 'dog', 'mouse'])
secrets.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
if __name__ = "__main__":
@Navid-JL
Navid-JL / script.py
Created February 4, 2024 05:32
Euclid’s Algorithm for Finding the GCD
def gcd(a: int | float, b: int | float):
while a != 0:
a, b = b % a, a
return b
@Navid-JL
Navid-JL / output_example.txt
Created September 21, 2023 18:05
Directory Tree Generator
|--
| |-- main.py
| |-- script.ipynb
|-- .vscode
| |-- settings.json
|-- test
| |-- test.py
@Navid-JL
Navid-JL / script.py
Created December 17, 2022 10:58
Get the diagonal & secondary diagonal elements of a matrix and their sums
# Matrix
matrix = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
def print_primary_diagonal(matrix: list):
for i in range(0, len(matrix)):
@Navid-JL
Navid-JL / script.py
Last active February 4, 2024 10:58
A python script that extracts email addresses and phone numbers from a string in the clipboard memory
# Say you have the boring task of finding every phone number and email address in a long web page or document.
# If you manually scroll through the page, you might end up searching for a long time.
# But if you had a program that could search the text in your clipboard for phone numbers and email addresses, you could simply press ctrl-A to select all the text, press ctrl-C to copy it to the clipboard, and then run your program.
# It could replace the text on the clipboard with just the phone numbers and email addresses it finds.
import re
import pyperclip
EMAIL_REGEX = r"([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)"