Wednesday, September 21, 2011

Cross-cultural chocolate bar taste-off

Particle physics is a highly international field, which means you get to work with people from all over the world and hear about how their country's chocolate is superior to yours.
Today we put these claims to experimental test, pitting English candy bars against their American cousins. Our contestants were the English Mars vs US Milky Way in the nougat+caramel category, and English Milky Way vs. US Three Musketeers in nougat-only.

UKUSA
Caramel & Nougat
Just Nougat


uk milky way

team usa
soft marshmallowey nougat, lacking in body, "like a chocolatey molten peep"
team england
not as good as they used to be, which was like the american 3M but "with decent chocolate"

us three musketeers

team usa
much firmer than uk milky way, much more chocolatey
team england
<grimaces>

uk mars

team usa
creamy chocolate, well-balanced caramel and nougat
team england
best in show

us milky way

team usa
firmer than uk mars, more chocolatey, best in show
team england
at first, indistinguishable from uk mars. after some thought, decided mars was better.

summary:

English people like English candy bars, while Americans like American ones.

"the england one is weak and insubstantial. the american one has some hair on its chest. chocolate hair. egh..."

Friday, September 16, 2011

Setting up the environment in a non-interactive SSH session (Ubuntu)

Problem:

You are using SSH to run commands on a remote Ubuntu host, like
$ ssh remotehost command args

and require that the remote host set up some environment (set PATH, source a script, etc.)

The remote host ignores .bashrc, .bash_profile, .ssh/environment, /etc/profile, etc.

Solution:

At the top of the default .bashrc in Ubuntu, you will find the lines
# If not running interactively, don't do anything
[ -z "$PS1" ] && return

SSH does not execute an interactive shell when called with a command argument, so .bashrc bails immediately. Comment out the second line:
# If not running interactively, don't do anything
# [ -z "$PS1" ] && return

and set up your environment in .bashrc as usual.

Caveat:

bash does not expand $s inside quotes, but for some reason SSH does. running
ssh remotehost "echo $PATH"

will fill in the path on the current machine and tell the remote machine to echo that, so it appears that your current PATH has been forwarded to the remote host. Use
ssh remotehost echo \$PATH

instead.