# 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).

## Why Not

From: andrew cooke <andrew@...>

Date: Thu, 6 Mar 2014 21:59:18 -0300

http://whytheluckystiff.net/about/

[This *was* the home page of an internet-famous person; looks like someone
bought the name with no idea of the history.  If you knew the original the
difference is amusing.]

Andrew

## Previous Entries

### How I Am 5

From: andrew cooke <andrew@...>

Date: Wed, 5 Mar 2014 00:05:43 -0300

http://www.acooke.org/cute/HowIAm0.html
http://www.acooke.org/cute/HowIAm20.html
http://www.acooke.org/cute/HowIAm30.html
http://www.acooke.org/cute/HowIAm40.html

Now 16 months from being diagnosed, 15 months on Betaferon.

The confusion described in the last report was never really resolved; I am
still having tests that might give evidence for mental impairment (or, at
least, serve as a zero point to make future comparions against).  Although
having taken 2/3 of the tests I suspect you'd have to be in strong denial for
them to detect something unexpected.

Apart from that, and one worry about my throat, things have continued "as
normal".  I am still very slowly improving.  My right hand is still a little
stiff, and the fingers have some pins and needles / waxiness when touched, but
the hand can extend flat with little resistance.  My left foot has less PN
(moved from the sole to the toes) and in general my legs seem stronger.

I still have some problems with the thighs when running; the sides of my chest
below the arms can feel a little swolen at times; the band across my front is
usually present to some degree at night when lying face down on the bed.

Zaps are less frequent; resets too (although I am also trying to pay them less
attention).

A recent blood test showed reduced levels of lymphocytes, which is a known
side-effect of Betaferon (or maybe even a direct effect).  I have some issues
with fungal infections on the skin, but they are minor (sounds worse than it
is!).

The throat issue was over January.  I decided to reduce my Ibuprofen dose (and
am now not taking it at all, except to treat occasional pain) and so cut
lozenge shaped 400mg pills into two.  This gave sharp-edged fragments that
stuck in my throat.  At the same time I had a couple of problems swallowing
while eating, felt there was a numbness when I tilted my head forwards (the
skin folding under the chin), and missed the feeling of hot liquids at the
back of my mouth / throat.

None of this was terribly conclusive.  The pills were a new shape and the
other symptoms could have been always present, and now noticed due to small
improvements.  Things improved over the month (although I am not taking the
half-pills so have no data there).

So nothing very new.  If life continues like this, it is not so bad at all.
My hope, soon after diagnosed, was that I could get at least 2 years between
serious outbreaks (giving me perhaps 20 years before very serious
incapacitacion).  I am around half way to that goal.

Let this not be the calm before the storm.

Hello to future self.  Keep on rockin'

Andrew

### Lenovo X240 OpenSuse 13.1

From: andrew cooke <andrew@...>

Date: Tue, 4 Mar 2014 22:00:37 -0300

- You can switch Fn and Ctrl in the BIOS
- You can enable virtualization in the BIOS

- For responsive screen brightness control you need to add
acpi_backlight=vendor
to boot opts

- To get a comfortable set of buttons when using the pointer in
/etc/X11/xorg.conf.d/50-synaptics.conf

Section "InputClass"
MatchDriver "synaptics"
Option "SoftButtonAreas" "60% 0 0 10% 45% 60% 0 10%"
Option "AreaTopEdge" "10%"
Option "AreaLeftEdge" "0%"
Option "AreaRightEdge" "100%"
EndSection
and maybe

Section "InputClass"
Identifier "Trackpint speed"
MatchProduct "TPPS/2 IBM TrackPoint"
MatchDevicePath "/dev/input/event*"
Option "AccelerationProfile" "2"
Option "VelocityScale" "100"
EndSection

- For better battery life in /etc/pm/power.d

intel_audio.sh
#!/bin/sh
case $1 in true) # Running on battery echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller echo 1 > /sys/module/snd_hda_intel/parameters/power_save ;; false) # Running on charger echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller echo 0 > /sys/module/snd_hda_intel/parameters/power_save ;; esac exit 0 nmi_watchdog.sh #!/bin/sh case$1 in
true)
# Running on battery
# Disable the NMI watchdog
echo 0 > /proc/sys/kernel/watchdog
;;
false)
# Running on charger
# Enable the NMI watchdog
echo 1 > /proc/sys/kernel/watchdog
;;
esac
exit 0

#!/bin/sh
case $1 in true) # Running on battery echo min_power > /sys/class/scsi_host/host0/link_power_management_policy echo min_power > /sys/class/scsi_host/host1/link_power_management_policy echo min_power > /sys/class/scsi_host/host2/link_power_management_policy ;; false) # Running on charger echo max_performance > /sys/class/scsi_host/host0/link_power_management_policy echo max_performance > /sys/class/scsi_host/host1/link_power_management_policy echo max_performance > /sys/class/scsi_host/host2/link_power_management_policy ;; esac exit 0 usb_autosuspend.sh #!/bin/sh case$1 in
true)
# Running on battery
for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 1 > $i; done for i in /sys/bus/usb/devices/*/power/level; do echo auto >$i; done
;;
false)
# Running on charger
for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 0 > $i; done for i in /sys/bus/usb/devices/*/power/level; do echo auto >$i; done
;;
esac
exit 0

vm_writeback.sh
#!/bin/sh
case "\$1" in
true)
# Less VM disk activity. Suggested by powertop
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
;;
false)
#Return settings to default on AC power
echo 500 > /proc/sys/vm/dirty_writeback_centisecs
;;
esac

and in /etc/pm/config.d/sata_alpm

SATA_ALPM_ENABLE=true

Andrew

### NSA and GCHQ - Psychological Trolls

From: andrew cooke <andrew@...>

Date: Tue, 25 Feb 2014 08:27:41 -0300

https://firstlook.org/theintercept/2014/02/24/jtrig-manipulation/

At this point it's hard to think of anything that these pople *don't* do.

Feel like I should be angry, but am just kind of sad and disappointed.

Andrew

### Finite Fields in Julia (Defining Your Own Number Type)

From: andrew cooke <andrew@...>

Date: Sun, 23 Feb 2014 22:36:03 -0300

One of Julia's proud claims as a programming language is that it allows you to
define your own numeric types, and for the code that uses those types to be as
efficient as native types.

Well, that sounds vaguely cool, but not particularly useful.  Because what
extra numeric types do you need, really?  You've got integers, reals, complex
numbers.  What else is there?

it turns out that the "modern maths" we learnt in school - the stuff about
groups etc - is actually interesting and useful.  In particular, there are a
whole pile of things that are vaguely like numbers, in various ways, and they
are used all over the damn place in crypto.

Here's a quick run down:

First, there's groups.  The things you learnt at school.  They're a tiny bit
like numbers, in that they have one operation, which you can compare to
addition.  So you can add two things in the group and you get another one.
And there's a group member like zero that doesn't change values when you add
it to them, and a way of making negative numbers.

Next, there are rings.  These are more like numbers than groups are -
they're groups that *also* have something like multiplication.  They have
the equivalent of a one (which doesn't do anything when you multiply with
it) but don't care about division.

And next are fields.  These (you guessed it) add division to rings (more
exactly, they add an operation like 1/x).  And so these are pretty much
exactly like numbers - they have zero, one, addition, subtraction,
multiplication and division.

The simplest example of a field is probably boolean values - 0 and 1.  The XOR
operation works like addition and the AND operation works like multiplication.
It's a weird kind of maths, because 1+1=0, but it's all consistent.

And this is useful because block ciphers have a shitload of XOR operations.
DES, without the S-Boxes is *just* XOR operations (and swapping bits around).
That means that, if you can work out how to "do maths" with XOR then you can
solve for the key.  In other words, you can break DES (without the S-Boxes).

(OK, so DES without the S-Boxes is kinda useless, because of exactly this, but
you can see how it's on the edge of being interesting.  It's how you start to
pull these things apart....)

Now one field is pretty much like another, if they're the same size.  And it
turns out that boolean values are another way of looking at numbers "mod 2".

So let's take that idea and run with it... what about other numbers?  It turns
out that "mod p" makes a field whenever p is prime.  So "numbers mod 23" is a
field.

OK, back to Julia.  I wrote a small library that does exactly what Julia
claims - it lets you define a new type of numbers "mod N".  The code is at
https://github.com/andrewcooke/IntModN.jl/blob/master/src/IntModN.jl

Now comes the mind-boggling bit.

That library defines addition, multiplication, division, subtraction, and a
few other basic things like one and zero for these "numbers".

That's all it does.  These are very basic operations.  There is nothing up my
sleeve at this point.

Now, if I look at DES without S-Boxes I can analyse it and write down a huge
pile of equations that are involved in encryption.  These are scary complex
things that relate input, output and keys.

It turns out that I can write those equations as a large matrix equation (yay,
more high-school maths).

AND... Julia knows how to solve matrix equations.  Until yesterday, though, it
only worked for reals, and ints, and complex numbers.  But now, with this new
library, it also works with "mod N".  Which means it works with "mod 2".
Which means it works with boolean algebra.  Which means that...

WITH NO MORE EFFORT I CAN BREAK DES WITHOUT S-BOXES

I don't need to write the matrix inversion code.  I don't need to work our how
to solve those equations.  All I needed to do was teach Julia about boolean
algebra and now it can re-use what already exists.  The same code that worked
for reals and ints now works for the bits in a DES cipher!

(At least, that's the theory, I haven't actually worked out what the matrices
are.  But that's just bookkeeping, I hope...)

Andrew

### Julian Assange

From: andrew cooke <andrew@...>

Date: Sun, 23 Feb 2014 20:15:36 -0300

http://www.lrb.co.uk/2014/02/21/andrew-ohagan/ghosting

Andrew

### Starting Qemu on OpenSuse

From: andrew cooke <andrew@...>

Date: Fri, 21 Feb 2014 15:25:25 -0300

If you want to start qemu with KVM on OpenSuse, and get a network, this is
what you need:

qemu-img create -f raw julia.disk 8G

creates an 8GB disk and

qemu-kvm -name "julia" -M pc -m 1024 -smp 2 -boot d -drive \
file=./julia.disk,if=virtio,index=0,media=disk,format=raw -drive \
-netdev user,id=foo -device e1000,netdev=foo

starts the machine with disk and ISO image attached, and a device that can be

I knew VirtualBox made things easy, but boy I had forgotten how easy.

Avoid libvirt - it seems to make things mroe complicated for no apparent gain
(at this level).  Running qemu directly is simpler and more understandable.

References:
http://doc.opensuse.org/products/draft/SLES/SLES-kvm_sd_draft/cha.qemu.guest_inst.html
http://wiki.qemu.org/Documentation/Networking

Andrew

### Noisy GAs/TMs

From: andrew cooke <andrew@...>

Date: Fri, 21 Feb 2014 09:36:32 -0300

http://cstheory.stackexchange.com/questions/17914/does-a-noisy-version-of-conways-game-of-life-support-universal-computation

Andrew

### Venezuela

From: andrew cooke <andrew@...>

Date: Thu, 20 Feb 2014 16:25:15 -0300

Ignore the title.  This is just a good, honest description of what seems ot be
happening in Venezuela right now.  At least, sounds real to me.

http://feministing.com/2014/02/20/toward-a-nuanced-feminist-discussion-on-venezuela/

Andrew

### Reinstalling GRUB with EFI

From: andrew cooke <andrew@...>

Date: Wed, 19 Feb 2014 15:14:28 -0300

A week or two back, I shut down my ASUS 1015E netbook(ish) and took it on
holiday.  When I tried to turn it back on, it wouldn't boot.  As far as I
could tell it had lost the EFI boot doodah (a technical term).

The issue is here https://bugzilla.novell.com/show_bug.cgi?id=863409 but if
you have the same problem, here's how you fix it:

- boot from the OpenSuse installer disk, selecting "Rescue System"

- execute the following commands:

modprobe efivars
mount /dev/sda3 /mnt  # this assumes you mount /dev/sda3 as /
cat /mnt/etc/fstab    # to check the partition path for the next step
mount /dev/sda1 /mnt/boot/efi   # assuming that is as above
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /dev /mnt/dev
chroot /mnt

The above assumes that the main system is on /dev/sda3 and the EFI partition
is /dev/sda1 - you may need to change those (/dev/sda2 is swap and not used
here).

After that, you can reboot (ctrl-D then "shutdown -r now").

Big thanks to Michael Chang at Suse.

[I guess it's obvious, but the above loads a required kernel module, then sets
up the disk and chroots into your old system.  Finally you re-install the

Andrew

### Instructions For Disabling KDE Indexing

From: andrew cooke <andrew@...>

Date: Tue, 18 Feb 2014 20:46:53 -0300

Best instructinos yet for disabling KDE indexing (Nepomuk etc):

About to reboot and see if it fixes 6GB swap use...

Andrew

### Evolving Speakers

From: andrew cooke <andrew@...>

Date: Sun, 16 Feb 2014 23:55:08 -0300

Here's an idea for a project I am considering...

* Extend some free OpenCL Lattice Boltzmann code to include moving edges
(this is described in Succi's book in section 12.5).

* Use the LB code to simulate speaker enclosures, deriving an equivalent
set of simple harmonic oscillators.

* Work out how to connect that to a Thiele/Small model, plus the
speaker divider.

* Work back from the above to infer how to measure the quality of a
particular enclosre.

* Use genetic algorithms to evolve speaker enclosures.

I think the end result could be extremely cool.  I suspect you would end up
with asymmetric enclosures, possible with quite a striking appearance (imagine
the model as a set of planes; the enclosure could expose the intersecting
planes to view from the "outside").

Andrew