Make a typeface (font) sampler with AppleScript

Every wanted to find just the right ampersand? Or question mark? Checking it against every font in your system manually would be a pain. Font Book doesn't have the font sampler feature you need to do this. But the problem can be solved with ... AppleScript: tell application "TextEdit"   make new document at the …

HOWTO set up an SOCKS proxy via an SSH tunnel on Mac OS X

Recently, I came across some streaming video that was only available to Canadians. Being a Canadian in the US, I felt somewhat entitled. Yes: I wanted to watch a hockey game. I knew I could do this with an SSH tunnel. I just wasn’t sure how. There are lots of pages explaining how to set …

MySQL: permissions needed for mysqldump

If you want to give a user permissions to back up a MySQL database, what do you do? The MySQL GRANT page didn’t tell me. Searching wasn’t helpful. Here’s the answer, in the hopes it will help others: SELECT and LOCK TABLES. mysql> grant select, lock tables on foo.* to bar@localhost indentified by ‘ugh’; mysql> …

HOWTO get the real host name of your server in PHP

In PHP, to get the name of the web server, you can print $_SERVER[“HTTP_HOST”]. However, if you use round-robin DNS or a load balancer, this will give you the name Apache thinks your machine is. What if you want the real hostname — what you’d get from hostname or uname? print gethostbyaddr(“127.0.0.1”); That’s all. It …

How to create a self-signed SSL certificate for Dovecot on Debian

Here is how you create a self-signed SSL certificate for the Dovecot IMAP/POP server on Debian Linux: openssl req -new -x509 -days 1000 -nodes -out “/etc/ssl/certs/dovecot.pem” -keyout “/etc/ssl/private/dovecot.pem” The default is 365 days, but I upped it to 1000, so I don’t have to do this so often. Dovecot does this on installation via /var/lib/dpkg/info/dovecot-common.postinst; …

Learn how to name files—hey Comcast, this means you!

People are really bad at naming files on their computer. How many times have you walked up to someone’s desktop to see half a dozen “untitled folder”s, several “documents” and files with other generic names like “resume,” “proposal” and “draft”? Are you really going to remember what’s in that file tomorrow? In two months? In …