Skip to content

Instantly share code, notes, and snippets.

View thesaadarshad's full-sized avatar
💭
おめでとう

saad. thesaadarshad

💭
おめでとう
View GitHub Profile
# Comprehensive Guide: TCP/IP, Networks, and Linux Commands
TCP/IP is the foundation of modern networking. This guide provides an in-depth explanation of its components, layers, and related Linux commands for system developers and network engineers.
---
## 1. TCP/IP Overview
TCP/IP (Transmission Control Protocol/Internet Protocol) is a suite of communication protocols used to interconnect network devices.
System Monitoring
top: Real-time process and resource usage.
Example: top
htop: Interactive process viewer.
Example: htop
vmstat: System performance (CPU, memory, I/O).
Example: vmstat 5 10
iostat: Disk I/O and CPU usage stats.
Example: iostat -x 1
# Linux Commands Cheat Sheet
| **Category** | **Command** | **Description** | **Example** |
|-----------------------|------------------|------------------------------------------------------|-----------------------------------------------|
| **Process Monitoring**| `top` | Display real-time CPU and memory usage of processes. | `top` |
| | `htop` | Interactive process viewer. | `htop` |
| **System Metrics** | `vmstat` | Report system performance (CPU, memory, I/O, etc.). | `vmstat 5 10` (Updates every 5 seconds, 10 times) |
| | `iostat` | Show CPU and disk I/O statistics. | `iostat -x 1` (Extended stats every second) |
| **Logs & Kernel** | `dmesg` | Display boot and kernel messages. | `dmesg
################################# KUBERNETES CHEAT SHEET #############################################
########### VIEWING RESOURCE INFORMATION ###############
# nodes
kubectl get no
kubectl get no -o wide
kubectl describe no
kubectl get no -o yaml
kubectl get node --selector=[label_name]
kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}'
@thesaadarshad
thesaadarshad / run.py
Last active September 18, 2022 10:04
pictures_downscale
from PIL import Image
import os
from pathlib import Path
import PIL
def convert(filepath,fixed_height=1200):
path = Path(filepath)
filename = filepath.split("/")[-1:][0]
newfilebasefolder = path.parent.absolute()
newfilename = str(newfilebasefolder)+"/"+filename
@thesaadarshad
thesaadarshad / run.py
Created January 26, 2020 19:22
python image resize with ratio
#!/usr/bin/env python
import PIL
from PIL import Image
import os, sys
mywidth = 1200
path = "/pathtofolder/"
dirs = os.listdir( path )
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/0AC9TYx37Mdg8yi8Uju1s3tW1a5mkc9MxSICVCFYAyEhUcCclVJ9qZtpLj98I0xV6FMTeMpb7XH1m2jQfhNYL/RMHQBsrZ7D7ey/hYx+7jKImS66MCFH4KPfpJGCaDxnAqYz0Bjbb7+9EHgVo0DV/B/xQ6yyhLYVMpDOdmbDrfyBcD3modsecaSllIHnkNdcX3yklVnbwxyNjfBKNoVbZBanFIofr5Me+/uFKKAkLHbCiUkFTjTE2NxsWiHTQCE7Nfm9/ZHvBQGZAmlmP4ZCIYAspgO0MPjoz8kUWXXtm0ZewSu22NAHxHZNs8hVT7/aFC5NGIApv5E5JKawbNk9 root@saadmachine
@thesaadarshad
thesaadarshad / web-servers.md
Created December 24, 2018 13:16 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@thesaadarshad
thesaadarshad / datetime.py
Last active March 31, 2018 15:01
python datetime
import datetime
now = datetime.datetime.now()
print
print "Current date and time using str method of datetime object:"
print str(now)
print
print "Current date and time using instance attributes:"
@thesaadarshad
thesaadarshad / python-requests.py
Last active March 28, 2018 08:40
Python Curl Request Json
#!/usr/bin/python
import requests
import json
import re
url = "https://reqres.in/api/users"
querystring = { "demovar": "testvalue" }
headers = { 'auth': "FGtbAXGT4QbBLQj97j2P" }