Optimize and automate your developer laptop environment

Tags: python, pun, apple

(I gave this talk at the Dutch Python meeting)

On the mailinglist, Remco Wendt asked for talks about making your practical development life more efficient. I recently cleaned up my mac, so my setup is nicely optimized again. And I know exactly where everything is, now. So I jumped in to give a talk.

My core tip: automate explicitly. Don’t just fool around. You’re bound to collect tips and tricks and snippets of bash configuration and small python scripts and so on. Don’t just dump it somewhere in your config file or on your path, but do it in a neat way. Make sure it is version controlled, otherwise it might just as well not exist. You move to a fresh laptop and you’re reduced to searching for old mails from colleagues to get your hands on that handy bash script again… So: collect everything, but be explicit about it.

I have a ~/tools/bin/ directory on my path. It is on github: https://github.com/reinout/tools, including a reasonable README in case you want to browse what I’ve collected.

  • Small shell scripts, many just one or two lines. For instance editexternals that just does svn propedit svn:externals . or an svngrep that greps while omitting .git and .svn directories and *.pyc files.

  • Custom-made Python scripts for specific tasks.

  • And a pip requirements.txt file that lists a couple of external Python packages that I want to install. There’s some nice stuff out there!

Dotfiles is handy. Your home directory is full of configuration files and directories that start with a dot (so: hidden files). .gitignore, .buildout, .profile. Dotfiles allows you to keep all those files in one version-controlled directory with symlinks in your homedir. It is a simple single-purpose script that works really well.

Comments about version control. I’ve got lots of code on github, bitbucket, Plone’s svn repository and other public places. But… my dotfiles, for instance, sometimes contain passwords. FTP accounts, pypi plaintext password… I don’t want that on github :-) Luckily I have my own small linux server (together with my brother, hosted at bytemark). So I can put private repositories on my server. SSH access is enough. git clone ssh://vanrees.org/~/git/Dotfiles or hg clone ssh://vanrees.org/hg/preken.

All those checkouts… I have 31 git, 22 svn and 9 mercurial checkouts right now. No way I’m going to do a git pull or svn up on each of them every morning. By hand. No way. So I wrote checkoutmanager to make my life easier. checkoutmanager up does svn up, hg pull -u and git pull on every one of my checkouts. checkoutmanager st shows me which files are uncommitted in each of ‘em. And, important for distributed version control, checkoutmanager out reports which commits haven’t been pushed to the server yet. This makes sure you don’t forget anything. Very handy.

A small note on backups. Automation is fine, but you also need to feel safe. So automate this, too. Timemachine on OSX is handy. I’ve set up Ubuntu One for backup and sync for my wife’s and kids’ laptops. Works fine, too. Lots of my stuff is in git/hg/svn, so that’s automatically backed up. The mail is in IMAP in gmail’s clutches and with a copy on my own server. For backup tasks on the server, look at backupninja. The name is a bit funny, but it works real well. Easy to set up for various backup tasks. (Bytemark, where we have the server, have off-site rsync backup space for every account: handy).

Opmerking voor nederlandstaligen: we hebben weer een vacature bij Nelen & Schuurmans , waar ik werk. Iemand die kan programmeren maar die het liefst ook in de richting van projectmanagement en/of ontwerp wil kijken. Hartje Utrecht.

 
vanrees.org logo

Reinout van Rees

My name is Reinout van Rees and I program in Python, I live in the Netherlands, I cycle recumbent bikes and I have a model railway.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):