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:
01.CD_DA
02. 
03.TRACK AUDIO
04.AUDIOFILE "01.wav" 0
05. 
06.TRACK AUDIO
07.AUDIOFILE "02.wav" 0
08. 
09.TRACK AUDIO
10.AUDIOFILE "03.wav" 0
11. 
12.TRACK AUDIO
13.AUDIOFILE "04.wav" 0

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

Sunday, November 16, 2003

Verbose list of details of running processes

1.ps auxwww

Saturday, November 15, 2003

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

1.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
01.1. Install the kernel-source package(with softwaremanager) if not already done
02. 
03.2. Open a konsole as root and type:
04. 
05.cd /usr/src/linux
06. 
07.3. cleanup the directory with command:
08. 
09.make mrproper
10. 
11.3. Configure the kernel:
12. 
13.make xconfigure
14. 
15.4. Now activate ACPI in the section General Setup, activate all modules if
16.possibvle mark with "y" y means to built into kernel, not as module. Don't
17.change anything else in the kernel config otherwise you have to do some more
18.things that I don't explain now.
19. 
20.5. Save and exit
21. 
22.6. Compile:
23. 
24.make dep && make bzImage && make modules && make modules_install
25. 
26.After that is done do the following:
27. 
28.cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.4.19-acpi
29. 
30.cp /usr/src/linux/System.map /boot/System.map-2.4.19-acpi
31. 
32.7. Now you just need to either use drakboot to add that kernel to lilo.conf or
33.just add the lines for this kernel to lilo.conf manually with an editor of
34.your choice
35. 
36.for example you would add:
37. 
38.image=/boot/vmlinuz-2.4.19-acpi
39.label=2.4.19-acpi
40.root=/dev/hda7
41.initrd=/boot/initrd-2.4.19-16mdk.img
42.append="noquiet devfs=mount hdc=ide-scsi"
43.vga=791
44.read-only
45. 
46.8. Now you rerun lilo with command, as root:
47. 
48./sbin/lilo
49. 
50.9. Don't forget to install the acpid script with command:
51. 
52.urpmi acpid
53. 
54.you can also do that with softwaremanager(rpmdrake)
55. 
56.10. Run command:
57. 
58.drakxservices
59. 
60.disable the apm daemon and enable acpid
61. 
62.11. Reboot select the kernel mared as 2.4.19-acpi test if everything works
63.fine if it does you can make it your default kernel.

Thursday, November 13, 2003

Check for, and count duplicate records in MySQL

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

Sorted list of directory sizes

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

Saturday, November 8, 2003

Count within a "for" loop in shell script

1.for ((  i = 0 ;  i <= 5;  i++  ))
2.do
3.  echo "Welcome $i times"
4.done

Friday, November 7, 2003