#Enable Intel integrated GPUs on Linux systems
Several misconfigurations may stop a Linux machine from having access to its integrated Intel GPU devices. Let’s check the most common problems and how to fix them.
Several misconfigurations may stop a Linux machine from having access to its integrated Intel GPU devices. Let’s check the most common problems and how to fix them.
Cross-Origin Resource Sharing (a.k.a. CORS) is a powerful, and yet misunderstood, web standard for protecting web APIs from abuse. If you’re anything like me, however, you have had your fair share of wasted work hours trying to deal with it from time to time. The concept seems deceptively simple, but the devil is in the details.
If you’re using Cloudflare to protect HTTP endpoints, it might be worth it to block any web traffic that doesn’t come from their servers.
iptables is a Linux firewall tool that manages packet routing and can block or allow traffic based on rules like a packet’s origin or destination.
If you’re using Ingress Nginx to manage public endpoints, ModSecurity is already installed but disabled by default. To enable it, add the following to the ConfigMap ingress-nginx-controller:
Ideally, you would be able to open ports 80 and 443 of your public IP address and update DNS entries with solutions like ddclient or DNS-O-Matic.
We will use cert-manager to issue HTTPS certificates for domains served publicly by a Kubernetes cluster.
If you have either Python 2 or 3 installed, use the json.tool module to pretty-print.
Search recursively for file names using a regex pattern. Use -name for a case-sensitive search.
First, create the metrics API client.
Start by running kubectl proxy. This lets us avoid dealing with authentication headers.
Start the MongoDB daemon with the --replSet flag.
Get a nicely formatted list:
Let’s use iperf to measure networking performance. First, set up a “server” machine.
wipefs should work in most cases to clean up filesystems.
Unfortunately, SCP and rsync aren’t always an option to get our files out of a server. When FTP is all we have, wget can still do a pretty good job and won’t re-download files you already have, like a primitive rsync.
During site downtime, the following one-liner prints the current time and tries to access the given URL every 2 seconds. Only the received HTTP headers are shown.
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE
SHOW FULL PROCESSLIST;
## OR
mysqladmin -u$MYSQL_USER -p$MYSQL_PASSWORD processlistdu -ah / | sort -n -r | head -n 10docker run -it -v ${PWD}:/etc/letsencrypt --entrypoint="sh" certbot/certbot
certbot certonly -d <domain_name> --manual --preferred-challenges dns# Create the partition
parted --align optimal <raw_device>
mklabel msdos
mkpart primary ext4 0% 100%
quit
# Get the new partition device path
lsblk
# Make the filesystem
mkfs.ext4 <new_partition_device_path>
# Test the partition
mkdir /tmp/partition-test
mount -t ext4 <new_partition_device_path> /tmp/partition-test
# Get the UUID
blkid
# Edit the /etc/fstab to mount partition during boot
UUID=<uuid> /storage ext4 defaults,discard 0 2
## OR, if using XFS
UUID=<uuid> /storage xfs defaults 1 2psql -h $POSTGRES_HOST -U $POSTGRES_USER $POSTGRES_DB
\du # list all users
\l # list databases
\c # select a database
\d # list tables
\d+ <table_name> # describe table
\dx # list installed extensions
SELECT * FROM pg_available_extensions; # list extensions available on the server
CREATE EXTENSION IF NOT EXISTS <ext_name>; # install an extension
ALTER EXTENSION <ext_name> UPDATE TO 'new_version'; # upgrade an extension# Create the database dump on your server
docker exec <my_mongodb_container> mongodump --archive=/backups/mongodb-`date +%Y%m%d`.gz --gzip --db <database_name>
# Copy it to your local machine, if needed
scp -r <server_user>@<server_ip>:<remote_backup_path> <local_backup_path>
# Restore it directly into a running Docker container
zcat <backup_path> | docker exec -i <my_mongodb_container> mongorestore --archive --dropYou will need wp-cli for this.
rsync -avhP -e 'ssh -p <optional_server_port>' --info=progress2 <server_user>@<server_ip>:<path_to_be_copied> <destination_path>