How to send a random alphanumeric in Postman

If you have a kind of session ID or something that you are passing in your payload in your request on postman and you want it to be generated randomly with each call, use the randomAlphaNumberic function as follows:

{
  "details": "show me the stuff",
  "session_id": "{{$randomAlphaNumeric.substr(0,5)}}"
}

In the above example, Postman generates a random 5 char alphanumeric in every request.

That’s it, Enjoy!

Posted in Linux | Tagged , , , , | Leave a comment

How to Tame Your Dragon, aka LLM!

I’m planning to create a series of articles/videos on how to effectively “tame” an LLM to enforce structured output for programmatic use. The goal is to make AI responses predictable, reliable, and easily consumable by applications.

What do you think?

Posted in Linux | Tagged | Leave a comment

Renewing DHCP Lease from Ubuntu 24.04 Server

Just found out that Ubuntu 24.04 server doesn’t use dhclient anymore and uses dhcpcd instead for obtaining dhcp address leases.

To renew your dhcp address, do the following:

sudo dhcpcd -k
sudo dhcpcd

That’s it, Enjoy!

Sources:

https://askubuntu.com/questions/1511816/how-to-renew-ip-address-with-ubuntu-24-04

Posted in Linux | Tagged , , , | Leave a comment

Docker file & compose for phpBB3

I needed a local instance to play around with phpBB, which I couldn’t find recent docker files for, so I just created my own. The below are the docker-compose.yml and Dockerfile for the latest version of phpBB as of now; 3.3.14.

Note: Make sure to change the variables inside the environment section in the docker-compose.yml file before installation.

Dockerfile

# Use the official PHP image with Apache
FROM php:8.2-apache 

# Install required PHP extensions and dependencies
RUN apt-get update && apt-get install -y \
    wget \
    mariadb-client \
    unzip \
    && docker-php-ext-install mysqli pdo pdo_mysql \
    && docker-php-ext-enable mysqli pdo pdo_mysql \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Enable Apache modules
RUN a2enmod rewrite

# Set working directory
WORKDIR /var/www/html

# Download and extract phpBB
RUN wget https://download.phpbb.com/pub/release/3.3/3.3.14/phpBB-3.3.14.zip && \
    unzip phpBB-3.3.14.zip && \
    mv phpBB3 phpbb && \
    rm -rf phpBB-3.3.14.zip

# Set permissions
RUN chown -R www-data:www-data /var/www/html/phpbb && \
    chmod -R 755 /var/www/html/phpbb

# Expose Apache port
EXPOSE 80

CMD ["apache2-foreground"]

docker-compose.yml

services:
  phpbb:
    build: .
    container_name: phpbb
    restart: unless-stopped
    ports:
      - "8080:80"
    volumes:
      - phpbb-data:/var/www/html/phpbb
    depends_on:
      - mariadb
    environment:
      - MYSQL_HOST=mymariadb_host
      - MYSQL_USER=myphpbb_mymariadb_user
      - MYSQL_PASSWORD=MySuperStrongPassword12345
      - MYSQL_DATABASE=myphpbb_db

  mariadb:
    image: mariadb:10.11
    container_name: phpbb-mariadb
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: myphpbb_db
      MYSQL_USER: myphpbb_mymariadb_user
      MYSQL_PASSWORD: MySuperStrongPassword12345
    volumes:
      - db-data:/var/lib/mysql

volumes:
  phpbb-data:
  db-data:

Let’s get to action!

  • To build and start: docker-compose up -d --build
  • Access the installation at http://localhost:8080/phpbb/install and enter the parameters inside the first environment section in the docker-compose.yml file
  • After installation is complete from the above link, you have to run docker exec -it phpbb rm -rf /var/www/html/phpbb/install
  • To wipe it and start all over: docker-compose down -v

I’ve made these file also available on my GitHub repo here: https://github.com/ahmedatawfik/usefulscripts/tree/main/docker/phpBB

That’s it, Enjoy!

References:

Posted in docker, Linux | Tagged , , , , , | 2 Comments

If WSLg apps show a black screen!

You might have rendering issues with WSLg apps, especially in case you are using an Intel graphics card, like this:

In that case, just configure an environment variable named LIBGL_ALWAYS_SOFTWARE and set it to 1. To persist it, add this line inside /etc/profile:

export LIBGL_ALWAYS_SOFTWARE=1

Just restart (using wsl --shutdown for example).

Note: This will disable GPU acceleration for those GUI apps, which I don’t really care about in this case!

Tested on Windows 11 Pro host with Ubuntu 24.04 WSL guest.

That’s it, Enjoy!

Sources:

Posted in Linux | Tagged , , , | Leave a comment