These are a bunch of notes of various things which are easily forgotten or whatnot. Stuff to keep handy for macosx (darwin) and linux commands and examples which may or may not be useful. Use at your own risk. Your mileage may vary. Watch out for line breaks. Oh, also, Applescript.

now also gimp-print and lpr

and connecting pulse oximeter to linux machine

plus os x screen grab via web on demand

e2fsprogs build error

lvm command lvremove hangs on kernel 2.6.15 and later

Linux NETDEV WATCHDOG ethernet transmit error

mime types for 3g2, 3gp, video from cellphones

stop activation dialog and delay with netscape 6 on os9

use php to generate a time based uuid or guid

NetXtreme II BCM5708 Gigabit Ethernet won't work with bridging in xen debian etch kernel 2.6.18-6

Exporting Quickbooks Bills to excel tab separated text, converting to iif on mac os x with applescript for importing into Quickbooks

Exporting HDV video from Final Cut Pro using Compressor 2 for uploading to youtube

error compiling gphoto2 2.4.8 on Mac OS X 10.6

install libjbig jbigkit on mac os x

Export all note, appointment, call data for Now Contact to Apple Address Book compatible vcf file

A possible fix when iPhoto and Image Capture fail to download photos from an iPhone

getting gnuplot to link only to libpng 1.5 instead of both 1.2 and 1.5 in Mac OS X

Using photopc with old Toshiba laptop and Nikon camera for time lapse photos

mplayer on mac os x creates a dock icon every time

opendkim not signing with sendmail using milter-greylist

newsyslog for rotating mac os x apache log files

applescript via command line, osacript, to control Skype video and audio

applescript to kill Skype before it automatically calls back on disconnect

flite app in asterisk stops at comma

shell + applescript to run HP scanner with Image Capture in Mac OS X via command line


'./configure' '--with-apxs=/usr/sbin/apxs' '--with-mysql' '--with-zlib' '--enable-ftp' '--with-jpeg-dir=/usr/lib' '--with-png-dir=/usr/lib' '--with-tiff-dir=/usr/lib' '--with-zlib-dir=/usr/lib' '--with-gd=/usr/local' '--with-ttf' '--with-xml' '--enable-track-vars=yes' '--enable-track-errors=yes' '--enable-magic-quotes=yes' '--enable-exif' '--with-freetype-dir=/usr/lib'

'./configure' '--with-apxs=/usr/sbin/apxs' '--with-mysql' '--with-zlib' '--enable-ftp' '--with-jpeg-dir=/usr/lib' '--with-png-dir=/usr/lib' '--with-tiff-dir=/usr/lib' '--with-zlib-dir=/usr/lib' '--with-gd' '--with-ttf' '--with-xml' '--enable-track-vars=yes' '--enable-track-errors=yes' '--enable-magic-quotes=yes' '--enable-exif' '--with-freetype-dir=/usr/lib' '--enable-gd-native-ttf'

(first with built in gd?) (Native TrueType string function  To enable support for native TrueType string function add --enable-gd-native-ttf)??

apache 1.3.27
./configure --with-layout=RedHat \
            --enable-module=most \

used to add runlevel scripts from /etc/init.d/ scripts with lines added to scripts like:

# chkconfig: 345 55 10
# description:  synchronize the time of a computer client or server to \
# another server.

first set of numbers are runlevels to run in, second number start priority, third number, stop priority
then run something like 'chkconfig thingd reset'

to remove a service 'chkconfig --del rhnsd'
or set the first set of numbers to "-" then reset
Mac OS X mod rewrite, make sure these lines are uncommented in httpd.conf
#LoadModule rewrite_module     libexec/httpd/
#AddModule mod_rewrite.c
   then, in the desired user/username.conf
<Directory "/Users/username/Sites/">
    Options Indexes MultiViews SymLinksIfOwnerMatch
    AllowOverride All
    Order allow,deny
    Allow from all
   and in .htaccess, something like:
RewriteEngine on
RewriteBase /dirfromwhichtobase/
RewriteRule ^([^./]+)/?$ index.php?r=$1
RewriteRule ^x$ phpinfo.php
cp whole file system
x - single file system
p - preserve attrbutes
P - parents (full dir path)
d - no dereference (links as links)
R - recursive (special files as special)
cp -xpdPR / /mnt/point/
how to tar something like a dir
 tar -c -fmusic.tar practice
/usr/bin/gnutar -N '2003-02-10 1:15' --exclude '.DS_Store' -cvf images5.tar IMAGES Previews
[both directories above]
/usr/bin/gnutar -N 2003-01-23 --exclude '.DS_Store' -cf images4.tar IMAGES
/usr/bin/gnutar -N 2003-01-10 --exclude '*.tif' -cf images3.tar IMAGES
put all the files in the dir IMAGES which are newer than jan 10, excluding anything ending in tif, into a tar archive called images3.tar
be sure to use gnutar to untar a gnutarred archive
md5 checksum
md5sum filename
if you dont have md5sum, like on os x, then try:
openssl dgst -md5 filename
pgpv sendmail.8.12.8.tar.gz.sig
pgpk -a PGPKEYS
#clear sendmail queue for client verbose
sendmail -Ac -q -v
#alias expansion and determine if the final delivery address is valid, verify, deliverable
sendmail -bv address
bz2 to decompress .bz2 file  (-I option in tar or -j in other versions)
bzip2 -d linux-2.4.18.tar.bz2
set environment stuff
export PATH=$PATH:/usr/local/bin        (in bash or ksh)
set path=($path /usr/local/bin)         (in csh or tcsh)
du -h --max-depth 1 /
echo "bad dir name" | sed 's/[^A-z0-9\-\.]/_/g'
perl -p -i.bak -e 's/\r/\n/g' ~/test33
  another way to translate linebreaks:  tr "\r" "\n" < file1 > file1.xlated
gpg test33
ripmime -i eudB07.tmp
sort -t"|" -k 2 -o filesort -r file2
tr "\n" "\r" < filesort > file3
tr "|" "\t" < file3 > file4
gpg -ea --always-trust -r -r
see root level permissions
ls -ld /
scp [-pqrvBC46] user@host:file user@host:file
 -r      Recursively copy entire directories.
ssh-keygen -t rsa
Generating public/private rsa key pair.
add public key to authorized keys, below would replace:
scp .ssh/
./config shared
after intalling openssl, had to run ldconfig, after adding /usr/local/ssl/lib dir to /etc/ (otherwise header lib mismatch)
./configure --with-tcp-wrappers --with-pam
from contrib/redhat copied sshd startup script to /etc/init.d/ modified to reflect true locations of keys and binaries, worked
also cp sshd.pam /etc/pam.d/sshd
also follow README.privsep
# type crontab cronfile to activate
#53 03 * * * rdate -s
49 03 * * * rdate -s
gnome config?
vi /usr/share/mime-info/mc.keys (system wide mime open with)
route add  default gw dev eth1
/bin/cat /dev/null > filetomakenull
in dir IMAGES delete files not ending in jpg -type f excludes dirs
find IMAGES -type f -regex "^.*/.*[^j][^p][^g]" -delete
find IMAGES -name ".DS_Store" -delete
find php files which contain text pattern:
find ./ -type f -name "*.php3" -exec grep -l searchpattern {} \;
find files owned by one user, change ownership to another
find / -user smith -exec chown smythe "{}" \;
# find files on volume ending in slice or weblge less than one day old, tar them
find /volumes/FWHDExt500gbB -ctime 1 \( -name "*Slice.tif" -or -name "*WebLge.tif" \) -exec tar -vuf tarfile.tar "{}" \;
find files modified on a particular day (10/31/2004), change mod date to 10/30/2004, first expr to find #days, then find
expr \( `date +%s` - `date --date=10/31/2004 +%s` \) / 3600 / 24 
find . -mtime the_result_of_above -exec touch -t 200410300001 {} \;
find and edit files like above, with perl
find ./ -type f -name "*.php*" -exec grep -l mysql.sock {} \; |xargs  perl -pi -e "s/\/var\/lib\/mysql\/mysql.sock/\/tmp\/mysql.sock/g;"
(find: type -f (regular files, not links), grep: -l filenames, xargs: append result to following, perl: -p execute once for each line of input -e command line execute -i in place editing) 
use perl to fix old tail -1 to tail -n 1 style
perl -pi -e "s/tail -1/tail -n 1/g;" src/Configure
 same but searching directories for multiple files
grep -lr "tail -1" * | xargs perl -pi -e "s/tail -1/tail -n 1/g;"
find shared library dependencies
ldd /usr/sbin/httpd
use ssh to connect to a web server on remote lan as if locally
ssh <remote-ip> -L 8000:<remote-server>:80
then use browser to connect
vi set line numbers (and turn off)
:set number
:set nonumber
vi search and replace whole document (% means whole, otherwise, only current line)
go to line number 138
debian show list of installed packages
dpkg --get-selections
sudo diskutil eraseDisk "Journaled HFS+" BackupHD1A_250gb disk4
#erase disk command line
diskutil reformat /Volumes/BackupHD1A_250gb
#erase disk (need ownership, don't need sudo)
# host is down, want to be notified when it comes back up
ping -a -i 60
-a audible bell when packet received
-i 60 wait 60 seconds between packets
# block an ip with iptables
iptables -I INPUT -s -j DROP
# mac os x show idle time from command line
ioreg -c IOHIDSystem | perl -ane 'if (/Idle/) {$idle=(pop @F)/1000000000; print $idle,"\n"; last}'
build kernel
if patch: decompress patch in /usr/src then cd into linux dir, then 
 patch -p1 < ../patch-2.4.21
download and untar/zip into /usr/src/linux-2.4.18
 make menuconfig
 make dep
 make zImage
 make modules
 make modules modules_install
end up with and vmlinux
copy vmlinux to mac_boot/System Folder/Linux Kernels/
(to use compressed (okay with BootX?): cp arch/ppc/boot/images/miboot.image /mnt/apple/System\ Folder/Linux\ Kernels/vmlinuz-2.4.21)
copy to /boot
 nice to copy
 then link to
ln -s
and not necessary for BootX, but nice to also put vmlinux in /boot and link versionwise
ln -s vmlinux-2.4.18 vmlinux
then reboot and select new kernel

Volume ID
The data is stored in /var/db/volinfo.database.
sudo /System/Library/FileSystems/hfs.fs/hfs.util -k rdisk1s10 ; echo
sudo bless -folder9 /Volumes/diskname/'System Folder' -bootBlocks -folder /Volumes/diskname/System/Library/CoreServices -bootinfo /usr/standalone/ppc/bootx.bootinfo -label "diskname"

sudo bless -folder /Volumes/diskname/System/Library/CoreServices -bootinfo /usr/standalone/ppc/bootx.bootinfo -label "diskname"

sudo bless -folder9 /Volumes/CLASSIC_HD/'System Folder' -label "CLASSIC_HD" -bootBlocks
powermac 7500 linux serial ports: "cua0" (modem port) or "cua1" (printer port) (obsolete, use /dev/ttyS0 /dev/ttyS1)
kill `ps ax | grep runner | grep -v grep | awk '{print $1}'`
#unmount and spin down external noisy disk
umount /dev/sdc7                
/usr/src/scsi/sbin/scsi-spin -d /dev/sdc
Mac OS X command line to mount .dmg disk image:
hdiutil attach DiskImage.dmg
be careful with rsync, it does not handle resource forks, so only use it on files which dont have resource forks (ie, won't work on applications, quark documents, etc)
v-verbose r-recursive t-preserve times -e (ssh) u-update only a-archive(preserve time owner etc) n-dry run
rsync -vrtu --exclude='.DS_Store' -e ssh 'username@\ Databases/Previews/' "/Volumes/PMG4-3Int80gb/Documents/Picture Databases/Previews"
rsync -vrt --exclude='.DS_Store' -e ssh 'username@\ Databases/IMAGES/' "/Volumes/PMG4-3Int80gb/Documents/Picture Databases/IMAGES"
[add n option to above to do dry runs]
escapes and expansion can be complex for remote machine, using escapes within single quotes, etc.

rsync -v -e ssh 'username@\ Databases/\*EWS\ MASTER.fdb' "/Volumes/PMG4-3Int80gb/Documents/Picture Databases/*EWS MASTER.fdb"
rsync: open connection using ssh -l ccrumley rsync --server --sender -v . "/Documents/Picture\ Databases/\*EWS\ MASTER.fdb" 
wrote 60044 bytes  read 1634042 bytes  25863.91 bytes/sec
total size is 118095872  speedup is 69.71
rsync handles resource forks in OS X 10.4 tiger
to see the last 99 lines (screen at a time) of a mac line break file in terminal
tr "\r" "\n" < "/Library/Preferences/Retrospect/Operations Log" | tail -99 | more
use less and gunzip to view a gzipped text file
gunzip -c /var/log/maillog.0.gz | less
patch 2.5.4 never worked on my linux ppc machine
i had to go back to patch 2.5
create password file for .htaccess file:
htpasswd -c /etc/.htpasswd William
add name to it:
htpasswd /etc/.htpasswd bob
find only lines in common between two files with sorted lists
comm -1 -2 file1 file2
(-1 and -2 suppress the columns 1 and 2 which contain the unique from file 1 and 2)
linksys router hidden log page with additional log choices
Access Log
System Log
added line: skip-innodb in file /etc/my.cnf
to purge bin logs of mysql: reset master
#set volume by command line, mac os x, applescript
osascript -e "set volume output volume 60"
osascript -e "get volume settings"
output volume:60, input volume:50, alert volume:100, output muted:false
#throttle bandwidth for port 80 for testing how slow connections will behave
sudo ipfw pipe 1 config bw 11KByte/s
sudo ipfw add 1 pipe 1 dst-port 80
	00001 pipe 1 ip from any to any dst-port 80
sudo ipfw add 1 pipe 1 src-port 80
	00001 pipe 1 ip from any to any src-port 80
sudo ipfw delete 1

#exiftool strip all EXIF data from directory
exiftool -all= directory/path
#set file modification date based on exif
exiftool '-DateTimeOriginal>FileModifyDate' dir
# filename tab description -T is for table
exiftool -T -FileName -Description directory/path
# filename tab description tab width tab height -T is for table
exiftool -T -FileName -ImageWidth -ImageHeight directory/path
# delete all profiles matching keyword -r recursive
exiftool -r -overwrite_original -icc_profile:all= -if '$ProfileDescription=~/SCANPROFILE_3220MFP/' .
# use ffmpeg tool ffprobe to get single value about video stream, width, height, duration
# can output in formats like xml, json
ffprobe -v quiet -print_format compact -select_streams v -show_entries stream=width,height videofile.mp4 
ffprobe  -v quiet -print_format compact -select_streams v -show_entries stream=duration
#use ifconfig to bring up and down ips
ifconfig eth0:1 up netmask
ifconfig eth0:1 down

To get a host's base64 encoded key issue the command:
$ ssh-keyscan -t rsa,dsa hostname
Optionally you can specify -H to have the key displayed in the hashed form. -v increases verbosity.
To search for an entry in known_hosts issue:
$ ssh-keygen -H  -F hostname
You can also delete a single entry from known_hosts:
$ ssh-keygen -R hostname
ssh (rsync) connect even if host key mismatches or doesn't exist
rsync -av --delete -e 'ssh -o StrictHostKeyChecking=no' ~/Library/Mail
command line launch retrospect
sudo /Library/StartupItems/RetroClient/RetroClient
#use iconv to convert windows latin 1 text file to utf8
iconv -f WINDOWS-1252 -t UTF-8 filetoconvert > destinationfilepath
#command line apple system profiler
system_profiler -detailLevel mini
#command line apple installer
sudo /usr/sbin/installer -verbose -pkg php-4.3.6.pkg -target /

i had to also install another redhat package, pciutils-devel-2.0-2
This package just contains
my system is pretty basic, this is about all it took (done as root) (i have pgp 5, and all the pgp stuff might be different, or unnecessary if you trust md5):

cd /usr/src
ls -latr
pgpv sendmail.8.12.8.tar.gz.sig
pgpk -a PGPKEYS
pgpv sendmail.8.12.8.tar.gz.sig
md5sum sendmail.8.12.8.tar.gz
tar -xzf sendmail.8.12.8.tar.gz
cd sendmail-8.12.8
cd sendmail
sh Build
cd ../cf/cf
sh Build
cp /etc/mail/ /etc/mail/
sh Build install-cf
cd ../../sendmail
sh Build install
/etc/rc.d/init.d/sendmail restart

Mac OS X
Nikon View Monitor Carbon, i wanted to uninstall it
an annoying file which kept running, even after i deleted all Nikon View files
even when it was in the trash
couldn't find it in /Library/StartupItems or Login Items in System Preferences.
Finally found it in /Library/Preferences/loginwindow.plist
it's an AutoLaunchedApplicationDictionary
can be deleted with TextEdit or Property List Editor
Mac OS X
sudo tmutil associatedisk -a "/Volumes/NewDisk" "/Volumes/BackupDisk/Backups.backupdb/MPro3/Latest/OldDisk"
#change name of disk being backed up with time machine
# ssh as a SOCKS proxy
ssh -D 2001
defaults write _AlwaysShowDuplicates -bool true
defaults write _AlwaysShowDuplicates -bool false
used to be without underscore
remove mac os x quarantine
xattr -r -d path/file
xattr -dr diretoryName
xattr -d filename
sendmail -bv address
command line check of deliverability routing
build, word stemming extension, for universal install of php5
rsnapshot.conf multiple rsync long arguments
# ghostscript gxps command to convert xps to pdf
gxps -sDEVICE=pdfwrite -sOutputFile=file.pdf -dNOPAUSE file.xps