=========================
AoC, RISC-V, Z3, ginger
=========================

Another news digest here. I keep logging things on Mastodon regularly,
but its awkward and laggy UI keeps reminding me of Gopher, which does
not suffer from that. I think it must be possible to do something
about those lags, and actually I started writing an FF extension to
remove the bloat at some point, but with the way Mastodon
authentication and Firefox extensions work, it was basically an
alternative in-browser client, so it did not make much sense to keep
developing as an extension. I would consider working on and/or
self-hosting another Mastodon client or ActivityPub server (and maybe
a client to go along with it), but Mastodon is the one federated thing
I decided to try without hosting it myself, and already working on an
XMPP client library, so it seems more useful to focus the effort on
that.

Anyway, some of the personal news highlights from the past three
months:

- I played AoC this year again, which was fun, but quite challenging
 and a little stressful towards the end; mostly solved puzzles on the
 days when they were published, but one puzzle I only solved on the
 next day. It was particularly tricky to combine with daily
 exercises, chores, and work. Once again thought to use Rust for
 practice, but then went with the much more familiar Haskell.

- As another useless but fun project in Emacs Lisp, started writing a
 RISC-V (RV64GC) emulator, <https://codeberg.org/defanor/rv.el>. It
 is still missing many of the floating-point operations, and only
 emulates a few Linux syscalls. The syscalls would be tricky to
 implement extensively enough to run more or less arbitrary programs,
 so I am thinking of focusing on running whole operating systems
 instead of individual programs on it next, or perhaps pretending
 that it is a microcontroller, implementing just a little
 memory-mapped I/O. But for now it is capable of running statically
 linked dash (the shell), doing basic arithmetic in it, as well as
 running basic C programs with main() (as opposed to mere _start())
 and statically linked with glibc.

- One of the AoC puzzles involved solving a system of non-linear
 equations, for which I used SymPy (after failing that with Octave),
 but Z3 was an alternative, and then I ran into it yet again. I used
 to avoid SMT solvers while poking formal verification with Idris and
 others in the past, viewing them as mostly bruteforce, but for
 actually solving things (rather than proving them) they seem quite
 useful. Used the Python API, since the Python interpreter provides a
 nicer interactive environment than Z3's plain interface for SMT-LIB.

- In other Python-related news, preparing some anomaly detection in
 time series data at work these days (between the other randomly
 appearing tasks), and tried a bunch of statistics-related Python
 libraries for that (since Python has quite a few of those; back in
 2014 I tried to do something similar and implemented everything from
 scratch, but that was awkward). As usual, the more specialized a
 library is, the lower are chances that it is available from system
 repositories, or even builds in a sandbox while circumventing
 those. But after reading a few papers on the topic and poking the
 seemingly relevant algorithms from common libraries, I am inclined
 to use just z-score and linear regression, which can be implemented
 easily in PostgreSQL itself, along with some basic interpolation to
 fill in missing data (particularly for regression, when it is
 needed). I hoped that time series decomposition would be useful, or
 that there are some algorithms better dealing with missing data, but
 the decomposition usually requires to set a period explicitly, as a
 number of data points, so it is preferable to have that same number
 of data points, filling in the missing data. But once you have such
 neat interpolated data, and know the period, at least for anomaly
 detection in this case it becomes much easier to just compare that
 to the previous value at that position inside the season, or the
 average of a few previous ones.

- The recent cooking adventures revolve around spices from the ginger
 family: ginger itself, turmeric, cardamom. Learned that they are
 from the same family, too. Tried gingersnap cookies, adding ginger
 into hot chocolate, into a hot beverage (along with lemon, honey,
 turmeric, cinnamon, water). Tried turmeric and curry mixes in
 another curry dish (with turkey pieces), in a pumpkin soup. Tried
 cardamom in hot chocolate, in panna cotta, in those gingersnap
 cookies. Those are nice spices. Also tried baking more bread
 (baguettes), made chili con carne a few times, tried buckwheat "tea"
 and Dianhong tea, probably will try others soon.

- I keep doing exercises daily, today is a year of doing the same
 aerobic routine (and almost half a year of adding 15 minutes of in
 place jogging to it, and various other durations for stretching/yoga
 routines and anaerobic exercises). Physical exercises seem to work
 as advertised so far.

- Have set Debian 12 on my old EeePC netbook, but not using it.

- Gave up on cargo pants, to avoid anything resembling military style
 these days; trying out some chinos, and even a pair of jeans. Those
 are nicer than I expected, although often it is tricky to fit a
 passport into their pockets (which one basically has to carry all
 the time around here, to reduce chances of a random detention). Some
 pockets can be enlarged though, and buttons can be attached to
 pockets that miss those.

- Have read the first book of "Hyperion" by Dan Simmons, did not like
 it much. Now resumed slowly reading another Discworld novel.

- Tried using Rust at work for a basic program, ran into some
 awkwardness with relevant libraries. Just as I did with Haskell
 before that. While a similar program in PHP worked fine, having a
 more polished library, and I suspect it would be the case with
 Python as well, and maybe even in Perl. Odd to observe those
 seemingly less reliable languages leading to more reliable
 software. Actually something similar happened with rexmpp's Rust
 modules (which duplicate C ones): I think there is a memory leak
 somewhere, either in those or between C and Rust. But it is better
 to build without Rust to avoid the leak for now.


----

:Date: 2024-01-20