Check machine hardware information
lshw (List Hardware) command with root privileges to retrieve detailed information about the machine's hardware configuration.sudo lshwwebsite·Indexed 32 days ago
https://docs.dipak.tech/Searchable website documentation for Dipak from https://docs.dipak.tech/.
lshw (List Hardware) command with root privileges to retrieve detailed information about the machine's hardware configuration.sudo lshw-- List users and their attributes (superuser, create database)
SELECT usename AS role_name,
CASE
WHEN usesuper AND usecreatedb THEN
CAST('superuser, create database' AS pg_catalog.text)
WHEN usesuper THEN
CAST('superuser' AS pg_catalog.text)
WHEN usecreatedb THEN
CAST('create database' AS pg_catalog.text)
ELSE
CAST('' AS pg_catalog.text)
END role_attributes
FROM pg_catalog.pg_user
ORDER BY role_name desc;
-- Check active connections to the PostgreSQL server
select pid as process_id,
usename as username,
datname as database_name,
client_addr as client_address,
application_name,
backend_start,
state,
state_change
from pg_stat_activity;# 1. Build the binary on a development machine
git clone https://github.com/cloudflare/cloudflared.git
cd cloudflared
GOOS=linux GOARCH=mips64 go build github.com/cloudflare/cloudflared/cmd/cloudflared
# 2. Transfer to router
scp cloudflared [router_username]@[router_ip]:/tmp/
# 3. Install on router via SSH
ssh [router_username]@[router_ip]
cd /tmp
sudo chown root:root cloudflared
sudo chmod +x cloudflared
sudo mv cloudflared /usr/bin/
# 4. Configure and Start
sudo mkdir /etc/cloudflared
sudo vi /etc/cloudflared/config.yml
# Add to config.yml:
# proxy-dns: true
# proxy-dns-upstream:
# - https://1.1.1.1/dns-query
# - https://1.0.0.1/dns-query
# proxy-dns-port: 8853
sudo /usr/bin/cloudflared service install [token-from-cloudflare]# 1. Scale the Portainer service to zero
docker service scale portainer_portainer=0
# 2. Run the reset helper using the service's data volume
docker run --rm -v portainer_portainer_data:/data portainer/helper-reset-password
# 3. Scale the service back to 1
docker service scale portainer_portainer=1mkeosimg script requires specific command-line utilities for disk partitioning and filesystem formatting. Ensure losetup, parted, mkfs.msdos, mkfs.ext3, tar, and dd are available.sudo apt update
sudo apt install -y parted e2fsprogs dosfstoolsFor a deep clean of a node previously running Rancher, use an extended cleanup approach. This involves unmounting kubelet paths, deleting CNI network interfaces, and optionally flushing iptables rules.
Warning: This process is destructive. Backup your data before proceeding. To flush iptables, pass the flush argument to the script.
#!/bin/bash
# Usage: ./extended-cleanup-rancher2.sh [flush]
# Remove all docker resources
docker rm -f $(docker ps -qa)
docker rmi -f $(docker images -q)
docker volume rm $(docker volume ls -q)
# Unmount kubelet and rancher paths
for mount in $(mount | grep '/var/lib/kubelet' | awk '{ print $3 }') /var/lib/kubelet /var/lib/rancher; do
umount $mount
done
# Remove system directories
cleanupdirs="/etc/ceph /etc/cni /etc/kubernetes /opt/cni /opt/rke /run/secrets/kubernetes.io /run/calico /run/flannel /var/lib/calico /var/lib/etcd /var/lib/cni /var/lib/kubelet /var/lib/rancher/rke/log /var/log/containers /var/log/pods /var/run/calico"
for dir in $cleanupdirs; do
rm -rf $dir
done
# Delete network interfaces
cleanupinterfaces="flannel.1 cni0 tunl0"
for interface in $cleanupinterfaces; do
ip link delete $interface
done
# Optional: Flush iptables
if [ "$1" = "flush" ]; then
iptables -F -t nat
iptables -X -t nat
iptables -F -t mangle
iptables -X -t mangle
iptables -F
iptables -X
service docker restart
fiqemu-guest-agent package and manage its lifecycle using systemctl. This allows the host to perform tasks like graceful shutdowns and freezing the filesystem for backups.# Install the package
apt -y install qemu-guest-agent
# Enable the service to start on boot
systemctl enable qemu-guest-agent
# Start the service immediately
systemctl start qemu-guest-agent
# Verify the service is running
systemctl status qemu-guest-agent# 1. Enter privileged mode
enable
# 2. Enter global configuration mode
configure terminal
# 3. Create a standard access list
ip access-list standard my-access-list
# 4. Add entries (Permit/Deny)
permit host 192.168.1.10
deny host 192.168.1.20
# Deny a range using wildcard mask (e.g., 10.10.10.1/29)
deny 10.10.10.1 0.0.0.7
# 5. Apply to an interface (e.g., GigabitEthernet 0/1)
interface GigabitEthernet 0/1
ip access-group my-access-list in
exit
# 6. Save changes
exit
write memory
# OR
copy running-config startup-configIn multi-monitor setups, the macOS Dock may jump between screens. This is a built-in feature: you can move the Dock to a specific monitor by moving the mouse cursor to the center of that screen and continuing to move it downward against the bottom edge for 2-4 seconds.
Alternatively, you can prevent the Dock from moving by disabling 'Displays have separate Spaces' in Mission Control settings, though this removes the ability to have independent desktops/spaces for each monitor.
openssl rsa -in key.pem -out id_rsasudo, add your user to the docker group. Note that the docker group grants privileges equivalent to the root user. After running these commands, log out and log back in for the changes to take effect.sudo groupadd docker
sudo usermod -aG docker $USER