Posts

Showing posts from September, 2024

DMARC, SPF, DKIM for sendmail on linux

To create DMARC, SPF, and DKIM records for your domain, you'll need to configure the DNS TXT entries for each. Here's how to do it: 1. SPF Record The SPF record helps to identify which mail servers are allowed to send email on behalf of your domain. Step-by-Step: Login to your DNS provider's management panel. Add a new DNS TXT record with the following value: v=spf1 a mx ip4:< myserver.net > -all 2. DMARC Record DMARC tells mail servers how to handle emails that fail SPF or DKIM checks. Step-by-Step: Add a DNS TXT record with the following value: v=DMARC1; p=none; rua=mailto:postmaster@myserver.net; ruf=mailto:postmaster@myserver.net; sp=none; aspf=r; This record means that DMARC is set to "none" (no enforcement). You can change p=none to p=quarantine or p=reject once you are confident your setup is working. 3. DKIM If you haven't installed OpenDKIM, do so: sudo apt-get update sudo apt-get install opendkim opendkim-tools Next, generate your DKIM key p...

Enable Anydesk on Linux

 By default, Anydesk doesn't work on Ubuntu as it uses a different display server than what is expected by Anydesk (it expects the traditional X11 rather than Wayland). Dump this into a file, say, "fix_anydesk.sh", and then run it with sudo bash fix_anydesk.sh The script: #!/bin/bash # Check if the user has root privileges if [[ $EUID -ne 0 ]]; then    echo "This script must be run as root"     exit 1 fi # Backup the GDM configuration file GDM_CONFIG="/etc/gdm3/custom.conf" if [[ -f "$GDM_CONFIG" ]]; then     cp "$GDM_CONFIG" "$GDM_CONFIG.bak"     echo "Backup of custom.conf created." else     echo "GDM configuration file not found."     exit 1 fi # Disable Wayland by uncommenting and setting the 'WaylandEnable' option to false sed -i 's/#WaylandEnable=false/WaylandEnable=false/' "$GDM_CONFIG" # Inform the user echo "Wayland has been disabled. The system will use X11 inste...

folderizer

 This script moves large numbers of files into subfolders sorted alphabetically. #!/bin/bash # Create folders for letters and numbers for letter in {A..Z}; do   mkdir -p "$letter" done for num in {1..9}; do   mkdir -p "$num" done # Create a folder for punctuation-based files mkdir -p "M" # Function to handle files starting with a punctuation mark handle_punctuation() {   for file in *; do     if [[ -f $file ]]; then       first_char="${file:0:1}"       if [[ $first_char =~ [[:punct:]] ]]; then         new_name="_${file}"         mv "$file" "$new_name"         first_char="${new_name:0:1}"         if [[ $first_char =~ [[:digit:]] ]]; then           mv "$new_name" "$first_char/"         elif [[ $first_char =~ [A-Za-z] ]]; then           # Normalize to uppercase for letter folders ...

A script to turn unencrypted epub files into plain text, bash

 #!/bin/bash # Check if a directory is provided if [ "$#" -ne 1 ]; then     echo "Usage: $0 <path-to-directory>"     exit 1 fi DIRECTORY="$1" # Check if the provided argument is a directory if [ ! -d "$DIRECTORY" ]; then     echo "The specified path is not a directory."     exit 1 fi # Process each EPUB file in the directory find "$DIRECTORY" -type f -name "*.epub" | while IFS= read -r EPUB_FILE; do     # Extract the base name without the extension     BASE_NAME=$(basename "$EPUB_FILE" .epub)     TEXT_FILE="$DIRECTORY/${BASE_NAME}.txt"     echo "Processing $EPUB_FILE"          # Create a temporary directory to extract the EPUB file     TEMP_DIR=$(mktemp -d)     echo "Extracting EPUB file to $TEMP_DIR"          # Unzip the EPUB file into the temporary directory     unzip -q "$EPUB_FILE" -d "$TEMP_DIR"    ...