Skip to content

Commit e525778

Browse files
authored
Add files via upload
1 parent 6010cf5 commit e525778

File tree

2 files changed

+215
-0
lines changed

2 files changed

+215
-0
lines changed

linux-basics (1).py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
from tabulate import tabulate
2+
import time
3+
from rich.console import Console
4+
console = Console()
5+
console.clear()
6+
print(r"""Developed By:
7+
__ ___ ______ _ _ ______ ___
8+
/_ | |__ \ |____ | | || | |____ | / _ \
9+
| | ) | / / | || |_ / / | (_) |
10+
| | / / / / |__ _| / / > _ <
11+
| | / /_ / / _ | | _ / / _ | (_) |
12+
|_| |____| /_/ (_) |_| (_) /_/ (_) \___/""")
13+
time.sleep(2.5)
14+
def print_command_info():
15+
commands = [
16+
("ssh", "Secure Shell; used to securely connect to a remote server or machine."),
17+
("ls", "Lists the contents of a directory."),
18+
("pwd", "Prints the working directory; shows the current directory path."),
19+
("cd", "Changes the current directory."),
20+
("touch", "Creates an empty file or updates the timestamp of an existing file."),
21+
("echo", "Displays a line of text or variable value to the terminal."),
22+
("nano", "A simple text editor for editing files directly from the terminal."),
23+
("vim", "A highly configurable text editor with powerful features."),
24+
("cat", "Concatenates and displays file contents."),
25+
("shred", "Overwrites a file multiple times to securely delete it."),
26+
("mkdir", "Creates a new directory."),
27+
("cp", "Copies files or directories from one location to another."),
28+
("rm", "Removes (deletes) files or directories."),
29+
("rmdir", "Removes empty directories."),
30+
("ln", "Creates hard or symbolic links to files or directories."),
31+
("clear", "Clears the terminal screen."),
32+
("whoami", "Displays the current user’s username."),
33+
("useradd", "Adds a new user to the system."),
34+
("sudo", "Executes a command with superuser (root) privileges."),
35+
("adduser", "Adds a new user and sets up their account."),
36+
("su", "Switches the current user to another user, typically the root user."),
37+
("exit", "Exits the current shell or terminal session."),
38+
("passwd", "Changes the password for a user account."),
39+
("apt", "Package management command used to handle packages in Debian-based systems."),
40+
("finger", "Displays information about users on the system."),
41+
("man", "Displays the manual page for a command."),
42+
("whatis", "Provides a short description of a command or function."),
43+
("curl", "Transfers data from or to a server using various protocols (e.g., HTTP, FTP)."),
44+
("zip", "Compresses files into a ZIP archive."),
45+
("unzip", "Extracts files from a ZIP archive."),
46+
("less", "Views file contents one screen at a time, allowing backward and forward navigation."),
47+
("head", "Displays the first few lines of a file."),
48+
("tail", "Displays the last few lines of a file."),
49+
("cmp", "Compares two files byte by byte."),
50+
("diff", "Compares files line by line and shows differences."),
51+
("sort", "Sorts lines of text files."),
52+
("find", "Searches for files and directories in a directory hierarchy."),
53+
("chmod", "Changes the permissions of a file or directory."),
54+
("chown", "Changes the ownership of a file or directory."),
55+
("ifconfig", "Displays or configures network interface parameters (older tool, often replaced by ip)."),
56+
("ip address", "Displays or configures IP addresses on network interfaces."),
57+
("grep", "Searches for patterns within files."),
58+
("awk", "A powerful text processing and data extraction tool."),
59+
("resolvectl status", "Displays the status of DNS resolver."),
60+
("ping", "Tests network connectivity to a host."),
61+
("netstat", "Displays network connections, routing tables, and network statistics."),
62+
("ss", "Provides detailed information about network sockets."),
63+
("iptables", "Configures IP packet filtering rules (used for setting up firewalls)."),
64+
("ufw", "Uncomplicated Firewall; simplifies firewall management on Linux systems."),
65+
("uname", "Displays system information, such as the kernel version and architecture."),
66+
("neofetch", "Displays system information and statistics in a visually appealing way."),
67+
("cal", "Displays a calendar."),
68+
("free", "Shows memory usage, including total, used, and available memory."),
69+
("df", "Displays disk space usage for file systems."),
70+
("ps", "Displays information about running processes."),
71+
("top", "Provides a real-time view of system processes and resource usage."),
72+
("htop", "An interactive process viewer with a more user-friendly interface compared to top."),
73+
("kill", "Sends a signal to terminate a process."),
74+
("pkill", "Sends a signal to terminate processes based on name or other attributes."),
75+
("systemctl", "Controls and manages systemd services and the system state."),
76+
("history", "Shows the command history of the terminal session."),
77+
("reboot", "Restarts the system."),
78+
("shutdown", "Shuts down the system.")
79+
]
80+
81+
headers = ["Command", "Description"]
82+
table = tabulate(commands, headers=headers, tablefmt="grid")
83+
84+
print(table)
85+
input("Press Enter to exit...")
86+
87+
if __name__ == "__main__":
88+
print_command_info()

youtube (1).py

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
from googleapiclient.discovery import build
2+
from tabulate import tabulate
3+
import subprocess
4+
import sys
5+
import time
6+
print("""Hey if error occured please make sure to restart the program once excecuted.""")
7+
# Function to check and install required packages
8+
def install_package(package):
9+
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
10+
11+
# Check if 'tabulate' is installed
12+
try:
13+
from googleapiclient.discovery import build
14+
except ImportError:
15+
print("The 'tabulate' package is not installed. Installing now...")
16+
install_package("googleapiclient.discovery")
17+
from googleapiclient.discovery import build
18+
19+
from rich.console import Console
20+
21+
console = Console()
22+
console.clear()
23+
24+
print(r"""Developed By:
25+
__ ___ ______ _ _ ______ ___
26+
/_ | |__ \ |____ | | || | |____ | / _ \
27+
| | ) | / / | || |_ / / | (_) |
28+
| | / / / / |__ _| / / > _ <
29+
| | / /_ / / _ | | _ / / _ | (_) |
30+
|_| |____| /_/ (_) |_| (_) /_/ (_) \___/
31+
32+
""")
33+
time.sleep(2.5)
34+
35+
# Set up YouTube API client
36+
api_key = 'AIzaSyC5Hya2kQeWjpx9B_-nWQaE6iq_5wU_ywQ' # Replace with your API key
37+
youtube = build('youtube', 'v3', developerKey=api_key)
38+
39+
def get_video_details(video_id):
40+
# Retrieve video details including description
41+
request = youtube.videos().list(
42+
part='snippet',
43+
id=video_id
44+
)
45+
response = request.execute()
46+
video = response['items'][0]['snippet']
47+
description = video['description']
48+
return description
49+
50+
def get_video_comments(video_id):
51+
# Retrieve comments from the video
52+
comments = []
53+
request = youtube.commentThreads().list(
54+
part='snippet',
55+
videoId=video_id,
56+
textFormat='plainText'
57+
)
58+
response = request.execute()
59+
for item in response['items']:
60+
comment = item['snippet']['topLevelComment']['snippet']['textDisplay']
61+
comments.append(comment)
62+
return comments
63+
64+
def analyze_comments(comments):
65+
# Basic comment analysis
66+
word_count = sum(len(comment.split()) for comment in comments)
67+
comment_count = len(comments)
68+
return {
69+
'total_comments': comment_count,
70+
'total_words': word_count
71+
}
72+
73+
def print_table(title, data):
74+
print(f"\n{title}")
75+
print(tabulate(data, headers='keys', tablefmt='fancy_grid'))
76+
77+
def main_menu():
78+
print("\nYouTube Video Analysis")
79+
print("1. Get Video Description")
80+
print("2. Get Video Comments")
81+
print("3. Analyze Comments")
82+
print("4. Exit")
83+
84+
if __name__ == '__main__':
85+
print(r"""Well hi...!!!
86+
87+
This tool is used to check the number of comments with simople python program with google API's
88+
here this can check
89+
1. Youtube descriptions
90+
2. Comments
91+
92+
and it will ask now to enter the ID:.....
93+
94+
in this youtube link below
95+
https://www.youtube.com/watch?v=YOUTUBE-ID/
96+
97+
the 'YOUTUBE-ID' is the ID
98+
copy that <id> and paste when it asks
99+
100+
hope you enjoy Thank you😃
101+
""")
102+
time.sleep(2.5)
103+
104+
video_id = input("Enter Video ID: ").strip()
105+
106+
while True:
107+
main_menu()
108+
choice = input("Choose an option (1-4): ").strip()
109+
110+
if choice == '1':
111+
description = get_video_details(video_id)
112+
description_data = [{'Description': description}]
113+
print_table("Video Description", description_data)
114+
elif choice == '2':
115+
comments = get_video_comments(video_id)
116+
comments_data = [{'Comment': comment} for comment in comments]
117+
print_table("Comments", comments_data)
118+
elif choice == '3':
119+
comments = get_video_comments(video_id)
120+
analysis = analyze_comments(comments)
121+
analysis_data = [{'Total Comments': analysis['total_comments'], 'Total Words': analysis['total_words']}]
122+
print_table("Comments Analysis", analysis_data)
123+
elif choice == '4':
124+
print("Exiting...")
125+
break
126+
else:
127+
print("Invalid option, please try again.")

0 commit comments

Comments
 (0)