Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Dean Allen

« Newer Snippets
Older Snippets »
6 total  XML / RSS feed 

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/

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.

Textpattern clean urls with Lighttpd, the elegant way

I love this shit:

server.error-handler-404 = "/index.php"

Add all new files to svn repository

This saves considerable time, and it's recursive:

svn add --force *

Clean Textpattern install from the current repository

In a shell, cd to the directory from which you'd like to serve the site, and rename or delete any '.htaccess' or 'index.php' files, and any directories called 'images' or 'files', that may be there.

Checkout the current code:

svn co .

(Note the dot at the end). To complete the installation, just load http://thesiteurl/textpattern/ in a browser, fill in your database info, and when presented with the config.php block, copy it, go back to the shell client and:

nano textpattern/config.php

Paste in the code block, save and exit (ctrl-x, then y, then return).

Back to the browser, click through, add personal details, and that, as they say, is it.

Whenever you want to update to the latest code, cd to the same directory and:

svn update

...and the latest code will be seamlessly integrated with your installation.

Generate secure ssh keys

Here's how to get to a quick secure shell login. On your computer (replace all values in CAPS of course):

cd ~
ssh-keygen -t dsa

(just hit return at any prompts, even if it asks for a password). Then:

scp ~/.ssh/

And put in the password for your account when prompted. Next, add the following to ~/.ssh/config:

Port 22
KeepAlive yes                                                                   

Restart the local shell, and then whenever you want to login to your server, just type:


...and you'll zip right in.

Print PHP errors to screen

We keep error reporting off for safety reasons, but if you're baffled as to why something's not working, you can temporarily view errors by popping this into your script:


And fer pete's sake remember to remove it afterwards.
« Newer Snippets
Older Snippets »
6 total  XML / RSS feed