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:
CD_DA

TRACK AUDIO
AUDIOFILE "01.wav" 0

TRACK AUDIO
AUDIOFILE "02.wav" 0

TRACK AUDIO
AUDIOFILE "03.wav" 0

TRACK AUDIO
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/System.map /boot/System.map-2.4.19-acpi

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:

image=/boot/vmlinuz-2.4.19-acpi
label=2.4.19-acpi
root=/dev/hda7
initrd=/boot/initrd-2.4.19-16mdk.img
append="noquiet devfs=mount hdc=ide-scsi"
vga=791
read-only

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

/sbin/lilo

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

urpmi acpid

you can also do that with softwaremanager(rpmdrake)

10. Run command:

drakxservices

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++  ))
do
  echo "Welcome $i times"
done

Friday, November 7, 2003