about image

How to Install MEGAcmd on Gentoo Linux (from source)

hahnavi November 30, 2024

To build MEGAcmd on Gentoo Linux, we need to apply a patch similar to that used on Arch Linux.

Download the source of MEGAcmd, MEGA SDK, and the patch:

curl -OL "https://github.com/meganz/MEGAcmd/archive/1.7.0_Linux.tar.gz"
curl -OL "https://github.com/meganz/sdk/archive/e448c09e73a4496329f46e538f1f20143b618ed1.tar.gz"
curl -OL "https://aur.archlinux.org/cgit/aur.git/plain/fix-ffmpeg-compile.patch?h=megacmd"

Extract the sources:

tar xf 1.7.0_Linux.tar.gz
tar xf e448c09e73a4496329f46e538f1f20143b618ed1.tar.gz

Navigate to the MEGAcmd directory:

cd MEGAcmd-1.7.0_Linux

Create a symlink for MEGA SDK:

rm -r sdk
ln -s ../sdk-e448c09e73a4496329f46e538f1f20143b618ed1 sdk

Apply the patch:

patch -Np1 -d sdk < ../fix-ffmpeg-compile.patch

Build MEGAcmd:

...

How to Install PostgreSQL Server on Ubuntu 24.04 (Noble)

hahnavi September 14, 2024
sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
sudo apt -y install postgresql
...
about image

Auto Backup PostgreSQL Database Using pg_dump and cron

hahnavi July 28, 2024

1. Create a Backup Script

Create the Script File:

vi /path/to/backup_script.sh

Add the Following Content to the Script:

#!/bin/bash

# Database credentials
DB_NAME="your_database_name"
DB_USER="your_database_user"
DB_PASSWORD="your_database_password"

# Backup directory
BACKUP_DIR="/path/to/backup/directory"
mkdir -p $BACKUP_DIR

# Date format for backup file
DATE=$(date +%Y-%m-%d_%H-%M-%S)

# Backup file name
BACKUP_FILE="$BACKUP_DIR/${DB_NAME}_$DATE.sql"

# Export password to avoid prompt
export PGPASSWORD=$DB_PASSWORD

# Perform the backup
pg_dump -U $DB_USER -d $DB_NAME -F c -f $BACKUP_FILE

# Unset the password
unset PGPASSWORD

# Optional: Delete backups older than 7 days
find $BACKUP_DIR -type f -name "*.sql" -mtime +7 -exec rm {} \;

echo "Backup completed successfully at $DATE"

Make the Script Executable:

...
about image

How to take a screenshot in Sway using slurp, grim, and swappy

hahnavi July 27, 2024

slurp is a tool to select a region in a Wayland compositor and print it to the standard output.

grim is a tool to grab images from a Wayland compositor.

swappy is a Wayland native snapshot and editor tool, inspired by Snappy on macOS.

Install slurp, grim, and swappy (Arch Linux)

sudo pacman -S slurp grim swappy

Bind the command to the Print key

Add this line to the sway config file ~/.config/sway/config

...
about image

Free Cloud PostgreSQL Databases

hahnavi July 17, 2024

1. Neon

  • 0.5 GiB storage
  • 24/7 for your main database
  • Fixed capacity at 0.25 vCPU
  • Point-in-time restore (24 h)

2. Supabase

  • 500 MB database space
  • Shared CPU • 500 MB RAM
  • 5 GB bandwidth

3. Aiven

  • 1 CPU • 1 GB RAM
  • 5 GB storage
  • Backups for disaster recovery

4. CockroachDB

PostgreSQL compatible

5. YugabyteDB

PostgreSQL compatible

...