Wednesday, October 22, 2014

Automating Low-Cost Server Backups to Amazon Glacier with glacier-cmd (cPanel & Virtualmin)

Amazon Glacier provides an extremely cost-effective cold-storage solution for archiving periodic server backups (such as weekly full-system and MySQL snapshots) without paying standard S3 active storage pricing. Here is how to configure automated Glacier uploads using the command-line utility glacier-cmd on cPanel and Virtualmin servers.

Components: Amazon Glacier Vault • glacier-cmd Python CLI • Automated root cron backup workflow

1. Installing glacier-cmd

Install Python setup tools and the Glacier command-line interface:

yum install git python python-setuptools -y
cd /usr/src

# For cPanel servers, link git to system path if needed:
[ ! -f /usr/bin/git ] && ln -s /usr/local/cpanel/3rdparty/bin/git /usr/bin/git

git clone https://github.com/uskudnik/amazon-glacier-cmd-interface
cd amazon-glacier-cmd-interface
python setup.py install

2. Configuring AWS Credentials

Create ~/.glacier-cmd in the root home directory:

[aws]
access_key=YOUR_AWS_ACCESS_KEY_ID
secret_key=YOUR_AWS_SECRET_ACCESS_KEY

[glacier]
region=us-east-1
bookkeeping=True
bookkeeping-sqlite-db=/root/.glacier-cmd-db

3. Uploading Backups to a Vault

Create your backup vault and upload archives with automatic multipart chunking:

# Create a new vault
glacier-cmd mkvault server-backups

# Upload a backup archive with description
glacier-cmd upload --description "cPanel Weekly Full Backup $(date +%Y-%m-%d)" server-backups /backup/weekly-backup.tar.gz

Monday, May 26, 2014

Essential Fortran Tips: Implicit Typing, Common Blocks, and Array Bounds

When developing or maintaining scientific simulation and finite-element codes in Fortran, understanding memory sharing semantics and legacy typing rules prevents subtle computational bugs. Here are key fundamental tips to keep in mind:

Topics: Implicit precision typing • Common block limits • Explicit bounds declarations

1. Implicit Typing and Precision Control

By default in classic Fortran, variables starting with letters I through N default to integer, while all others default to single-precision real. You can enforce double precision across designated variable prefixes using:

IMPLICIT DOUBLE PRECISION (A-H, O-Z)

Modern recommendation: In Fortran 90 and newer, always specify IMPLICIT NONE at the top of every module and subroutine, explicitly declaring types and kinds (e.g. REAL(dp)) to avoid unintended variable scoping.

2. Blank vs. Named COMMON Blocks

  • A Fortran program may contain only one blank (unnamed) COMMON block across all translation units.
  • A program can declare any number of named COMMON blocks:
    COMMON /grid_params/ nx, ny, deltax, deltay
  • Ensure that variable sizes and ordering within named COMMON blocks match identically across all subroutines that include them.

Thursday, April 17, 2014

CFD: Generating Non-Uniform 2D Rectangular Grid Meshes in Fortran

In Computational Fluid Dynamics (CFD), resolving boundary layers and high-gradient shear regions requires non-uniform grid clustering near solid walls while keeping cell counts manageable in free-stream regions. Here is a Fortran routine to generate a geometrically stretched, symmetric 2D rectangular grid.

Domain: Rectangular 2D domain \([a, b] imes [c, d]\) • Method: Geometric progression expansion clustering toward boundaries

Mathematical Formulation

Given domain limits \(x \in [a, b]\) with \(n_x\) divisions and expansion ratio \(r_x\), the initial wall-adjacent step size \(\eta_x\) is computed from the geometric sum across the symmetric half-domain:

eta_x = (b - a) * (1 - exp_x) / (2 * (1 - exp_x**(n_x / 2)))
eta_y = (d - c) * (1 - exp_y) / (2 * (1 - exp_y**(n_y / 2)))

Fortran Source Code

! ====================================================================
! 2D Non-Uniform Symmetric Rectangular Grid Generator
! ====================================================================
      exp_x = 1.05   ! x-axis expansion factor
      exp_y = 1.10   ! y-axis expansion factor

      a = 0.0
      b = 1.0
      c = 0.0
      d = 1.0

! Uniform step sizes for reference
      del_x = (b - a) / n_x
      del_y = (d - c) / n_y

! Compute first wall-adjacent step sizes (eta_x, eta_y)
      eta_x = (b - a) * (1.0 - exp_x) / (2.0 * (1.0 - exp_x**(n_x / 2)))
      eta_y = (d - c) * (1.0 - exp_y) / (2.0 * (1.0 - exp_y**(n_y / 2)))

      x(1) = a
      y(1) = c

! --- X-Direction Mesh Generation ---
! Half 1: Wall to Center (Expanding)
      DO i = 2, n_x / 2 + 1
          x(i) = x(i - 1) + eta_x * exp_x**(i - 2)
      END DO

! Half 2: Center to Opposite Wall (Contracting)
      DO i = n_x / 2 + 2, n_x + 1
          x(i) = x(i - 1) + eta_x * exp_x**(n_x + 1 - i)
      END DO

! --- Y-Direction Mesh Generation ---
! Half 1: Wall to Center (Expanding)
      DO j = 2, n_y / 2 + 1
          y(j) = y(j - 1) + eta_y * exp_y**(j - 2)
      END DO

! Half 2: Center to Opposite Wall (Contracting)
      DO j = n_y / 2 + 2, n_y + 1
          y(j) = y(j - 1) + eta_y * exp_y**(n_y + 1 - j)
      END DO
! ====================================================================

Sunday, January 5, 2014

How to Disable 'Sort by Subject' in Roundcube Webmail

In Roundcube Webmail, accidentally clicking on the Subject column header triggers an expensive mailbox-wide sort operation. On large mail folders with thousands of messages, sorting by subject can freeze the UI and create heavy server load. Here is how to disable sorting on the Subject column while keeping date and status sorting intact.

File: program/steps/mail/func.inc • Target: Subject header click handler

Step-by-Step Fix

  1. Open program/steps/mail/func.inc in your text editor.
  2. Search for ./#sort (typically around line 440–445).
  3. Locate the onclick attribute generation:
    'onclick' => 'return ' . JS_OBJECT_NAME . ".command('sort','" . $col . "',this)"
  4. Replace it with a no-op handler for the subject column (or globally):
    'onclick' => 'return true'

Save the file. Clicking the Subject column header will no longer initiate slow sorting queries.

How Google Antigravity Solved the Mysterious NVIDIA Sleep Reboot on My Dell Inspiron 7567 (Ubuntu Linux)

If you run modern Ubuntu or Linux on a Dell Inspiron 15 Gaming (7567) or a similar 7th-gen Intel laptop paired with an NVIDIA GeForce GTX ...