# C[omp]ute

Welcome to my blog, which was once a mailing list of the same name and is still generated by mail. Please reply via the "comment" links.

Always interested in offers/projects/new ideas. Eclectic experience in fields like: numerical computing; Python web; Java enterprise; functional languages; GPGPU; SQL databases; etc. Based in Santiago, Chile; telecommute worldwide. CV; email.

© 2006-2013 Andrew Cooke (site) / post authors (content).

## Chilean Charity Supporting Women

From: andrew cooke <andrew@...>

Date: Wed, 4 Dec 2013 09:39:49 -0300

This was mentioned in an article in the paper this weekend.  I am out of touch
with such things so when I feel guilty enough about my life to make a donation
to someone I can never remember who to give it to.  These people seem to be
doing decent work.  http://www.fondoalquimia.org

Andrew

## Previous Entries

### Doing SSH right

From: andrew cooke <andrew@...>

Date: Wed, 4 Dec 2013 09:36:16 -0300

When you use ssh you should really do (at least) two things:

* Use public keys instead of passwords (copy your id_rsa.pub to the
remote .ssh/authorized_keys file).

* Protect your private key with a password.

The first of these makes your life easier because you no longer have to type
passwords.  So I did it long ago.

But the second is a nuisance because you have to type a password (again) every
time that you use ssh.

Of course, there is a solution to this problem.  You can run a program - an
"agent" - that remembers the key for you.  This program is called ssh-agent.

At this point I must admit that I don't understand how to configure ssh-agent
in OpenSuse 13.1.  It doesn't seem to run by defeault, yet after you use it
manually once it does seem to be started by default in future.  And when it
runs automatically it is somehow connected to dbus and X.

Even though I don't understand those details, it's clear why it's connected to
X - that's something that starts once per user on the machine and so is a good
place to start the agent.

Unfortunately, that means that the agent is only visible to sessions running
within X.  Which means that my scripts to do things like manage my blog from
email no longer work.

Fortuately there's an easy fix.  Everything works with environment variables,
so you can dump those to a file when you start X and then load them in
scripts.

Everything is described at
http://www.stderr.nl/Blog/Software/Linux/ScreenAndX.html and it works
beautifully - just place the code that they use at the prompt inside the
script that uses ssh.

Andrew

### Festival of Urban Intervention

From: andrew cooke <andrew@...>

Date: Wed, 4 Dec 2013 08:29:00 -0300

http://www.hechoencasa.cl

Nothing near me (yet) - http://www.hechoencasa.cl/mapa

Andrew

### Neat Idea - Wormholes Provide Entanglement

From: andrew cooke <andrew@...>

Date: Tue, 3 Dec 2013 22:32:57 -0300

Seems like it runs around the idea of action at a distance.  Cute.

Andrew

### Simple Encryption for Python 2.7

From: andrew cooke <andrew@...>

Date: Sun, 1 Dec 2013 20:09:27 -0300

Thanks to https://github.com/d10n the simple-crypt library now works with
Python 2.7 as well as 3.

When I originally wrote simple-crypt, it was intended as a "poor man's
keyczar", which didn't exist for Python 3.  My plan was to retire simple-crypt
when keyczar moved to 3.

But it seems there's a real demand for simple-crypt, as something simpler than
keyczar.  Now, to some extent, I think that's people being lazy.  They
*should* use keyczar, even if it's more work.  But maybe that's not
everything.  And people continue to re-implement this kind of code, getting it
hopelessly wrong (see regular questions on StackOverflow).  So simple-crypt is
staying, and expanding...

Andrew

### Tecnofull (Lenovo Support) Is Fucking Useless

From: andrew cooke <andrew@...>

Date: Sat, 23 Nov 2013 18:16:57 -0300

My X220 died.  A search on the web showed that http://www.tecnofull.cl/ were
authorized support.  And they had offices at the end of my street.  Great.

They diagnosed (after 5 days) the following issues:

* A broken power socket (awful design with X220 and the socket at the read
- every time you pick it up, you put load on that point)

* Dirty and needing new thermal paste (my daily machine for many years
and was overheating)

* Dead trackpad (errr.... no, it's just disabled in BIOS).

OK, so far not so bad.  Anyone can forget to check BIOS and the other points
were fine.  So I asked for the first two to be repaied.

A week later, it was ready, so I paid and brought it home.

Is should have said that I left it without disk or battery (less to lose).  So
when I got home I installed the disk.  Or tried to.  I couldn't because some
cables were in the drive bay.

So I took it back.  And they claimed to fix it (I think they just pushed the
cables back and forced the disk in, because there wasn't time to take things
apart, but maybe I am just slow).

When I got it home again, in a more relaxed moment, I realised that the screen
hinges wobbbled.  So I took it back.  And they said that they could tighten
the case screws a little, but that it was normal (and my fault for the machine
being dirty originally, although the logic there missed me).

When I got it home again, it wouldn't power up.  Taking it back to the shop,
the receptionist mashed the power buttong and it worked.  It seems like the
power button is damaged and needs an incredible amount of pressure.  But they
say it's normal.

So I took it home again, and now I've started it again and wifi is dead.

I give up.  I'm not taking it back again.  They're clearly incompetent and do
more damage each time the have the machine.  Instead, I'll rescue data from
the disk, use it on ethernet, and get the X240 1080p when it's released.

But if you don't have money to buy a new machine you might want to avoid these
people.

Andrew

### The Neuroscientist Who Discovered He Was a Psychopath

From: andrew cooke <andrew@...>

Date: Sat, 23 Nov 2013 17:22:25 -0300

This is surprisingly touching, and a convincing argument for the importance of
nurture v nature.

http://blogs.smithsonianmag.com/science/2013/11/the-neuroscientist-who-discovered-he-was-a-psychopath/

Andrew

### Interpolating Polynomials

From: andrew cooke <andrew@...>

Date: Sat, 23 Nov 2013 16:30:08 -0300

I've implemented this by hand so many times for quadratics - for example
finding the peak of a correlation function - but just a month or so ago
someone at work asked what I was doing and apart from deriving it from basics
I had no "go look at this in Wikipedia" response.  Well, here it is -
Neville's Algorithm http://en.wikipedia.org/wiki/Neville's_algorithm

Andrew

### Bottlehead Crack, AKG K701

From: andrew cooke <andrew@...>

Date: Fri, 22 Nov 2013 00:31:26 -0300

After a series of misunderstandings, mostly on my part, I ended up with a
Bottlehead transformer that I had no use for.  Returning it (from Chile)
seemed like a waste of money, so I bought the kit that went with it.  Which
turned out to be the Crack headphone amplifier.

The kit was great.  A real pleasure to build.  Everything included and
excellent instructions.  I don't think there was a single error in the
instructions, although I would suggest:

* Reading ahead and changing soldering order if it makes things simpler
(nothing critical, perhaps just my taste)

* Measuring wire lengths yourself rather than using the lengths given (you
can't for the twisted pair; the value they give there is very generous)

* Thinking about wire colours yourself.  The colours chose were strangely
inconsistent at times.  This doesn't change the sound, but makes it harder
to "read" and check the circuit.

I must admit I had a bad solder joint, but once I fixed that it worked
perfectly.

So I have a valve headphone amp.  Unfortunately it's intended for high
impedance headphones and the highest I have are the not-very-high AKG K701s.
So I tried those.  And actually, they don't sound that bad.  There's
significantly more bass (and low mids) than there should be, but since the
K701s have quite a lean sound that isn't altogether unwelcome.

On a first listen, what struck me most, after the bass, was the stereo
imaging.  I haven't made a direct comparison, but it seemed significantly
better than what I am used to (through either Music Fidelity V-Can or a Roksan
K2).  In fact, I don't normally pay much attention to stereo positioning - I
noticed it here because it "jumped out" (in fact, I was listening to a live
Paul Motian recording and thought someone was talking behind me; very
disturbing)

Next I am thinking of connecting it as a pre-amp.  As far as I can see, if I
feed each channel to a 220 / 22 ohm divider, and take the signal from across
the 22 ohms, it should (1) be about the right level and (2) have about the
right output impedance.  It's kind of a weird way to do things (a lot of extra
work), but since it's there anyway...

Andrew

### Breaking RC5 Without Rotation

From: andrew cooke <andrew@...>

Date: Tue, 19 Nov 2013 00:51:58 -0300

This is the first task in Scheneier's DIY course on block ciphers -
https://www.schneier.com/paper-self-study.html - so presumably it should be
easy.

The task is for 8 rounds.  I managed zero and was stuck at 1.  Then this
evening I had a neat idea for how to do 1 round - you can see the test at
https://github.com/andrewcooke/BlockCipherSelfStudy.jl/blob/master/src/Experiment.jl#L5
- but there is no way I can scale that to 8 rounds.

So I went to bed.  And as soon as my head hit the pillow, I got it (I think /
hope).

The frustrating thing was, without rotation, RC5 is "linear".  Hence it should
be easy.  That's what everyone implies.  But it wasn't clear to me what
"linear" meant.  In particular, RC5 combines addition (mod 2^32) with XOR.
And XOR is addition mod 2.  And so I was thinking - how can I make those work
together?  I imagined my little spinnning clock hands, which is pretty much
the limit of my intuition for modular arithmetic, and it struck me that I can
fit one inside the other!

All that means, really, is that I start with the least significant bit.  That,
I can solve for (I think!).  And with that, I can do the next bit (the carrys
from addition become just constants).

So I am writing this down now so I can go back to bed without worrying I will
forget...

Andrew

PS Maybe I am too optimistic.  Why does he limit it to 8 rounds?  Need to
sleep, must stop thinking...

### Big Balls of Mud

From: andrew cooke <andrew@...>

Date: Sat, 16 Nov 2013 16:49:43 -0300

Readable, pragmatic, wise, useful discussion of practical software development
- http://laputan.org/mud/

Andrew

### Phabricator - Tools for working together

From: andrew cooke <andrew@...>

Date: Fri, 15 Nov 2013 22:09:50 -0300

http://phabricator.org/

Code review, bug tracking, etc.  New to me, but look spretty complete (and
free).  Was developed at Facebook (written in PHP).

Andrew