I’ve recently switched to development in two Vagrant virtual machines (VMs), one VM running Nginx and one running Apache. This means that are two locations I might need to open files from, with two sets of directories representing the document roots of my various development sites. Eventually I got bored of using the terminal to “subl ~/Vagrants/nginx/www/wordpress-whatever/” and decided to write an Alfred Workflow. Now I just trigger Alfred, hit “v client“, and Alfred shows me all my projects in directories with “client” in the name. Continue reading Alfred Workflow to open a directory in Sublime Text
pbcopy terminal command, which adds “stuff” to the clipboard to be pasted later, is really useful. For example, to download some webpage and put the HTML source in the clipboard:
curl -s http://example.com/ | pbcopy
Here’s a WordPress example; want to get some fresh API salts and keys for a
wp-config.php? Try this:
curl -s https://api.wordpress.org/secret-key/1.1/salt/ | pbcopy
Want to be notified when the download and copy are complete? Add the
say command, like this:
curl -s https://api.wordpress.org/secret-key/1.1/salt/ | pbcopy; say 'Ready to paste';
I use DTerm, which is an excellent little “popup terminal” which inherits the current context, and these commands are super handy here.
I tend to find myself in the terminal.app on my Mac more often than not, SSHing into servers, checking whois, host, and any number of other things. My most frequent incantation is searching the command history so I don’t have to re-type a previous command, something like this:
grep curl ~/.bash_history
I’ll then copy and paste the command and hit return. It’s pretty quick, and I’ve got the muscle memory right down now… but there’s got to be more elegant commands, right? Or course there are. Continue reading Speeding myself up on the commandline
Over the last few hours I’ve installed ImageMagick on MacPorts (super easy), and imagick on PECL (not so much). Xentek‘s post on ImageMagick and imagick was a great help, and got me past the first brick wall I hit (passing in the ImageMagick prefix to prevent it complaining about Wand-config)… but then I couldn’t get the darned extension installed. Anyway, here’s the steps I went through, and if anyone has any suggestions for improvements I’m all ears. Continue reading Installing ImageMagick on MacPorts and imagick on PECL
I’ve recently had to switch laptops while my main machine is in for repair (again), and this has reminded me of an issue I seem to encounter with MacPorts PHP. I make extensive use of the PHP function
error_log during development, to track variables and ensure that things within the code are as I expect.
Maybe it’s me, but MacPorts PHP seems to have an issue writing to an error log unless you do some quick configuration. So, as this blog is meant to function partly as my outboard brain, here’s what I had to do. (Some of this gleaned from patient advice given by Ryan, the MacPorts PHP maintainer, on a misguided bug report I filed.) Continue reading PHP error logs with MacPorts on OSX
Just put together a quick Fluid app for Twitter Search. (Fluid is a Mac specific browser designed to be used with just one app, and together with it’s user scripts, think Grease Monkey, you can mimic basic application functionality.
To do this you will need to:
- DownloadÂ Fluid
- Download the Twitter auto-reload script
- Download my lovely Hash Tag icon
- Open your Fluid app
- Enter the URL for your Twitter hashtag search, I’m at WordCamp UKÂ so I entered:Â http://search.twitter.com/search?q=%23wordcampukÂ as the URL (you can obviously change the Hashtag in the search as appropriate).
- Give the Fluid app a memorable name
- Pick an icon (the one linked above is quite pretty)
- Click “Create”
- Select the curly script icon from the menubar (to the right of the “Window” menu) and choose “Open Userscripts Folder”
- Drop the Twitter auto-reload script into the folder (then close it)
- Go back to the script menu, and choose “Manage Userscripts”
- Check the box to enable”Auto reload”
- Ensure that Include has only one entry of “*” and Exclude is empty then close the dialog
- Refresh the window to kick off the new script (Apple+R)
My phone used to sync with iCal several times a day, but when I upgraded to Leopard it wiped my cron tab file and all that goodness stopped. (Your crontab file is a way of scheduling tasks on your Mac using the Terminal application.) I’ve just googled around for the solution and found it again:Â Use cron to automate iSync at non-standard intervals. Nice neat solution, to which I would only add the following: 0 8,10,12,14 * * * osascript -e ‘tell application “iSync” to synchronize’ >> /dev/null Whenever a Cron command runs, any output is sent by email to the account handler. This simply builds up as unsendable email in the system, or spams you every time the script runs… either way it’s not good. The >> /dev/null simply sends any output into a black hole so it doesn’t bother me.
Originally I’m sure I had this set so iSync closed down again when it was done… so maybe more to follow.
It took me ages to find the answer to this, so I figured I’d post the answer for posterity; hopefully between us, Google and I can help the next person avoid that hassle.
I’ve created a Debian virtual server in Parallels for some development work. To ease the pain of mounting drives, I’ve configured AFP (Apple File Protocol) on the server. (As a sidenote: there’s some issues with Debian’s AFP package, netatalk, and OS X Leopard which mean you have to recompile netatalk, for which you can find instructions here. You probably also want to have your server auto-discovered and appearing in the “Shared” areas of the finder, for which you can find instructions there. Some Debian chutzpah will be required to follow both these sets of instructions.)
All was running well, and I was happy, until one day the drives stopped mounting… Continue reading Problems mounting a Debian drive over AFP
With a lot of help with Ross Barkman‘s handy modem scripts, I’ve managed to create a bluetooth modem connection with my Nokia 6300 on (UK) Orange. On the off chance that this is useful to someone else, here’s what I did…