Well, it’s official – I’ve been working on the new project, Truvay. I think it’s going to be an awesomely useful site. As part of my contract, I get the opportunity to write a blog post on Carsonified.com every week. So I figure I might as well use this first week to raid for twitter followers spread the awesome give you guys some handy OSX hints that I’ve picked up along the way. Hopefully there’ll be some you don’t know. What’s that? You’re on a PC? Well, that’s a shame. How sad, too bad.
I’m sick of the lists that say “prioritize your tasks by due date” and “give yourself a break every 15 minutes”. They’re great, and they offer great advice, but everybody who has a blog has written one. They’re safe and easy, and they’re tips you can’t really argue with. Where’s the value? So this week, I’m focussing on some really geeky tips. There’s a good chance you’ll know some of them. If some of them are a bit over your head, please feel free to skip them. But if I’m wrong about anything, let me know. I’d rather look like a fool than have you guys get the wrong info. I’m not going to just write some generic list of boring safe tips so I can’t get in trouble – these are real tips that I use. If they break your computer, you’ll have to fix it, but you should have backed up. On that note:
TIP ZERO IS BACK EVERYTHING UP ALL THE TIME. Yeah, this one should go without saying. I use Time Machine. If you’re not backing everything up, you’ll be afraid to make any mistakes – and if you’re afraid to make any mistakes, you won’t learn anything. So give yourself plenty of leeway by backing your stuff up. Then back up your backups until it makes you recurse.
1) Speed up SSH connection startup time:
Put this text into a file called ~/.ssh/config
Host * ControlMaster auto ControlPath ~/.ssh/master-%r@%h:%p
It’ll speed up multiple SSH connections to the same host by using the same TCP/IP connection. This should save you a bit of hassle. 2) If you have Python installed, which you should, add this text to your ~/.bash_profile file (or ~/.bashrc file on Linux):
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
Then, when you’re in a directory in the terminal, simply type “webshare” and hit enter, and your files will be available at your.ip.here:8000 – perfect for quickly sharing files over a network. But remember not to leave this running.
2.5) You can add this code to your .bash_profile as well, to highlight Git folders and branches in your command line prompt like in my example. It shows who you’re logged in as, the computer name, what folder you’re in, and what Git branch you’re in – if you’re using Git. Nice and useful. Like this:
3) Hold down CMD and click to interact with background windows in OSX. You can click buttons, highlight text, drag, close, minimize, maximize… lots of things. While it sounds like a gimmick, this is actually surprisingly useful. However, watch out for the text, because apple-clicking the text in the window’s title bar is also a shortcut for the next tip…
4) Selecting a directory on the path you’re in. Safari and Finder enable this – right-, ctrl- or cmd-click on the text in the title bar of a window, and it gives you a drop-down list of the parent directories. In Safari, this means the parent folder of the current page. You can then quickly and easily navigate to a parent or grandparent folder. 5) Dragging widgets off the dashboard: As a precursor, use these useful widgets:
- iStat Pro (for watching how hot your computer gets)
- Transmit drop zone widget (for drag and drop FTP goodness)
- Uptime (so you can brag to PC users about how you never have to restart)
Then, once you’re in the dashboard, click and drag a widget, and then while still dragging, hit the dashboard button. Voila, a widget on your desktop. It’s just like using Vista! Come back next week for a list of awesome widgets.
6) Get the MultiClutch preference pane to enable multi-finger gestures on Leopard. It’s awesome – I use three finger swipes: Swipe Up for CMD-N, Swipe Down for CMD-W, and left and right for next/previous tab. The settings can be changed per-application, too, since not all programs use the same options. Adium uses CMD+left/right for switching chat tabs, for instance. If I could export them for you, I would have. But I can’t, so I didn’t.
6.5) In case you noticed my awesome time format in my menu bar – you can do that too! It just takes a little bit of copy-and-paste-fu. The instructions are a little verbose for here – but there’s a good example here.
7) Exposé and then Spaces: Hit your Exposé shortcut key (F8 by default), and then hit your spaces key. All your applications are shown exposé style (read: they’re all visible) but under Spaces. They resize themselves when you drag them around. Pro tip: if you hold down CMD, all the windows for an application will drag together.
8) Shortcut keys:
Ctrl-scroll – zoom in and out
Ctrl-alt-CMD-8 – crazy backwards inverse screen mode
CMD-option-H – hide all other applications
Ctrl-shift-eject – turn the screen off
File Browser Prompt:
CMD-D – go to the desktop folder
CMD-H – go to the home folder
Ctrl-E – end of line
Ctrl-A – start of line
Option-right – end of current or next word
Option-left – beginning of current or previous word
CMD-L : current address
CMD-option-F: highlight the search bar
CMD-option-W : close all other tabs
9) You’ll need Spark to help you create these next few shortcuts. Spark is a fantastic hotkey-mapping program for OSX, which comes with a cool and powerful language called AppleScript. You can use this to do loads of cool things – including running shell scripts! That’s what we’re going to use it for. Go check it out – make some shortcuts for apps and folders and stuff, and come back. Don’t worry, I’ll wait.
10) TinyURL shortcut key: use this Applescript in Spark to create a TinyURL from your current selection. Hit CMD-1 to create a new Applescript script:
And in that textarea, ignoring the awful formatting, put this:
set the ClipURL to (the clipboard as string) ignoring case if ((characters 1 through 4 of ClipURL as string) is not "http") then return "Malformed URL." else set curlCMD to ¬ "curl --stderr /dev/null "http://tinyurl.com/api-create.php?url=" & ClipURL & """ -- Run the script and get the result: set tinyURL to (do shell script curlCMD) set the clipboard to (tinyURL as string) return tinyURL end if end ignoring
Assign a shortcut key (I use CMD-option-T) and now, when you copy a URL, you can hit CMD-option-T and have a tinyURL instead. Magic!
11) In Spark, Use this applescript to restart apache as an administrator:
do shell script "apachectl graceful" with administrator privileges
Now you’re on the way to automating anything you do in the command line. Git? Rsync? Twitter? dscacheutil -flushcache? Whatever you like. Just be sure to use them loads so they stay stuck in your mind. Plus, if you use all the modifier keys, Shift Control Option and Command at the same time, you’re less likely to override an existing shortcut – plus it’s easy to remember since you’re just mashing them all at once. I use Shift-Control-Option-Command-A to reload Apache, and Shift-Control-Option-Command-R (for restart) to restart Passenger. Sounds way harder than it is. Remember – if computers were heavy metal, keyboard shortcuts would be power chords.
12) Use Lingon to manage your cron jobs. OSX makes running startup scripts difficult – they’re in .plist files, which are a bit tricky to read. Lingon makes this super-easy, so you can run tasks whenever a file is modified, or if anything is placed into a folder, or at a certain time of day… you can even make the task keep running “no matter what happens.” I’m not sure what that means, exactly. I’d like to see the Armageddon edge-case scenario. Anyway, if I had a dedicated computer for work, or if I ever got to the office on time, I’d make a script that started up all my programs for me before I got to work, so at 9am I could sit down to a fully prepared and ready computer with all my apps open.
13) Use DropBox for your Firefox profile folder. This means that your profile folder is backed up to the clouds and you can use your profile from several computers. I haven’t used this much, since I use Safari, but it worked just fine when I was using Firefox. I don’t recommend this if you don’t know what you’re doing, and I don’t take any responsibility if you somehow break your machine. However, once you’ve backed everything up – please don’t break your computer, use this command:
"cd ~/Library/Application Support/Firefox/ && mv Profiles ~/Dropbox/ && ln -s ~/Dropbox/Profiles ."
(via me) and your profile will be backed up onto your dropbox. This is great if you have two computers.So that’s all for this week, ladies – catch me the same time next week or add me on twitter for more cool stuff. Let me know if you have any more tips, or suggestions for my tips, and I’ll include them. I rocked out to Boston, Manowar, ZZ Top and Ozzy while I wrote this post.