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.
$ python -m SimpleHTTPServer 8000
# 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}' |
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 |
#!/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 |
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.
$ python -m SimpleHTTPServer 8000
import datetime | |
now = datetime.datetime.now() | |
print "Current date and time using str method of datetime object:" | |
print str(now) | |
print "Current date and time using instance attributes:" |
#!/usr/bin/python | |
import requests | |
import json | |
import re | |
url = "https://reqres.in/api/users" | |
querystring = { "demovar": "testvalue" } | |
headers = { 'auth': "FGtbAXGT4QbBLQj97j2P" } |