Top Nav

Archive | Misc

Perl – Sort associative array by value

Here’s an alpha sort of the values of the associative array named “myarray”:

And here’s the same sort numerically:

And if you want numeric descending:

Of course don’t forget how to sort keys:

And a numerical sort of keys:

0

MS-SQL 2000 : Truncate transaction log

Execute the following commands:

This will reduce the transaction log for the “pubs” database to 2MB.

0

LFTP mirror script

Here’s a very handy script to mirror a site via ftp with lftp:

And here’s a mirror in the opposite direction:

0

Exclude Directroy From CPanel Backup

Create cpbackup-exclude.conf in the user’s home directory (/home/user-id) to exclude files from a cPanel backup. This file is only used if you make a complete site back up from cPanel. Here are the basic rules for the content of the file:

  • Each item to skip must be on it’s only line in the file.
  • Directories should not have a trailing slash.
  • Each entry must have the full path to the file or directory.
0