Symphonious

Living in a state of accord.

How To Round-Trip Data Via SSH

I keep forgetting this so for the record, you can use SSH to round trip data out to a remote server and back to your own box.  This is most useful for adding latency and bandwidth limitations to a connection when doing website testing.  The trick is to use both local and remote port forwards:

ssh -L 9090:localhost:9091 -R 9091:localhost:80 remote.server.com

The -L argument starts listening on port 9090 locally and sends all that traffic to port 9091 on the remote server (the domain name, localhost, is resolved by the remote server so it refers to the remote server, not your local machine).  Then the -R argument listens on port 9091 of the remote server and forwards all that traffic back to your machine’s port 80 (here localhost is resolved on your local machine).

You don’t have to use localhost as the domain name. For example, if the site you want to test is deployed on your intranet at testmachine.intranet which remote.server.com doesn’t have access to, you could use:

ssh -L 9090:localhost:9091 -R 9091:testmachine.intranet:80 remote.server.com

Or if the test site is publicly available you can do it all without the -R argument:

ssh -L 9090:testmachine.com:80 remote.server.com

In all these cases, you connect to localhost:9090 to utilise the tunnel.

Who’s Committed in my Git Repository?

Note to self: if you ever want to get a simple list of people who have committed to a git repository, the command you want is:

git log --format='%aN <%ae>' | sort -u | uniq

Or for just the e-mail address:

git log --format='%ae' | sort -u | uniq

Or for just the name:

git log --format='%aN' | sort -u | uniq

This is in the help manual but it’s way down the bottom so takes ages to read through to find it.

RightScale AWS Amazon EC2 Library for Ruby

I’ve always known you could do a lot of programmatic stuff with Amazon but I’ve simultaneously been too lazy to actually look into it in detail and never really needed to. However, I’ve stumbled across instructions for auto-mounting an EBS volume which turns out to be very handy, and leads on to the particularly awesome right_aws ruby gem.

Lots of useful looking stuff for working with EC2, S3 and EBS volumes that I can see me taking a lot more advantage of in the future.

Stuff I Might Need Someday

A few things I’ve discovered today that look potentially useful in the future:

  • Antenna House Formatter V5 – converts HTML and CSS to PDF, including support for MathML. Heck, supporting CSS well is a plus – most HTML to PDF conversions don’t. Hat tip to one of our clients for finding that.
  • jQuery Tools – there are plenty of JavaScript UI libraries around, but this one looks better componentized than most. It’s also a good, small set of components that normal web pages are likely to want, rather than being more specifically useful in web applications, though it could be used there too.
  • FlowPlayer – actually I knew about this one but only just got around to looking at the details. Handy looking open source flash video player. They’ve somehow converted the GPL into a license that requires attribution which is really odd, most likely to keep their commercial licensing option open. It’s their license so they can do what they want with it but I would have thought there’d be a better fitting license.