Image to PDF with OCR on Fedora Linux

sudo dnf install ocrmypdf tesseract tesseract-langpack-eng tesseract-langpack-fas ImageMagick

Convert to PDF, enhance clarity (e.g., for OCR), add filters:

magick 01.jpeg \
  -resize 200% \
  -colorspace Gray \
  -sharpen 0x1 \
  -contrast-stretch 0 \
  -threshold 50% \
  cleaned.pdf

Or for OCR preprocessing (especially with Tesseract):

magick 01.jpeg \
  -resize 300% \
  -colorspace Gray \
  -normalize \
  -sharpen 0x1 \
  cleaned.pdf

Then apply OCR:

ocrmypdf -l eng+fas cleaned.pdf output.pdf

 

Optimize Kernel Configuration for Fedora

sudo nano /etc/sysctl.d/99-custom.conf
vm.swappiness=10
vm.dirty_ratio=15
vm.dirty_background_ratio=5
kernel.sched_migration_cost_ns=5000000
sudo sysctl --system
sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mitigations=off noibrs noibpb nospec_store_bypass_disable nopti zswap.enabled=1 zswap.compressor=lz4 zswap.max_pool_percent=25"
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo systemctl enable --now fstrim.timer
sudo journalctl --vacuum-size=100M

 

Set Permanently ulimit -n open files in Fedora

sudo nano /etc/security/limits.d/99-openfiles.conf
* soft    nofile  65536
* hard    nofile  1048576
sudo nano /etc/systemd/system.conf
[Manager]
# Set soft:hard limits
DefaultLimitNOFILE=65536:1048576
# Or set both soft and hard to the same value
# DefaultLimitNOFILE=65536
sudo nano /etc/systemd/user.conf
[Manager]
# Set soft:hard limits
DefaultLimitNOFILE=65536:1048576
# Or set both soft and hard to the same value
# DefaultLimitNOFILE=65536
sudo systemctl daemon-reexec
sysctl fs.file-max
sudo nano /etc/sysctl.d/99-filemax.conf
fs.file-max = <larger_value>
sudo sysctl -p /etc/sysctl.d/99-filemax.conf
# Or apply all sysctl settings: sudo sysctl -p

 

Increase max_user_watches on Fedora Linux

Check current value:

cat /proc/sys/fs/inotify/max_user_watches

Temporarily change the value:
This change will reset after reboot.

sudo sysctl fs.inotify.max_user_watches=524288

Permanently change the value:
Edit or create the config file:

sudo nano /etc/sysctl.d/99-inotify.conf

Add the following line (or update if it already exists):

fs.inotify.max_user_watches=524288

Apply changes:

sudo sysctl -p /etc/sysctl.d/99-inotify.conf

Verify:

cat /proc/sys/fs/inotify/max_user_watches

 

 

Set Battery Charge Limit in Fedora

sudo nano /etc/systemd/system/battery-charge-threshold.service
[Unit]
Description=Set battery charge threshold to 60%
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c 'echo 60 > /sys/class/power_supply/BAT0/charge_control_end_threshold'
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now battery-charge-threshold.service

 

Install Android ADB on Fedora Linux

sudo dnf install android-tools

Create a plugdev group (if it doesn’t already exist) and add the user to it:

sudo groupadd plugdev
sudo usermod -aG plugdev $LOGNAME

Log out and log back in for the group change to take effect. Use the id command to verify that you are in the plugdev group:

id

Identify the Vendor ID:

Connect your Android device to your computer and run the following command to identify the vendor ID:

lsusb

Look for the line that corresponds to your Android device. The vendor ID is the first part of the ID after ID, for example, 18d1 for Google.

Create a udev Rule:

Create a file for the udev rule:

sudo nano /etc/udev/rules.d/51-android.rules

Add the Following Content:

In the file, add a rule to grant the necessary permissions. Replace YOUR-VENDOR-ID with your device’s vendor ID. Here’s an example rule:

SUBSYSTEM=="usb", ATTR{idVendor}=="YOUR-VENDOR-ID", MODE="0666", GROUP="plugdev"

For example, if the vendor ID is 18d1 (Google):

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"

Change File Permissions:

Change the permissions of the file to make it readable:

sudo chmod a+r /etc/udev/rules.d/51-android.rules

Reload udev rules:

sudo udevadm control --reload-rules
sudo udevadm trigger

Restart your machine.

Check ADB Devices:

Verify that your device is recognized correctly:

adb devices

References
https://developer.android.com/studio/run/device

Fedora 40 Post Install

Making dnf a little faster

sudo nano /etc/dnf/dnf.conf
max_parallel_downloads=8

Firmware

sudo fwupdmgr get-devices 
sudo fwupdmgr refresh --force 
sudo fwupdmgr get-updates 
sudo fwupdmgr update

Media Codecs

sudo dnf groupupdate 'core' 'multimedia' 'sound-and-video' --setopt='install_weak_deps=False' --exclude='PackageKit-gstreamer-plugin' --allowerasing && sync
sudo dnf swap 'ffmpeg-free' 'ffmpeg' --allowerasing
sudo dnf install gstreamer1-plugins-{bad-\*,good-\*,base} gstreamer1-plugin-openh264 gstreamer1-libav --exclude=gstreamer1-plugins-bad-free-devel ffmpeg gstreamer-ffmpeg
sudo dnf install lame\* --exclude=lame-devel
sudo dnf group upgrade --with-optional Multimedia

H/W Video Acceleration

sudo dnf install ffmpeg ffmpeg-libs libva libva-utils
sudo dnf swap libva-intel-media-driver intel-media-driver --allowerasing

Set Hostname

hostnamectl set-hostname YOUR_HOSTNAME

Disable Mitigations

sudo grubby --update-kernel=ALL --args="mitigations=off"

Modern Standby

sudo grubby --update-kernel=ALL --args="mem_sleep_default=s2idle"

Enable nvidia-modeset

sudo grubby --update-kernel=ALL --args="nvidia-drm.modeset=1"

Disable NetworkManager-wait-online.service

sudo systemctl disable NetworkManager-wait-online.service

Disable SELinux

sudo grubby --update-kernel ALL --args selinux=0
sudo nano /etc/selinux/config
SELINUX=disabled

References
https://github.com/devangshekhawat/Fedora-40-Post-Install-Guide