Monthly Archives: February 2012

sed one liner: remove closing PHP tag

$ sed -i ‘s/\(.*\)?>/\1/’ your-script.php

Posted in Linux, PHP | Tagged , | Leave a comment

sed edit in place deleting matching lines

This command deletes the line that contains “remove-matching-line” in files that matches *.txt wildcard. $ ls -1 *.txt | xargs -I ‘{}’ sed -i ‘/^.*remove-matching-line.*$/d’ ‘{}’ A hacker inserted eval(base64_decode(“obfuscated_code”)) on a client’s PHP files. I used this command to … Continue reading

Posted in Bash script, Linux | Tagged , | Leave a comment

Remove duplicates from MySQL Table

ALTER IGNORE TABLE categories ADD PRIMARY KEY(categories_id);

Posted in MySQL, SQL | Tagged , | Leave a comment

Create Linux RAID Level 1 from 4 TB Harddisk

Partition the disk into two equal parts. # parted /dev/sda GNU Parted 2.3 Using /dev/sda Welcome to GNU Parted! Type ‘help’ to view a list of commands. (parted) mklabel gpt (parted) print Model: Areca ARC-1212-VOL#000 (scsi) Disk /dev/sda: 4,00TB Sector … Continue reading

Posted in Uncategorized | Leave a comment