Skip to content

Category: linux

Remove stylesheet.css from epub files with Linux

Problem:

I cannot use my own font when an open/not-DRM .epub has it’s own stylesheet being forced.

I have not tested this in DRM epubs. Though most modern ones will not have the stylesheet.css forced. So it should be fine.

Solution:

Remove the file using a zip application without extracting.

Script:

Move books to your Linux machine.

Install Zip: sudo pacman -S zip

Save this script as: remove_styles.sh

#!/bin/bash

for epub in *.epub; do
    echo "Processing: $epub"
    zip -d "$epub" "*stylesheet.css"
done

Change permissions: chmod +x remove_styles.sh

Run: ./remove_styles.sh

Copy books again to your device.

Firewall Management

Here’s a concise list of commands for managing firewalld on AlmaLinux:


Basic Commands

sudo systemctl start firewalld
sudo systemctl stop firewalld
sudo systemctl restart firewalld
sudo systemctl enable firewalld
sudo systemctl disable firewalld
sudo firewall-cmd --state

Managing Rules

sudo firewall-cmd --permanent --add-service=<service>
sudo firewall-cmd --permanent --remove-service=<service>
sudo firewall-cmd --permanent --add-port=<port>/tcp
sudo firewall-cmd --permanent --remove-port=<port>/tcp
sudo firewall-cmd --permanent --add-port=<xxx-yyy>/tcp
sudo firewall-cmd --permanent --add-port=<xxx-yyy>/udp
sudo firewall-cmd --reload

Viewing Configuration

sudo firewall-cmd --list-all
sudo firewall-cmd --list-ports
sudo firewall-cmd --list-services
sudo firewall-cmd --get-active-zones
sudo firewall-cmd --query-service=<service>
sudo firewall-cmd --query-port=<port>/tcp

Zone Management

sudo firewall-cmd --get-zones
sudo firewall-cmd --permanent --zone=<zone> --add-service=<service>
sudo firewall-cmd --permanent --zone=<zone> --remove-service=<service>
sudo firewall-cmd --permanent --zone=<zone> --add-port=<port>/tcp
sudo firewall-cmd --permanent --zone=<zone> --remove-port=<port>/tcp

Direct Rules (Advanced)

sudo firewall-cmd --direct --add-rule ipv4 filter INPUT <priority> -p tcp --dport <port> -j ACCEPT
sudo firewall-cmd --direct --remove-rule ipv4 filter INPUT <priority> -p tcp --dport <port> -j ACCEPT
sudo firewall-cmd --direct --list-all