https://www.baturin.org/atom.xmlDaniil Baturin's blog2023-07-23T00:00:00+00:00Daniil Baturindaniil+website@baturin.orgsoupaulthttps://baturin.org/images/favicon.pngProgramming and other subjectshttps://www.baturin.org/blog/an-chead-bhliain-in-eirinnAn Chéad Bhliain in Éirinn / The first year in Ireland2023-07-23T00:00:00+00:00
It's been a year since I moved to Ireland, and I thought I could as well write a recollection
to remember the good moments of that year (there are many!) and reflect on them.
In short, I like it here, and I'm grateful to everyone who helped me on the way.
There are many great people I wouldn't have met and many experiences I wouldn't have had
if I didn't come here. Here's a list of unrelated memories (mostly narrated in present tense, as an aesthetic choice)
and observations in vaguely chronological order.
https://www.baturin.org/blog/margarine-or-butterMargarine or butter: the secret ingredient of storytelling2023-06-16T00:00:00+00:00
When <a href="https://en.wikipedia.org/wiki/The_Quiet_Girl">An Cailín Ciúin</a> got nominated for the Academy Award, I felt like a hipster
because I watched it before it was mainstream. I just went to watch it at UCC
with <abbr title="The Gaelic Society">An Chuallacht Ghaelach</abbr> to practice listening to Irish, without any expectations
for the film itself but quickly reaized that the film and the story it was based on
were certainly very special — not merely beautiful but also very carefully crafted.
But I wouldn't be myself if I didn't make a silly joke and claim that the most important
unanswered question is whether Mrs. Kinsella uses margarine or butter for baking.
https://www.baturin.org/blog/music-school-memoriesMusic school memories2023-06-11T00:00:00+00:00
If you haven't heard that story, I studied clarinet performance in a classical music school from 2018 to 2022
and dropped out three months before my graduation... for a reason unrelated to the school itself, but let's not talk about that here.
I want to talk about the impact it had on me and share some funny stories from that time.
https://www.baturin.org/blog/an-bhfuil-cead-agam-dul-go-dti-an-leithreasAn bhfuil cead agam dul go dtí an leithreas? — a primer on Irish syntax2023-06-01T00:00:00+00:00
Some claim that <em>An bhfuil cead agam dul go dtí an leithreas?</em> (May I go to the toilet?)
is often the only phrase that people remember from their Irish lessons in school,
and some use it to prank people unfamiliar with the language by claiming that it's how you say
“You will forever be in my heart” or similar.
However, that phrase actually makes an excellent illustration of the basic Irish morphology and syntax,
so let's examine it in detail.
https://www.baturin.org/blog/learning-languagesLearning languages2022-11-12T00:00:00+00:00
During this year, I have learned two completely unrelated (human) languages to a semblance of A1.
Many people claim that I have a talent for learning languages but I don't think it's the case.
I just have more experience and tools for learning them. I decided to write down some notes
that I hope can help other language learners, starting from pretty obvious facts that I didn't consciously realize
until some point and ending with somewhat controversial opinions.
https://www.baturin.org/blog/private-network-designPrivate network design basics2022-01-16T00:00:00+00:00
People without much networking experience may think that network design is something that is done for large organizations
by highly experienced specialists with fancy titles, while small networks
don't need any design at all. However, most networks start small and grow larger than anyone might have planned,
and the "no design" approach quickly shows its limits. Worse yet, changing the design of a production network
is much harder than building a network from scratch—even a very small network can take hours to reconfigure for a new addressing scheme
and ensure that everything is working correctly. Luckily, if you know a few facts and principles,
you can avoid most mistakes that take a lot of effort to fix.
If you are starting a network and want to get it right, read on.
https://www.baturin.org/blog/code-hosting-needs-federationCan non-federated code hosting replace GitHub?2021-08-25T00:00:00+00:00
You guessed my answer right: I believe federation is the only hope for decentralizing developer collaboration.
To back up this claim, I examine contribution patterns in a project that was moved
from a self-hosted MediaWiki <em>to</em> GitHub—the repository with VyOS documentation. The key finding is that most contributor
accounts are older than the repository, so ability to use an existing account for contributing was likely crucial
for their decision to contribute.
https://www.baturin.org/blog/life-before-unicodeLife before Unicode2021-08-21T00:00:00+00:00
Unicode definitely added a lot of complexity to string handling,
and people who use languages with ASCII alphabets exclusively may think it's unjustified.
However, I'm a non-ASCII language speaker who's old enough to remember the alternatives,
and the alternatives are far worse than the complexity of Unicode.
https://www.baturin.org/blog/ccna-200-301-2021CCNA 200-3012021-06-25T00:00:00+00:00
Today I passed Cisco's CCNA 200-301 certification exam. In short, they fixed a lot of old problems
but added a few new ones. However, it's still much closer to an exam that a working network administrator
can walk into from the street and pass, compared to the last time I've seen it. In this post I'll try to offer some preparation tips.
https://www.baturin.org/blog/why-not-hugoWhy not Hugo2021-06-04T00:00:00+00:00
People sometimes ask me why I wrote my own <a href="https://soupault.app">static site generator</a> instead of using an existing one.
A lof of time their suggestion is Hugo. Well, a lot of the time I use Hugo as an example of what <em>not to do</em>.
It suffers from creeping compatibility breakage and I find it highly limiting in many areas. I'm not planning to use it and not recommend it to anyone else.
For the details, read on.
https://www.baturin.org/blog/lua-ml-embedding-and-projectionEmbedding and projection in Lua-ML2020-08-28T00:00:00+00:00
One thing I find odd about many interpreter projects is that they are designed as standalone and can't be used as embedded
scripting languages. Lua-ML is completely different in that regard: it's designed as an extension language first and offers
some unique features for that use case, including a reconfigurable runtime library. You can remove modules from its standard library or replace
them with your own implementations. Of course, you can also pass OCaml values to Lua code and take them back in a type-safe manner too.
That aspect isn't very obvious or well-documented, so in this post we'll try to uncover it.
https://www.baturin.org/blog/js-like-its-2006Bundle NPM modules into static JS libraries like it’s 20062020-08-19T00:00:00+00:00
A good thing about browser implementations of JavaScript is compatibility. The NPM ecosystem, however, is infamous for its fragility.
As a professional “not a frontend developer” I try to opt out of it as much as possible.
Luckily, if you just need a library from NPM, it's easy to package it into an “eternal” blob that will work forever.
In this post I'll share my procedure for creating such static JS blobs from NPM modules.
https://www.baturin.org/blog/migrating-the-blog-to-soupaultMigrating the blog to soupault2020-04-05T00:00:00+00:00
I've migrated my blog to <a href="https://soupault.neocities.org">soupault</a>. I hope it didn't break too many
links or anything else, if you spot a problem, let me know. If you are interested in the details of the migration,
read on. However, note that this post is a bit too full of idle musings on blogs, universe, and everything.
If a list of pages sorted by date is all you want, read <a href="https://soupault.neocities.org/blog/blogs-and-section-indices/">this post</a>
instead.
https://www.baturin.org/blog/if-you-think-reasonml-compiles-to-js-you-are-wrongIf you think ReasonML compiles to JS, you are wrong2019-09-05T00:00:00+00:00
In this post we'll examine what <a href="https://reasonml.github.io/">ReasonML</a> really is and what it compiles to.
Everyone coming from the ML community already knows the truth, but in the JS community, this misconception
seems surprisingly common. It's not just about giving credit, but about the true potential of the language
that is far greater than that of TypeScript or Elm.
https://www.baturin.org/blog/declarative-parse-error-reporting-with-menhirDeclarative parse error reporting with Menhir2019-08-24T00:00:00+00:00
Many parsers for custom formats aren't very user friendly when it comes to error handling.
At best you get the line and column where the error is, at worst a “Parse error”
message is all you get. Can we do better? With right tools, we definitely can and it's not that hard.
https://www.baturin.org/blog/extending-ocaml-programs-with-lua-soupault-got-plugin-supportExtending OCaml programs with Lua (soupault got plugin support)2019-08-10T00:00:00+00:00
Most of the time, when people make extensible programs in typed functional languages,
they make a DSL, not least because it's much easier to make a DSL in a language with algebraic types
and pattern matching than in one without.<br>
Some use cases really require a general-purpose language though. That's where things get
more interesting. Commonly used embeddable interpreters such as Lua, Guile, or Chicken are written in C.
It's possible to make OCaml or Haskell bindings for them and such bindings do exist,
but that's two high level languages communicating through a low level one.<br>
It would be much better to be able to expose native types to the embedded language in a type-safe and more or less convenient
fashion. Here's my take at it.
https://www.baturin.org/blog/migrating-to-the-new-server-part-2-moving-from-cyrus-to-dovecotMigrating to the new server part 2: moving from Cyrus to Dovecot2018-08-19T00:00:00+00:00
It's been a while since I published the <a href="/blog/migrating-to-the-new-server-part-1-base-system-and-the-web-server">first part</a>.
In case you were worrying how the rest of migration went, well, I ended up with an operational system quickly, even if because I decided not to change
the rest of it yet. However, a bug in Cyrus IMAPd made me make perhaps the biggest change in my email setup since its inception.
This post chronicles my migration to Dovecot.
https://www.baturin.org/blog/introduction-to-ocaml-part-5-exceptions-lists-and-structural-recursionIntroduction to OCaml, part 5: exceptions, lists, and structural recursion2018-08-18T00:00:00+00:00
In OCaml, exceptions are not objects, and there are no exception hierarchies. It may look unusual now,
but in fact exceptions predate the rise of object oriented languages and it's more in line with original
implementations. The advantage is that they are very lightweight.
https://www.baturin.org/blog/introduction-to-ocaml-part-4-higher-order-functions-parametric-polymorphism-and-algebraic-data-typesIntroduction to OCaml, part 4: higher order functions, parametric polymorphism and algebraic data types2018-08-12T00:00:00+00:00
So far we have only worked with functions that take value of a single type known beforehand.
However, we have already seen functions whose types were left without explanation, such as
<code>let hello _ = print_endline "hello world"</code> that we used to demonstrate the wildcard pattern.
<br>
What is its type? If you enter it into the REPL, you will see that it's <code>'a -> unit</code>.
What does the mysterious 'a mean? Simply put, it's a placeholder for any type.
Essentially, a variable for types —a <em>type variable</em>.
https://www.baturin.org/blog/introduction-to-ocaml-part-3Introduction to OCaml, part 32018-08-08T00:00:00+00:00
This should have been covered earlier, but better late than even later.
In this chapter we'll learn about booleans and conditional expressions.
https://www.baturin.org/blog/introduction-to-ocaml-part-2Introduction to OCaml, part 22018-08-07T00:00:00+00:00
In the previous chapter we've learnt how to use variables and arithmetic functions.
Now it's time to learn how to make our own functions.
https://www.baturin.org/blog/introduction-to-ocamlIntroduction to OCaml2018-08-06T00:00:00+00:00
This post series started as a response to requests from some friends curious about OCaml.
There are quite a few nice books already, but I realized that if I just recommend them any one of those
books, it still will leave me with quite a few things to explain in depth, or force me to recommend another
just to learn about that part. So I thought I may as well write something that hopefully will allow
a person who already knows how to program in some other language get started with writing OCaml programs
and continue learning on their own and find their own sources.
https://www.baturin.org/blog/implementing-sets-with-functions-aloneImplementing sets with functions alone2018-04-12T00:00:00+00:00
Implementation of sets using nothing but functions would be one of the first tricks in the
“100 Fun Things to Do With Functions and Closures” book if that book existed.
It may not be very practical, but it may help people get into the functional mindset.
We'll use <a href="http://ocaml.org">OCaml</a> for demonstration.
https://www.baturin.org/blog/hello-from-a-compiler-free-x86-64-worldHello from a compiler-free x86-64 world2018-04-07T00:00:00+00:00
I've stumbled upon <a href="https://blogs.oracle.com/ksplice/hello-from-a-libc-free-world-part-1">two</a>
<a href="https://blogs.oracle.com/ksplice/hello-from-a-libc-free-world-part-2">posts</a> where Jessica McKellar
demonstrates how to make a C program on Linux without using libc. They were written in 2010 when
32-bit x86 was far from extinct though, and use the old 32-bit ABI—a problem most examples
of low level programming on UNIX-like systems suffer from, even if it's not their fault.
https://www.baturin.org/blog/installing-python-package-data-by-relative-pathInstalling Python package data by relative path2018-04-02T00:00:00+00:00
Package data installation sometimes requires balance between ease of writing installation procecures for it
and ease of accessing that data. That's especially apparent when someone who is not a developer wants to be
able to edit that data in place. Editing it in place is a bad practice of course, but sometimes that's just
what you get. For example, if there are two people of whom one is a developer who wrote code solely from data format
specification, and the other understands what the data actually means but has no coding skills.
https://www.baturin.org/blog/network-access-and-authentication-in-cisco-catalyst-switchesNetwork access and authentication in Cisco Catalyst switches2018-03-31T00:00:00+00:00
From the fact that I'm a <a href="https://vyos.io">VyOS</a> maintainer, you can guess that I'm not a fan of Cisco routers,
but I'm a big fan of Cisco Catalyst switches. They have never failed me yet, and among all L2 switches they have
the least annoying CLI, even though it does have its issues. For L3 switches there may be better alternatives,
but for L2, I haven't seen anything better than Catalyst so far.
https://www.baturin.org/blog/mtu-calculator-makeoverMTU calculator makeover2018-03-14T00:00:00+00:00
A new version of encapcalc, an MTU/MSS calculator, is now live at <a href="https://baturin.org/tools/encapcalc">baturin.org/tools/encapcalc</a>,
with an improved and sort of mobile friendly UI.
https://www.baturin.org/blog/migrating-to-the-new-server-part-1-base-system-and-the-web-serverMigrating to the new server part 1: base system and the web server2018-03-09T00:00:00+00:00
My current VPS is running CentOS 6, and, frankly, it long started showing its age. Not very surprising if we remember that
it was released in 2011. Even with all efforts from EPEL, Remi, and Software Collections maintainers, running new applications
on new OS versions is obviously easier than on old verions. That's why I decided to migrate to Fedora, and it was much easier
than I thought.
https://www.baturin.org/blog/anycast-routingAnycast routing2018-02-28T00:00:00+00:00
It is well known that due to limited practical size of a UDP packet that can be transmitted without
fragmentation, the number of DNS root servers is limited to 13 addresses. There are indeed 13 root servers
named from A to M (a.root-servers.net, b.root-servers.net and so on).
However, if you visit <a href="http://root-servers.org/">root-servers.org</a>, you can see that most of those servers
somehow have dozens and even hundreds locations around the world. How is it possible for one server to
have more than one location? The answer is <em>anycast routing</em>.
https://www.baturin.org/blog/duck-typingDuck typing2018-02-21T00:00:00+00:00
So called “duck typing” is often poorly explained and thus often misunderstood.
Its name and the adage associated with it (“if it walks like a duck and quacks like a duck,
then it is a duck”) don't do it any favors either.
https://www.baturin.org/blog/yet-another-dmbaturins-blog-iterationYet another dmbaturin’s blog iteration2018-02-20T00:00:00+00:00
Looks like my blogging cycle is two years in and two years out. Not that I run out of things
to write about, it's just that good technical writing is a surprisingly time consuming endeavor.
You get to verify every example, check every proof, look up every detail in the standards and so on.
The world doesn't need more posts that create more troubles for the reader than they solve.<br>
Still last time what drove me away from blogging was, surprisingly, the tools. So many blogging
platforms are horrible, and finding a good one is a challenge.
https://www.baturin.org/blog/linux-apiLinux API without lies for children
One day my friend and I were arguing about the UNIX philosophy.
The starting point was my explanation of <code>/proc/cpuinfo</code> to beginners,
which went along these lines: