Archive for the ‘Apple’ Category.

Apache Allow From IP or password

I can never remember the syntax to allow access to a directory from an IP or range of IP’s without a password but falling through to using a password from all other IP’s. The below works in a .htaccess file:

AuthName "some name"
AuthUserFile /some/htaccess.file
AuthType Basic
Order Allow,Deny
Require valid-user
Allow From 127.0.0.1
Satisfy Any

Mac OSX Split files greater then 2Gb

Just discovered that split (version 1.6) on Mac OS X Version 10.4.8 (PPC) does not handle files greater than 2Gb.

I’ve found two work arounds to this problem, the first is the one I typically do, but it requires darwin ports to be installed, I happen to have this installed everywhere anyway.

Darwin Ports

Simply ‘port install coreutils’:

% port search coreutils
coreutils                      sysutils/coreutils 5.97         GNU File, Shell, and Text utilities
% sudo port install coreutils
Password:
--->  Fetching coreutils
--->  Attempting to fetch coreutils-5.97.tar.bz2 from ftp://ftp.gnu.org/gnu/coreutils
--->  Verifying checksum(s) for coreutils
--->  Extracting coreutils
--->  Configuring coreutils
--->  Building coreutils with target all
--->  Staging coreutils into destroot
--->  Installing coreutils 5.97_0
--->  Activating coreutils 5.97_0
--->  Cleaning coreutils
%

Thats it, the only caveat is the new GNU split is named gsplit. So remember to type that when you want to split files over 2Gb!

Compile from source

The second method was found here. I like to keep things in my own logbook so I’ve put a copy of the instructions below

  1. Download the latest NetBSD split source from here
  2. Add the following somewhere near the top:
    #include
    
  3. Compile with either:

    For your architecture:

    cc -Os -o split split.c
    

    Or a Universal binary:

    cc -Os -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc -o split split.c
    
  4. Copy the binary in place:
    $ sudo mv /usr/bin/split /usr/bin/split.apple
    $ sudo cp split /usr/bin/split
    $ sudo chmod ugo-w /usr/bin/split
    $ sudo chmod ugo+rx /usr/bin/split
    $ sudo chown root:wheel /usr/bin/split
    

Adjusting prefs from the command line

To adjust the various system preferences from the command line you need the systemsetup utility which ships with OSX Server although I’ve found some versions of OS X client have it installed in /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support. On my G5 with Tiger (10.4.8) installed I used systemsetup-tiger and on my iMac (Intel) that was missing so I used systemsetup-panther which also worked.

You can adjust all sorts of things with the tool -help shows you all the options, I wanted to adjust sleep times. Below is an example session, showing the settings before and after I had made the change

# ./systemsetup-panther -getsleep
Sleep: Computer sleeps after 10 minutes
Sleep: Display sleeps after 10 minutes
Sleep: Disk sleeps after 10 minutes
# sudo ./systemsetup-panther -setcomputersleep 60
setcomputersleep: 60
# ./systemsetup-panther -getsleep
Sleep: Computer sleeps after 60 minutes
Sleep: Display sleeps after 10 minutes
Sleep: Disk sleeps after 10 minutes

remote access command line tips

copy tracks from a shared itunes

There may be a better version out there, but this did the job.

Mac OSX ntp

If you want to sync to a time server other than the default apple provided ones you can enter the address into the box in the ‘Date & Time’ preference pane. To enter multiple servers seperate them with spaces as show in the image below. All this actually does is write the information out to /etc/ntp.conf and restarts the ntp daemon. Remember that the file will get overwritten when you access the preference pane though.

osx_ntp

Configuring multiple DNS domains

Okay suppose you are on a corporate LAN and VPN’d into some other private network. You want DNS to resolve the local intranet, but also resolve your VPN’d LAN. If you VPN’d LAN domain is internal.sollicker.com then create;

/etc/resolver/sollicker.com

and in this file;

search internal.sollicker.com sollicker.com
nameserver 172.16.100.15

Then run:

sudo kill -HUP `cat /var/run/lookupd.pid`

2 useful html things

First, a nice css cheat sheet pdf:http://www.ilovejackdaniels.com/css_cheat_sheet.pdf

And secondly a nice colour picker dashboard widget http://www.colourmod.com/

Moving the /Users directory

Recently I needed to move the /Users tree onto another partition on a OS X machine at work, I found this great howto.

Making iDVD use an external dvd writer

I recently bought one of these fantastic Lacie drives. The problem is that iDVD will not let me write to anything other than a superdrive. Then I found this thread. Download the file from there (mirrored here) extract the archive and place the 2 files in your home account. Control click on either the burn dvd button or the burn dvd menu item and it should present you with a list of dvd writers attached to the machine, or the option of writing to a img file.