Ever wished you could tell iTunes to stop playing your music after a little while? Here’s how to make a sleep timer with AppleScript: display dialog “How many minutes until I pause iTunes?” default answer 10 delay ((text returned of result) * 60) tell application “iTunes” to pause
Category Archives: tech
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 …
Continue reading "Make a typeface (font) sampler with AppleScript"
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 …
Continue reading “HOWTO set up an SOCKS proxy via an SSH tunnel on Mac OS X”
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 …
Continue reading “HOWTO get the real host name of your server in PHP”
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; …
Continue reading “How to create a self-signed SSL certificate for Dovecot on Debian”
Canada’s DMCA == evil
How to block Facebook ads
This will prevent many of the annoying ads from showing up on Facebook: sudo echo “127.0.0.1 ads.ak.facebook.com” >> /etc/hosts One would think with all the demographic data they have about me, they could show me relevant ads. One would be wrong.
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 …
Continue reading “Learn how to name files—hey Comcast, this means you!”
Four-year-olds already get it
Clay Shirky explains the future: I was having dinner with a group of friends about a month ago, and one of them was talking about sitting with his four-year-old daughter watching a DVD. And in the middle of the movie, apropos nothing, she jumps up off the couch and runs around behind the screen. That …