Categories Archives: Uncategorized

MDADM Cheat Sheet

This info is taken from here. 1. Create a new RAID array Create (mdadm –create) is used to create a new array: mdadm –create –verbose /dev/md0 –level=1 /dev/sda1 /dev/sdb2 or using the compact notation: mdadm -Cv /dev/md0 -l1 -n2 /dev/sd[ab]1 2. /etc/mdadm.conf /etc/mdadm.conf or /etc/mdadm/mdadm.conf (on debian) is the main configuration file for mdadm. After […]

DJBot Rsync Copy

rsync –progress -av –delete -e ssh root@x.x.x.x:/ root –exclude=/dev –exclude=/proc –exclude=/sys –exclude=/tmp –exclude=’*.mp3′ –exclude=’*.MP3′ — exclude=’*.sql.gz’ –exclude=djbot/logs

SQL-fu #1

Nested select with an insert to create multiple rows — used this to add admin privileges for a client in Maia for all their domains: INSERT INTO maia_domain_admins (SELECT t2.domain_id,1013 from postfix_transport t2 WHERE t2.mta_host=’1.2.3.4′);

Search + Replace, Append, Prepend MySQL

Search and replace update [table_name] set [field_name] = replace([field_name],'[string_to_find]’,'[string_to_replace]’); Append update [table_name] set [field_name] = concat([field_name],'[string_to_append]’); Prepend update [table_name] set [field_name] = concat(‘[string_to_prepend]’,[field_name]);

Categories: Uncategorized. Comments Off on Search + Replace, Append, Prepend MySQL

Remotely installing PFSense to hard drive with VGA and without CD-ROM

FreeBSD is great for certain tasks (such as firewalls and other embedded devices), but has some real shortcomings when it comes to booting from attached or remote storage. This severely complicates the installation process in some cases. In my case, I have a remote server in a rack with no CD-ROM. Pulling the server from […]

Windows Vista / Windows 7 / Server 2008 R2: 0xc0000225 after resizing partition or restoring backup

So I needed to shrink a C: partition of a Windows 7 (Server 2008 R2) machine.  After shrinking with Gparted (my open-source partitioning tool of choice), Windows no longer booted, with the boot manager complaining of 0xc0000225 (awesome error message as usual, Microsoft). To get things working again, it was necessary to execute the following […]

Find files modified/created within N days ago

This proved to be useful in cleaning up a compromised site. List all the files created or modified within a certain time frame — in this case we are looking 30 days in the past: find . -mtime -30 -type f -print If you want to delete all files created/modified n days ago, you can […]