Author Archives: C.D.

Excel – Set Default Date Format

In the Data Validation dialog box, click Settings tab, and then choose Custom from the Allow drop down list, then enter this formula: =AND(ISNUMBER(B2),LEFT(CELL(“format”,B2),1)=”D”)

Posted in Others | Leave a comment

Configuring SELinux Policies for Apache Web Servers

Overview SELinux can be very troublesome when deploying web applications on Red Hat while not using the default Apache directories, for either content or logs. Your application may need to be installed in a separate directory or maybe, for other … Continue reading

Posted in Linux | Tagged | Leave a comment

Exchange New-MailboxImportRequest – Import PST files

New-MailboxImportRequest -Name “Import1” -Mailbox “Test User” -FilePath \\ServerName\SharedFolder\Imported.pst -TargetRootFolder “Inbox/Imported” The above command will create a subfolder under the Inbox called “Imported” and all PST data will be imported into that subfolder. Get-MailboxImportRequest -Status Completed | Remove-MailboxImportRequest -Confirm:$all ( delete … Continue reading

Posted in Exchange | Leave a comment

Grep through files and replace

Want to replace recursively http://example.co.uk with http://10.0.0.7 and also create backups of the files modified: grep -rFl “http://www.example.co.uk” /path  | xargs sed -i.bak ‘s/http:\/\/www.example.co.uk/http:\/\/10.0.0.7/g’

Posted in Linux | Tagged , , | Leave a comment

PS Codes

ps ax PROCESS STATE CODES Here are the different values that the s, stat and state output specifiers (header “STAT” or “S”) will display to describe the state of a process: D uninterruptible sleep (usually IO) R running or runnable … Continue reading

Posted in Linux | Leave a comment

Install OpenDKIM with Postfix on CentOS

Install opendkim    ( epel repoor other sources ) Either find/add those options to the original config file, or even better, make a copy of the original file and replace /etc/opendkim.conf with the following: AutoRestart Yes # Need to investigate this … Continue reading

Posted in Linux | Tagged | Leave a comment

Reduce KVM Windows qcow2 file size

Clean up the virtual drive (remove temps files, etc) Defrag with the open source UltraDefrag software with “full optimisation” Run “sdelete -z c:“ Run “qemu-img convert -p -f qcow2 -O qcow2 Win7.qcow2  /newpath/Win7.qcow2“ For Linux Guest: dd if=/dev/zero of=/mytempfile # … Continue reading

Posted in Linux, Windows | Tagged | Leave a comment

Bash Assign Find Output To Array

To assign the output to an array, you need to use a command substitution inside of an array assignment. arr=($(grep -n “search term” file.txt | sed ‘s/:.*//’)) The inner $() runs the command while the outer () causes the output … Continue reading

Posted in Linux | Tagged , | Leave a comment

Shrinking LVM logical volume with ext3/ext4 filesystem

… the required steps to reduce the size of an LVM logical volume formatted as an ext4 filesystem… 1) Unmount the logical volume (or boot into a live CD if the logical volume contains the root filesystem) 2) Check the … Continue reading

Posted in Linux | Tagged , | Leave a comment

Only one Perl instance – lock script

Use File::NFSLock to get an exclusive lock on the script itself: use Fcntl qw(LOCK_EX LOCK_NB); use File::NFSLock; # Try to get an exclusive lock on myself. my $lock = File::NFSLock->new($0, LOCK_EX|LOCK_NB); die “$0 is already running!\n” unless $lock; Alternatively use … Continue reading

Posted in Others | Tagged | Leave a comment