nix, shell, perl, php, mysql and mac os x tips and tricks

Monday, November 17, 2003

Burn a disc-at-once CD from the command line

First create a .toc file with reference to your wav's as such:

AUDIOFILE "01.wav" 0

AUDIOFILE "02.wav" 0

AUDIOFILE "03.wav" 0

AUDIOFILE "04.wav" 0

then invoke cdrdao as such:
cdrdao write --driver generic-mmc cdtmpdir.toc

Sunday, November 16, 2003

Verbose list of details of running processes

ps auxwww

Saturday, November 15, 2003

Recursively delete a filename in a filesystem...quite dangerous

find /path/to/start -name "filename" -exec rm {} \;

Re-compile mandrake kernel

There are some tutorials out there and there is one provided with your
documents, but if you just want to recompile your current kernel it is so
easy, that I'm gpoing to tell you only what you need in order to have it run
1. Install the kernel-source package(with softwaremanager) if not already done

2. Open a konsole as root and type:

cd /usr/src/linux

3. cleanup the directory with command:

make mrproper

3. Configure the kernel:

make xconfigure

4. Now activate ACPI in the section General Setup, activate all modules if
possibvle mark with "y" y means to built into kernel, not as module. Don't
change anything else in the kernel config otherwise you have to do some more
things that I don't explain now.

5. Save and exit

6. Compile:

make dep && make bzImage && make modules && make modules_install

After that is done do the following:

cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.4.19-acpi

cp /usr/src/linux/ /boot/

7. Now you just need to either use drakboot to add that kernel to lilo.conf or
just add the lines for this kernel to lilo.conf manually with an editor of
your choice

for example you would add:

append="noquiet devfs=mount hdc=ide-scsi"

8. Now you rerun lilo with command, as root:


9. Don't forget to install the acpid script with command:

urpmi acpid

you can also do that with softwaremanager(rpmdrake)

10. Run command:


disable the apm daemon and enable acpid

11. Reboot select the kernel mared as 2.4.19-acpi test if everything works
fine if it does you can make it your default kernel.

Thursday, November 13, 2003

Check for, and count duplicate records in MySQL

SELECT field, count( field )
FROM table
GROUP BY field
HAVING Count( field ) > 1 LIMIT 0 , 30

Sorted list of directory sizes

NOTE: does not show hidden files or directories
du -s * | sort -n

Saturday, November 8, 2003

Count within a "for" loop in shell script

for ((  i = 0 ;  i <= 5;  i++  ))
  echo "Welcome $i times"

Friday, November 7, 2003