Jump to content

Blogs

Our community blogs

  1. Understanding how a regex engine processes patterns can significantly improve your ability to write efficient and accurate regular expressions. By learning the internal mechanics, you’ll be better equipped to troubleshoot and refine your regex patterns, reducing frustration and guesswork when tackling complex tasks.


    Types of Regex Engines

    There are two primary types of regex engines:

    1. Text-Directed Engines (also known as DFA - Deterministic Finite Automaton)
    2. Regex-Directed Engines (also known as NFA - Non-Deterministic Finite Automaton)

    All the regex flavors discussed in this tutorial utilize regex-directed engines. This type is more popular because it supports features like lazy quantifiers and backreferences, which are not possible in text-directed engines.

    Examples of Text-Directed Engines:

    • awk
    • egrep
    • flex
    • lex
    • MySQL
    • Procmail

    Note: Some versions of awk and egrep use regex-directed engines.

    How to Identify the Engine Type

    To determine whether a regex engine is text-directed or regex-directed, you can apply a simple test using the pattern:

    «regex|regex not»
    

    Apply this pattern to the string "regex not":

    • If the result is "regex", the engine is regex-directed.
    • If the result is "regex not", the engine is text-directed.

    The difference lies in how eager the engine is to find matches. A regex-directed engine is eager and will report the leftmost match, even if a better match exists later in the string.


    The Regex-Directed Engine Always Returns the Leftmost Match

    A crucial concept to grasp is that a regex-directed engine will always return the leftmost match. This behavior is essential to understand because it affects how the engine processes patterns and determines matches.

    How It Works

    When applying a regex to a string, the engine starts at the first character of the string and tries every possible permutation of the regex at that position. If all possibilities fail, the engine moves to the next character and repeats the process.

    For example, consider applying the pattern «cat» to the string:

    "He captured a catfish for his cat."
    

    Here’s a step-by-step breakdown:

    1. The engine starts at the first character "H" and tries to match "c" from the pattern. This fails.
    2. The engine moves to "e", then space, and so on, failing each time until it reaches the fourth character "c".
    3. At "c", it tries to match the next character "a" from the pattern with the fifth character of the string, which is "a". This succeeds.
    4. The engine then tries to match "t" with the sixth character, "p", but this fails.
    5. The engine backtracks and resumes at the next character "a", continuing the process.
    6. Finally, at the 15th character in the string, it matches "c", then "a", and finally "t", successfully finding a match for "cat".

    Key Point

    The engine reports the first valid match it finds, even if a better match could be found later in the string. In this case, it matches the first three letters of "catfish" rather than the standalone "cat" at the end of the string.


    Why?

    At first glance, the behavior of the regex-directed engine may seem similar to a basic text search routine. However, as we introduce more complex regex tokens, you’ll see how the internal workings of the engine have a profound impact on the matches it returns.

    Understanding this behavior will help you avoid surprises and leverage the full power of regex for more effective and efficient text processing.

  2. by: Abhishek Prakash


    FOSS Weekly #25.02: Absolute Linux, ShredOS, AI in Kdenlive, Fossify File Manager and More

    The holidays are over and so do the Tuxmas Days. 12 days of 12 new features, changes and announcements.

    As mentioned on Tuxmas Day 11, It's FOSS Lifetime membership now also gets you lifetime Reader-level membership of Linux Handbook, our other portal focused on sysadmin, DevOps and self-hosting.

    If you are one of the 73 people (so far) who opted for the Lifetime plan, you'll get a separate email on Linux Handbook's membership. Meanwhile, please download the 'Linux for DevOps' book for free as part of your Plus membership.

    Please note that this combined benefit of free lifetime Linux Handbook Reader level membership (usually costs $18 per year) is only available till 11th January. Thereafter, it will cost $99 and won't include Linux Handbook's membership. Get the additional advantage before the time runs out.

    💬 Let's see what else you get in this edition

    • SteamOS rolling out
    • Kdenlive working on a new AI-powered feature.
    • Nobara being the first one to introduce a release in 2025.
    • And other Linux news, videos and, of course, memes!

    📰 Linux and Open Source News

    Did you know there is a dedicated Linux distribution for wiping disks?

    ShredOS is a Linux Distro Built to Wipe Your Data
    A Linux distro built to help you destroy data. Sounds pretty cool!
    FOSS Weekly #25.02: Absolute Linux, ShredOS, AI in Kdenlive, Fossify File Manager and More

    🧠 What We’re Thinking About

    Sourav switched to Proton VPN after going through many other VPN services, here's what he thinks of it:

    I Switched to Proton VPN and Here’s What I Honestly Think About It
    Proton VPN is an impressive solution. Here’s my experience with it.
    FOSS Weekly #25.02: Absolute Linux, ShredOS, AI in Kdenlive, Fossify File Manager and More

    🧮 Linux Tips, Tutorials and More

    And an analogy to explain why there are so many Linux distributions.

    What is Linux? Why There are 100’s of Linux OS?
    Cannot figure out what is Linux and why there are so many of Linux? This analogy explains things in a simpler manner.
    FOSS Weekly #25.02: Absolute Linux, ShredOS, AI in Kdenlive, Fossify File Manager and More

    👷 Maker's and AI Corner

    Did you know you could run LLMs locally on a Raspberry Pi?

    How to Run LLMs Locally on Raspberry Pi Using Ollama AI
    Got a Raspberry Pi? How about using it ton run some LLMs using Ollama for your own private AI?
    FOSS Weekly #25.02: Absolute Linux, ShredOS, AI in Kdenlive, Fossify File Manager and More

    📹 Videos we are watching

    Do you really need a media server software?


    ✨ Apps of the Week

    Mullvad Browser is a very solid privacy-focused alternative to the likes of Google Chrome.

    Mullvad Browser: A Super Privacy-Focused Browser Based on Firefox
    Mullvad is Firefox, but enhanced for privacy, pretty interesting take as a cross-platform private browser app.
    FOSS Weekly #25.02: Absolute Linux, ShredOS, AI in Kdenlive, Fossify File Manager and More

    If you are looking for a change in file management on Android, then you could go for Fossify File Manager.


    🧩 Quiz Time

    Have some fun finding the logos of distros and open source projects.

    Spot All The Logos: Image Puzzle
    Let’s see if you can spot the hidden items in the image!
    FOSS Weekly #25.02: Absolute Linux, ShredOS, AI in Kdenlive, Fossify File Manager and More

    💡 Quick Handy Tip

    If you are a Xfce user with a multi-monitor setup, then you can span the Xfce panel across monitors. First, right-click on the panel you want to span and then go to Panel → Panel Preferences. Here, in the Display tab, set Output as Automatic and enable the “Span monitors” checkbox.

    FOSS Weekly #25.02: Absolute Linux, ShredOS, AI in Kdenlive, Fossify File Manager and More

    🤣 Meme of the Week

    The pain is real. 😥

    FOSS Weekly #25.02: Absolute Linux, ShredOS, AI in Kdenlive, Fossify File Manager and More

    🗓️ Tech Trivia

    Hitachi announced the first 1 MB memory chip on January 6, 1984. At the time, this was a revolutionary leap in storage technology. Today, we carry more memory in our pockets than entire systems from that era!


    🧑‍🤝‍🧑 FOSSverse Corner

    Pro FOSSer Neville shares his experience with Chimera Linux on virt-manager. This is a detailed write-up, so be prepared for a lengthy read.

    Chimera Linux in virt-manager with Plasma | Wayland | APK | Clang/LLVM | musl | dinit | BSD core tools
    Chimera Linux in virt-manager with Plasma and Wayland Want to try something really different? Chimera Linux have just released new images as of 4/12/24. Chimera is a new distro build from scratch using Linux kernel 6.12 core tools from FreeBSD apk package system from Alpine Clang/LLVM toolchain Musl C library Gnome and Plasma desktops with Wayland &/or X11 multiple architectures - Intel/AMD, ARM AArch64, POWER, and RISC-V the dinit init system A real mix. One could debate whether it is L…
    FOSS Weekly #25.02: Absolute Linux, ShredOS, AI in Kdenlive, Fossify File Manager and More

    ❤️ With love

    Share it with your Linux-using friends and encourage them to subscribe (hint: it's here).

    Share the articles in Linux Subreddits and community forums.

    Follow us on Google News and stay updated in your News feed.

    Opt for It's FOSS Plus membership and support us 🙏

    Keep on enjoying Linux in 2025 🐧

  3. by: Chris Coyier
    Mon, 06 Jan 2025 20:47:37 +0000


    Like Miriam Suzanne says:

    You’re allowed to have preferences. Set your preferences.

    I like the idea of controlling my own experience when browsing and using the web. Bump up that default font size, you’re worth it.

    Here’s another version of control. If you publish a truncated RSS feed on your site, but the site itself has more content, I reserve the right to go fetch that content and read it through a custom RSS feed. I feel like that’s essentially the same thing as if I had an elaborate user stylesheet that I applied just to that website that made it look how I wanted it to look. It would be weird to be anti user-stylesheet.

    I probably don’t take enough control over my own experience on sites, really. Sometimes it’s just a time constraint where I don’t have the spoons to do a bunch of customization. But the spoon math changes when it has to do with doing my job better.

    I was thinking about this when someone poked me that an article I published had a wrong link in it. As I was writing it in WordPress, somehow I linked the link to some internal admin screen URL instead of where I was trying to link to. Worse, I bet I’ve made that same mistake 10 times this year. I don’t know what the heck the problem is (some kinda fat finger issue, probably) but the same problem is happening too much.

    What can help? User stylesheets can help! I love it when CSS helps me do my job in weird subtle ways better. I’ve applied this CSS now:

    .editor-visual-editor a[href*="/wp-admin/"]::after {
      content: " DERP!";
      color: red;
    }

    That first class is just something to scope down the editor area in WordPress, then I select any links that have “wp-admin” in them, which I almost certainly do not want to be linking to, and show a visual warning. It’s a little silly, but it will literally work to stop this mistake I keep making.

    I find it surprising that only Safari has entirely native support for a linking up your own user CSS, but there are ways to do it via extension or other features in all browsers.


    Welp now that we’re talking about CSS I can’t help but share some of my favorite links in that area now.

    Dave put his finger on an idea I’m wildly jealous of: CSS wants to be a system. Yes! It so does! CSS wants to be a system! Alone, it’s just selectors, key/value pairs, and a smattering of other features. It doesn’t tell you how to do it, it is lumber and hardware saying build me into a tower! And also: do it your way! And the people do. Some people’s personality is: I have made this system, follow me, disciples, and embrace me. Other people’s personality is: I have also made a system, it is mine, my own, my prec… please step back behind the rope.

    Annnnnnd more.

    • CSS Surprise Manga Lines from Alvaro are fun and weird and clever.
    • Whirl: “CSS loading animations with minimal effort!” Jhey’s got 108 of them open sourced so far (like, 5 years ago, but I’m just seeing it.)
    • Next-level frosted glass with backdrop-filter. Josh covers ideas (with credit all the way back to Jamie Gray) related to the “blur the stuff behind it” look. Yes, backdrop-filter does the heavy lifting, but there are SO MANY DETAILS to juice it up.
    • Custom Top and Bottom CSS Container Masks from Andrew is a nice technique. I like the idea of a “safe” way to build non-rectangular containers where the content you put inside is actually placed safely.
  4. By: Joshua Njiru
    Wed, 11 Dec 2024 13:49:42 +0000


    change image dpiWhat is DPI and Why Does It Matter?

    DPI, or Dots Per Inch, is a critical measurement in digital and print imaging that determines the quality and clarity of your images. Whether you’re a photographer, graphic designer, or just someone looking to print high-quality photos, understanding how to change DPI is essential for achieving the best possible results.

    What are the Basics of DPI

    DPI refers to the number of individual dots that can be placed within a one-inch linear space. The higher the DPI, the more detailed and crisp your image will appear. Most digital images range from 72 DPI (standard for web) to 300 DPI (ideal for print).

    Top Methods to Change DPI in Linux

    1. ImageMagick: The Command-Line Solution

    ImageMagick is a powerful, versatile tool for image manipulation in Linux. Here’s how to use it:

    <span class="token"># Install ImageMagick</span>
    <span class="token">sudo</span> <span class="token">apt-get</span> <span class="token">install</span> imagemagick
     <span class="token"># For Debian/Ubuntu</span>
    <span class="token">sudo</span> dnf <span class="token">install</span> ImageMagick
     <span class="token"># For Fedora</span>

    # Change DPI of a single image
    convert input.jpg -density 300 output.jpg

    # Batch convert multiple images
    for file in *.jpg; do
    convert $file -density 300 “modified_${file}
    done

    2. GIMP: Graphical Image Editing

    For those who prefer a visual interface, GIMP offers an intuitive approach:

    1. Open your image in GIMP
    2. Go to Image > Print Size
    3. Adjust the X and Y resolution
    4. Save the modified image

    3. ExifTool: Precise Metadata Manipulation

    ExifTool provides granular control over image metadata:

    <span class="token"># Install ExifTool</span>
    <span class="token">sudo</span> <span class="token">apt-get</span> <span class="token">install</span> libimage-exiftool-perl
     
     <span class="token"># Debian/Ubuntu</span>
    <span class="token"># View current DPI</span>
    exiftool image.jpg <span class="token">|</span> <span class="token">grep</span> <span class="token">"X Resolution"</span>
    <span class="token"># Change DPI</span>
    exiftool -XResolution<span class="token">=</span><span class="token">300</span> -YResolution<span class="token">=</span><span class="token">300</span> image.jpg

    4. Python Scripting: Automated DPI Changes

    For developers and automation enthusiasts:

    <span class="token">from</span> PIL <span class="token">import</span> Image
    <span class="token">import</span> os
    <span class="token">    def</span> <span class="token">change_dpi</span><span class="token">(</span>input_path<span class="token">,</span> output_path<span class="token">,</span> dpi<span class="token">)</span><span class="token">:</span>
              

     <span class="token">with</span> Image<span class="token">.</span><span class="token">open</span><span class="token">(</span>input_path<span class="token">)</span> <span class="token">as</span> img<span class="token">:</span>
                      

     img<span class="token">.</span>save<span class="token">(</span>output_path<span class="token">,</span> dpi<span class="token">=</span><span class="token">(</span>dpi<span class="token">,</span> dpi<span class="token">)</span><span class="token">)</span>
    <span class="token"># Batch process images</span>
    input_directory <span class="token">=</span> <span class="token">'./images'</span>
    output_directory <span class="token">=</span> <span class="token">'./modified_images'</span>
    os<span class="token">.</span>makedirs<span class="token">(</span>output_directory<span class="token">,</span> exist_ok<span class="token">=</span><span class="token">True</span><span class="token">)</span>
    <span class="token">for</span> filename <span class="token">in</span> os<span class="token">.</span>listdir<span class="token">(</span>input_directory<span class="token">)</span><span class="token">:</span>
         

        <span class="token">if</span> filename<span class="token">.</span>endswith<span class="token">(</span><span class="token">(</span><span class="token">'.jpg'</span><span class="token">,</span> <span class="token">'.png'</span><span class="token">,</span> <span class="token">'.jpeg'</span><span class="token">)</span><span class="token">)</span><span class="token">:</span>
         

            input_path <span class="token">=</span> os<span class="token">.</span>path<span class="token">.</span>join<span class="token">(</span>input_directory<span class="token">,</span> filename<span class="token">)</span>
         

            output_path <span class="token">=</span> os<span class="token">.</span>path<span class="token">.</span>join<span class="token">(</span>output_directory<span class="token">,</span> filename<span class="token">)</span>
         

            change_dpi<span class="token">(</span>input_path<span class="token">,</span> output_path<span class="token">,</span> <span class="token">300</span><span class="token">)</span>

    Important Considerations When Changing DPI

    • Increasing DPI doesn’t automatically improve image quality
    • Original image resolution matters most
    • For printing, aim for 300 DPI
    • For web use, 72-96 DPI is typically sufficient
    • Large increases in DPI can result in blurry or pixelated images

    DPI Change Tips for Different Purposes

    Print Requirements

    • Photos: 300 DPI
    • Magazines: 300-600 DPI
    • Newspapers: 200-300 DPI

    Web and Digital Use

    • Social media: 72 DPI
    • Website graphics: 72-96 DPI
    • Digital presentations: 96 DPI

    When Should You Change Your DPI?

    1. When Preparing Images for Print
      • It is important to always check your printer’s specific requirements
      • Use high-quality original images
      • Resize before changing DPI to maintain quality
    2. When Optimizing for Web
      • Reduce DPI to decrease file size
      • Balance between image quality and load time
      • Use compression tools alongside DPI adjustment

    How to Troubleshoot Issues with DPI Changes

    • Blurry Images: Often result from significant DPI increases
    • Large File Sizes: High DPI can create massive files
    • Loss of Quality: Original image resolution is key

    Quick Fixes

    • Use professional resampling methods
    • Start with high-resolution original images
    • Use vector graphics when possible for scalability

    More Articles from Unixmen. 

    How to Extract Images from PDF Files with pdfimages

    Trimage- A great application to compress and optimize images

    Open Source Raw Image Editor Application Darktable 1.6.8 is out now

    The post How to Change DPI: Adjusting Image Resolution appeared first on Unixmen.

  5. As a tech-enthusiast content creator, I'm always on the lookout for innovative ways to connect with my audience and share my passion for technology and self-sufficiency.

    But as my newsletter grew in popularity, I found myself struggling with the financial burden of relying on external services like Mailgun - a problem many creators face when trying to scale their outreach efforts without sacrificing quality.

    That's when I discovered Listmonk, a free and open-source mailing list manager that not only promises high performance but also gives me complete control over my data.

    In this article, I'll walk you through how I successfully installed and deployed Listmonk locally using Docker, sharing my experiences and lessons learned along the way.

    I used Linode's cloud server to test the scenario. You may try either of Linode or DigitalOcean or your own servers.

    Customer Referral Landing Page - $100
    Cut Your Cloud Bills in Half Deploy more with Linux virtual machines, global infrastructure, and simple pricing. No surprise bills, no lock-in, and the

    Get started on Linode with a $100, 60-day credit for new users.

    DigitalOcean – The developer cloud
    Helping millions of developers easily build, test, manage, and scale applications of any size – faster than ever before.

    Get started on DigitalOcean with a $100, 60-day credit for new users.

    Prerequisites

    Before diving into the setup process, make sure you have the following:

    • Docker and Docker Compose installed on your server.
    • A custom domain that you want to use for Listmonk.
    • Basic knowledge of shell commands and editing configuration files.

    If you are absolutely new to Docker, we have a course just for you:

    Learn Docker: Complete Beginner’s Course
    Learn Docker, an important skill to have for any DevOps and modern sysadmin. Learn all the essentials of Docker in this series.

    Step 1: Set up the project directory

    The first thing you need to do is create the directory where you'll store all the necessary files for Listmonk, I like an organized setup (helps in troubleshooting).

    In your terminal, run:

    mkdir listmonk
    cd listmonk
    
    creating listmonk directory

    This will set up a dedicated directory for Listmonk’s files.

    Step 2: Create the Docker compose file

    Listmonk has made it incredibly easy to get started with Docker. Their official documentation provides a detailed guide and even a sample docker-compose.yml file to help you get up and running quickly.

    Download the sample file to the current directory:

    curl -LO https://github.com/knadh/listmonk/raw/master/docker-compose.yml
    
    downloading sample docker-compose.yml file from listmonk

    Here is the sample docker-compose.yml file, I tweaked some default environment variables:

    💡
    It's crucial to keep your credentials safe! Store them in a separate .env file, not hardcoded in your docker-compose.yml. I know, I know, I did it for this tutorial... but you're smarter than that, right? 😉
    editing the environment variables in sample docker-compose.yml

    For most users, this setup should be sufficient but you can always tweak settings to your own needs.

    then run the container in the background:

    docker compose up -d
    running listmonk containers

    Once you've run these commands, you can access Listmonk by navigating to http://localhost:9000 in your browser.

    Setting up SSL

    By default, Listmonk runs over HTTP and doesn’t include built-in SSL support. It is kinda important if you are running any service these days. So the next thing we need to do is to set up SSL support.

    While I personally prefer using Cloudflare Tunnels for SSL and remote access, this tutorial will focus on Caddy for its straightforward integration with Docker.

    Start by creating a folder named caddy in the same directory as your docker-compose.yml file:

    mkdir caddy

    Inside the caddy folder, create a file named Caddyfile with the following content:th the following contents:

    listmonk.example.com {
        reverse_proxy app:9000
    }

    Replace listmonk.example.com with your actual domain name. This tells Caddy to proxy requests from your domain to the Listmonk service running on port 9000.

    creating caddyfile

    Ensure your domain is correctly configured in DNS. Add an A record pointing to your server's IP address (in my case, the Linode server's IP).

    If you’re using Cloudflare, set the proxy status to DNS only during the initial setup to let Caddy handle SSL certificates.

    creating a dns record for listmonk

    Next, add the Caddy service to your docker-compose.yml file. Here’s the configuration to include:

      caddy:
        image: caddy:latest
        restart: unless-stopped
        container_name: caddy
        ports:
          - 80:80
          - 443:443
        volumes:
          - ./caddy/Caddyfile:/etc/caddy/Caddyfile
          - ./caddy/caddy_data:/data
          - ./caddy/caddy_config:/config
        networks:
          - listmonk
    adding caddy service in docker-compose file

    This configuration sets up Caddy to handle HTTP (port 80) and HTTPS (port 443) traffic, automatically obtain SSL certificates, and reverse proxy requests to the Listmonk container.

    Finally, restart your containers to apply the new settings:

    docker-compose restart

    Once the containers are up and running, navigate to your domain (e.g., https://listmonk.example.com) in a browser.

    Caddy will handle the SSL certificate issuance and proxy the traffic to Listmonk seamlessly.

    Step 3: Accessing Listmonk webUI

    Once Listmonk is up and running, it’s time to access the web interface and complete the initial setup.

    Open your browser and navigate to your domain or IP address where Listmonk is hosted. If you’ve configured HTTPS, the URL should look something like this:

    https://listmonk.yourdomain.com

    and you’ll be greeted with the login page. Click Login to proceed.

    Creating the admin user

    On the login screen, you’ll be prompted to create an administrator account. Enter your email address, a username, and a secure password, then click Continue.

    creating admin account for listmonk

    This account will serve as the primary admin for managing Listmonk.

    Configure general settings

    Once logged in, navigate to Settings > Settings in the left sidebar. Under the General tab, customize the following:

    • Site Name: Enter a name for your Listmonk instance.
    • Root URL: Replace the default http://localhost:9000 with your domain (e.g., https://listmonk.yourdomain.com).
    • Admin Email: Add an email address for administrative notifications.

    Click Save to apply these changes.

    editing general settings

    Configure SMTP settings

    To send emails, you’ll need to configure SMTP settings:

    1. Click on the SMTP tab in the settings.
    2. Fill in the details:
      • Host: smtp.emailhost.com
      • Port: 465
      • Auth Protocol: Login
      • Username: Your email address
      • Password: Your email password (or Gmail App password, generated via Google’s security settings)
      • TLS: SSL/TLS
    3. Click Save to confirm the settings.
    adding smtp settings to send emails

    Create a new campaign list

    Now, let’s create a list to manage your subscribers:

    1. Go to All Lists in the left sidebar and click + New.
    2. Give your list a name, set it to Public, and choose between Single Opt-In or Double Opt-In.
    3. Add a description, then click Save.
    creating a test newsletter

    Your newsletter subscription form will now be available at:

    https://listmonk.yourdomain.com/subscription/form

    newsletter subscribe page

    With everything set up and running smoothly, it’s time to put Listmonk to work.

    You can easily import your existing subscribers, customize the look and feel of your emails, and even change the logo to match your brand.

    Final thoughts

    And that’s it! You’ve successfully set up Listmonk, configured SMTP, and created your first campaign list. From here, you can start sending newsletters and growing your audience.

    I’m currently testing Listmonk for my own newsletter solution on my website, and while it’s a robust solution, I’m curious to see how it performs in a production environment.

    That said, I’m genuinely impressed by the thought and effort that Kailash Nadh and the contributors have put into this software, it’s a remarkable achievement.

    For any questions or challenges you encounter, the Listmonk GitHub page is an excellent resource and the developers are highly responsive.

    Finally, I’d love to hear your thoughts! Share your feedback, comments, or suggestions below. I’d love to hear about your experience with Listmonk and how you’re using it for your projects.

    Happy emailing! 📨

    https://linuxhandbook.com/content/images/2025/01/listmon-self-hosting.png
    • 0
      entries
    • 0
      comments
    • 0
      views

    No blog entries yet

×
  • Create New...

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.