« Newer Snippets
Older Snippets »
Showing 41-50 of 50 total

Reverse DNS from command line

Quick and easy way to look up a domain name given an IP address.

dig -x 17.254.3.183


Flush DNS cache

In Terminal, type:

lookupd -flushcache

stop creating useless .ds_store files on your non-mac network share

http://docs.info.apple.com/article.html?artnum=301711

1. Open the Terminal.
2. Type:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true

3. Press Return.
4. Restart the computer.

now you'll no longer fill the windows file server with annoying .ds_store files. you'll no longer unknowingly commit hundreds of irrelevent .ds_store files to your subversion repository mounted over webdav with auto-versioning. rejoice.

Change Default Screen Capture Format in OS X

Enter the following into Terminal:

defaults write com.apple.screencapture type *format*


In place of *format* in the above put any of the following, depending on your preference:

jpg
pdf
tif
png - this is the default

(There may be others. Feel free to add these to the comments.)

Lighttpd launchd item for OS X 10.4

Save the following in /Library/LaunchDaemons/net.lighttpd.plist to have lighttpd start automatically on any OS X 10.4 computer. Note that this assumes a working DarwinPorts lighttpd installation (otherwise you will need to change the paths to the lighttpd executable). Note that this also assumes that the lighttpd.conf file is in /opt/local/etc.

<?xml version="1.0" encoding="UTF-8"?>
DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Labelkey>
        net.lighttpd</string>
        <key>OnDemandkey>
        />
        <key>Programkey>
        /opt/local/sbin/lighttpdstring>
        ProgramArguments</key>
        <array>
                <string>/opt/local/sbin/lighttpdstring>
                -f/opt/local/etc/lighttpd.confstring>
                -D</string>
        array>
</dict>
plist>

Search for open files that won't allow you to unmount a server volume

lsof | grep "Office Server"

Lists out all open files on a given volume ("Office Server" in this case.) Good to find those peskey open files that won't let you eject a mounted network volume.

Opening a G4 iMac CD/DVD tray with a non-Apple keyboard

In the Finder, drag the following file to the menu bar:

/System/Library/CoreServices/Menu Extras/Eject.menu


You'll see a handy pulldown menu appear, which can be used to open the cd tray or eject any optical device. No more bashing F12.

Set the default compiler on Mac OS X Tiger

Some stuff won't compile with the shiny new gcc 4.0 on Tiger.
To use gcc 3.3 :
sudo gcc_select 3.3


To revert to gcc 4.0 :
sudo gcc_select 4.0


(found on the forum, thanks Damelon!)

MySQL launchd item for Mac OS X Tiger

(Originally posted at Unquiet)

I had to reinstall Mysql because it wasn�t one of the things I backed up before erasing my hard drive. Since I�m now running Mac OS X 10.4 �Tiger�, I decided to set it up to start when the system boots, but the system for creating startup items has changed slightly. So I saved the following xml in /Library/LaunchDaemons/com.mysql.Mysql.plist:

<?xml version="1.0" encoding="UTF-8"?>
    DOCTYPE plist PUBLIC 
         "-//Apple Computer//DTD PLIST 1.0//EN" "
        http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Labelkey>
        com.mysql.Mysql</string>
        <key>OnDemandkey>
        />
        <key>ProgramArgumentskey>
        
                /usr/local/mysql/bin/mysqld_safestring>
        </array>
        <key>ServiceDescriptionkey>
        Mysql 4.1 Database Server</string>
        <key>UserNamekey>
        mysql</string>
        <key>WorkingDirectorykey>
        /usr/local/mysqlstring>
    </dict>
    plist>


Note that I'm using the official OSX distribution of MySQL... but with a few changes to match your database location, you can get this to work with other installs (fink, darwinports, etc).

lighttpd as a startup item on os x

Create the /Library/StartupItems/Lighttpd directory, put both the Lighttpd (chmod +x) and the StartupParameters.plist (I don't really know what this does at all) files into the directory. (this is on jaguar, before the new launchd came out in tiger).

Then add the following line to /etc/hostconfig:

LIGHTTPD=-YES-


You can start, stop and restart lighttpd using /Library/StartupItems/Lighttpd (start|stop|restart) now, and it will startup when OS X boots.

-------- Lighttpd
#!/bin/sh
#
# /Library/StartupItems/Lighttpd/Lighttpd
#
# Script to startup lighttpd with OS X booting.
# OS X 10.3 Jaguar
# modified by kjell olsen
#
# adapted from the startup mysql
# (c) 2003 MySQL AB
# Written by Lenz Grimmer 
#

# Suppress the annoying "$1: unbound variable" error when no option
# was given
if [ -z $1 ] ; then
        echo "Usage: $0 [start|stop|restart] "
        exit 1
fi

# Source the common setup functions for startup scripts
test -r /etc/rc.common || exit 1
. /etc/rc.common

# change config and script to match your machine's lighttpd config and lighttpd
CONFIG="/etc/lighttpd/lighttpd.conf"
SCRIPT="/usr/local/sbin/lighttpd"

StartService () 
{
  if [ "${LIGHTTPD:=-NO-}" = "-YES-" ] ; then
    ConsoleMessage "Starting Lighttpd Server"
    $SCRIPT -f $CONFIG
  fi
}

StopService ()
{
  ConsoleMessage "Killing Lighttpd Server"
  kill `cat /var/run/lighttpd.pid` 
}

RestartService ()
{
        ConsoleMessage "Restarting Lighttpd server"
        /Library/StartupItems/Lighttpd/Lighttpd stop
        /Library/StartupItems/Lighttpd/Lighttpd start
}

if test -x $SCRIPT ; then
        RunService "$1"
else
        ConsoleMessage "Could not find lighttpd startup script!"
fi

Be sure to change $SCRIPT + $CONFIG to work with your own lighttpd.

-------- StartupParameters.plist
<?xml version="1.0" encoding="UTF-8"?>
DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Descriptionkey>
        Lighttpd 1.13</string>
        <key>OrderPreferencekey>
        None</string>
        <key>Provideskey>
        
                Lighttpd</string>
        array>
        Uses</key>
        <array>
                <string>Networkstring>
                Resolver</string>
        array>
        </dict>
plist>


Again, I'm not exactly sure what this does. I copied it from the MYSQL one and changed the description and provider, left "uses" alone.
« Newer Snippets
Older Snippets »
Showing 41-50 of 50 total