# 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-2015 Andrew Cooke (site) / post authors (content).

## [Computing] AI and Drum Machines

From: andrew cooke <andrew@...>

Date: Thu, 16 Mar 2023 11:32:55 -0300

https://aeon.co/essays/what-drum-machines-can-teach-us-about-artificial-intelligence

Andrew

## Previous Entries

For comments, see relevant pages (permalinks).

### [Computing] Probabilities, Stopping Times, Martingales

From: andrew cooke <andrew@...>

Date: Thu, 23 Feb 2023 16:26:07 -0300

I really need to read this slowly and carefully...

https://codeforces.com/blog/entry/110801

Andrew

### [Computing] Starlab Systems - Linux Laptops

From: andrew cooke <andrew@...>

Date: Sun, 19 Feb 2023 11:09:23 -0300

https://starlabs.systems/

Andrew

### [Computing] Extended Berkeley Packet Filter

From: andrew cooke <andrew@...>

Date: Sun, 19 Feb 2023 11:06:43 -0300

https://www.kentik.com/kentipedia/what-is-ebpf-extended-berkeley-packet-filter/
https://prototype-kernel.readthedocs.io/en/latest/bpf/

VM that allows tracing/filtering data within the kernel.

Can be programmed in a variety of ways, but most interesting is
bpftrace - https://github.com/iovisor/bpftrace (awk-ish).

Andrew

### [Green] Mainspring Linear Generator

From: andrew cooke <andrew@...>

Date: Sun, 19 Feb 2023 11:03:05 -0300

https://spectrum.ieee.org/mainspring-energy
https://www.mainspringenergy.com/

A linear diesel engine connected to coils to generate electricity and
allow automatic compression control.  Very cool.

Andrew

### Rummikub Solver

From: andrew cooke <andrew@...>

Date: Thu, 12 Jan 2023 16:48:36 -0300

I have been working on a solver for Rummikub, but I haven't actually
made much progress.  This email is to note down some of my ideas and
related issues.

The underlying insight is that this is a graph colouring problem.  The
nodes of the graph are the known tiles.  Edges connect any two tiles
that can appear "next to each other" in a group.  The colouring
identifies each group (a successful colouring meets the appropriate
rules).

There may be an efficiency gain in using the previous colouring as a
starting point when searching for a new one.

This is fine as far as it goes.  It becomes more problematic when you
include jokers.

A naive first approach is to include the jokers as additional nodes.
The problem is that these are connected to *every* other node.  This
complicates hugely the search process when trying t find a colouring.

In practice, when you play, you tend to separate things into two
stages: first, liberating a joker and second, using that joker.

Using this approach the joker tiles become "normal" tiles in the graph
(ie take their assumed values) when searching for liberation.  Then,
in the next step, thereare many possible graphs (one for each possible
value of the joker).

I currently don't see how to handle this explosion in the number of
graphs.

So I'm stuck. It seems like the colouring view doesn't reduce the
combinatorial complexity sufficiently.  Or doesn't allow for the
complexity to be reduced using a "natural" compromise.

Andrew

### Chilean Poetry

From: andrew cooke <andrew@...>

Date: Thu, 12 Jan 2023 16:25:32 -0300

https://marcachile.cl/vida-cultura/las-nuevas-voces-de-la-poesia-chilena-que-cruzan-fronteras

> Su [Tamym Maulén] libro «PAF» es considerado una obra fundamental de
> la nueva poesía chilena.

https://en.calameo.com/read/004645115620198c12433

It's not clear (to me) what "nueva poesía chilena" refers to.
Particularly since
https://es.wikipedia.org/wiki/Antolog%C3%ADa_de_poes%C3%ADa_chilena_nueva
is probably not what's in mind.

Andrew

### [Bike] Fixing Spyre Brakes (That Need Constant Adjustment)

From: andrew cooke <andrew@...>

Date: Wed, 1 Jun 2022 19:09:58 -0400

I have sme Spyre brakes and they're great - work well and are easy to
maintain.  But recently (after a couple of years use) I found that one
pad would slowly move further from the disk and, every few rides, need
adjusting (tightening).

This is something I have heard others complain about, too.
Fortunately there is an easy fix.

I did this by removing the caliper from the bike, but with care I
think you could do it leaving the caliper in place (but with the wheel
removed).

Here's what I did:

- Remove the pads

- Screw the 3mm adjustment on the side of the problem pad inwards
(as you would to move the pad closer to the disk). Keep screwing
and something will eventually fall out!

- The thing that falls out (the thing that pushes the pads against
the disk) is like a short screw with a very flat head.  Clean it
with a rag and put a decent amount of blue locktite on the threads
(the stuff that stops things from coming loose, but leaves them
still able to be adjusted by hand).

- Once the loctite is fairly dry you need to screw that part back
in.  This is a bit tricky (and more tricky still if you've not
removed the calipers from the bike).  What you need to do is put
the screw inside the caliper, with the threaded part pointing
towards where you adjust from the inside (a ruler, screwdriver, or
lollipop stick will help).  Once you get everything lined up you
can use the 3mm allen key from outside and "skewer" the screw,
then, by turning anti-clockwise, screw it back into place.

Basically, you're doing the opposite of what you did to make it
fall out.

- Once in place leave for, say, 12 hours to allow the loctite to
set.

- And don't forget to replace the pads and adjust before riding.

After all that you'll find that the adjustment is much "stiffer" and
desn't come loose.  I have no idea how long it lasts because I only
did it myself a few days ago.

Andrew

### [Computing, Music] Raspberry Pi Media (Audio) Streamer

From: andrew cooke <andrew@...>

Date: Sat, 7 May 2022 17:36:36 -0400

I have a Raspberry Pi that I want to take music from a HDD and send it
to a USB DAC.  I want to be able to control this remotely from my
phone.  It should look good and "just work".

I have tried a pile of things in the last week.  The best (by far) has
been volumio.  After flashing the image and booting you may need to
enable ssh (via http://address.of.volumio/dev) and then you can modify
fstab and mount the music at /mnt/INTERNAL

You can also modify
/volumio/app/plugins/music_service/mpd/mpd.conf.tmpl to enable
replaygain (and then save settigns from the gui to regenerate
/etc/mpd.conf).

Various other things learnt:

- mopidy is an MPD rewrite in Python (ish).  Unfortunately it's not
super-well supported and the clients are buggy (even when you
finally understand what it is and that you need to install
mopidy-local).  The MPD plugin doesn't make much sense.

- MPD clients for android are not great.  MpDroid seems to be no
longer maintained and MALP is flakey.

- I tried moode a while back and that was OK (but volumio seems more
responsive and easier to use).

Andrew

### [Computing] Amazing Hack To Embed DSL In Python

From: andrew cooke <andrew@...>

Date: Mon, 31 Jan 2022 17:35:03 -0300

This library - https://github.com/pythonql/pythonql - extends Python's
syntax (and semantics) by calling a preprocessor triggered by the line

#coding: pythonql

at the top of the file.

The meaning of "#coding" is defined here -
https://www.python.org/dev/peps/pep-0263/ - and was an early way of
defining source encodings (eg UTF8) for Python code.

Andrew

### [Bike] Ruta Del Condor (El Alfalfal)

From: andrew cooke <andrew@...>

Date: Sun, 23 Jan 2022 13:12:33 -0300

Was up in El Alfalfal today and noticed two riders disappear into the
village.  The guards at the hydroelectric plant said that there's a
path up to the trail above.  I didn't find it on a quick look, but
when I got home checked online maps.  Google is useless, but
OpenStreetMap clearly shows the path!  It's along the side of the
football pitch in the village (the NE side).

Maybe this will help someone searching for how to access the route.

And if not, the road ride up + back is pretty nice anyway!

Andrew

### [Bike] Estimating Power On Climbs

From: andrew cooke <andrew@...>

Date: Thu, 20 Jan 2022 19:31:49 -0300

I was slowly pedaling up a hill today, staring at my cycle computer
to avoid looking at the endless climb in front of me, when I realized
that you can easily estimate your power from the grade and speed
(km/h).

Me + my bike weight about 72kg.  Actually a bit more (I need to lose a
kilo or two), but 72 turns out to be a nice number in what follows.

72kg ascending vertically at 1m/s requires a power of 720W (because
g=10, more or less).

A speed of 1km/h is 1000m/3600s or 1/3.6 m/s.

Small angle approx means that if you are riding at a speed S(km/h) on
a gradient of G then your vertical speed is SG/100 km/h or SG/360 m/s.

So the power required (at 72kg) is SGx720/360 W or 2SG W.

For example, at 10km/h on a 5% grade your power is 2x10x5 = 100W.

Now this is incorrect if you're moving fast enough, or riding up a
shallow enough slope, that air resistance is important.  But for
climbing it's fine.

Obviously if you+bike weighs more or less than 72kg you need to
adjust accordingly.

Andrew