taw's blog

The best kittens, technology, and video games blog in the world.

Friday, May 06, 2022

Chinese Lockdowns

A few weeks ago I wrote Pandemic Retrospective. Events since then pretty much confirmed everything I wrote.

The West got over covid. It's still there, but old people are overwhelmingly vaccinated, so nobody cares.

Meanwhile, China is doing its best to implement Zero Covid policy. OK, so here's what I wrote back then:

There's also an interesting idea for stage 1, to totally close not just countries but each city and region, and wait for covid to disappear there, before reopening only borders between covid-free areas. But this would only work if external country borders were closed as well, and it would be extremely disruptive. China sort of did that initially, but nobody else really tried that at all.

And what China did 5 days after I wrote that post? Literally what I said, on a much larger scale than in 2020.

Chinese lockdown is based on setting up borders. Not just external borders, and just borders outside cities, but borders between districts inside cities. It's extreme borders more than extreme lockdowns.

Instead of closing factories, China converts them to a closed system, where workers live in their workplace, so they don't need to cross internal borders. That's something Europe never considered, travel was open for "essential workers" which were a huge chunk of the population, far too great for covid to be possible to contain.

It's unclear if this will be enough to achieve Zero Covid - so far the signs aren't too great, but let's imagine they do. Whichever way it goes, one thing it proves beyond any doubt is that European approach - late severe lockdowns without corresponding external or internal hard borders - didn't have the slightest chance of ever working. European style lockdowns were completely 100% counterproductive.

And since I'm in a prophetic mood, Ukraine will destroy Crimea Bridge.

Tuesday, March 29, 2022

Russia is Doomed

I drafted this post last year, with this exact title, but I ended up writing the 100 Programming Languages Speedrun instead, and didn't have time to finish it. I'm feeling a bit silly now. Anyway, nothing here is in any way related to the Russian invasion of Ukraine, so just imagine that this was posted before all that.

Russia is a regional power like Italy, Turkey, Brazil, or Saudi Arabia, LARPing as a superpower. It's baffling that people actually buy that, and think that Russia is some kind of a global superpower like US or China.

If you look at GDP or population, Russia is really unimportant. Projected population growth for Russia looks even more miserable than for the West, and their economic growth potential is very poor if you exclude two sectors.

Now Russia has two important things going for it, but here's why both will end soon.

Fossil fuel exports

Russia's biggest strength is its fossil fuel exports. If you look at export statistics, they constitute about 50% of all of Russia's exports. Exact number varies year to year based on their prices. Russia has been called "gas station masquerading as a country" for a good reason.

This is not sustainable. I despise virtue signaling over climate, but regardless of that, renewables technology is ceaselessly advancing. We already reached the point where renewables, with reasonable subsidies, are almost competitive with fossil fuels for electricity generation during good parts of the day. The main problems are intermittency of renewables, use of fossil fuels for transportation, and cost of switching all the existing infrastructure.

The first two can be solved by cheap batteries, and battery cost fell about 90% over the last decade, with little reason that this will stop. And given enough time and money, existing infrastructure will get replaced.

Full replacement of fossil fuels will take many decades, but this is not a growth sector. And Russia has nothing to replace it with. Other raw natural resources bring a small fraction of that money.

Green useful idiot

One thing Russia succeeded in doing, is funding "environmentalist" group that oppose European energy independence. Europe could have been far closer to energy independence already if it proceeded with fracking, nuclear, clean coal, and other technologies, just as US have done. It took US twenty years from being in just as deep shit as Europe to being a net energy exporter. All it took was political will.

However "environmentalist" groups, some receiving substantial Russian funding, others being Putin's useful idiots, managed to prevent European energy independence, and made Europe more dependent on imports from Russia for the time being.

Also did I mention recently that this guy should hang from a lamp post for treason, and it's a disgrace to his whole country that nobody hanged him from a lamp post or other suitable object yet?

Anyway, while this has been extremely successful Russian subversion of democratic countries, in the long term it won't matter, as it will be possible for just about any country to just buy enough batteries, solar panels, and EVs to gain energy independence.

Weapon exports

The second thing Russia has going for them are their exports of military equipment.

Russia is targetting mid-tier market. Their equipment is much worse than top-tier exports from the US, but it's a lot cheaper, and still a lot better than low-tier weaponry poorer countries can manufacture locally.

This is going to unravel really quickly, much faster than energy exports. The reason is China. China has been trying to build weapon export industry, and there's nothing that could possibly stop them from succeeding.

Chinese industry outproduces Russian industry 20:1 and the gap is growing every year, China has amazing track record at going from low-tier to mid-tier in any key industry it wants. That's what happened to far more competitive low-tier and mid-tier smarphone market over just a few years. The high end is safe - be that Apple and Samsung or US and other NATO military equipment. And countries can do their own low-tier basic stuff like rifles if they really want to. But China is amazing at going after the whole global mid-tier market.

I don't know why nobody talks about this, but it's pretty much guaranteed that the same will happen with Russian weapons exports. China will dominate this. And other mid-tier competitors like Turkey are also trying to break into this market, all at Russia's expense.

Why military exports matter?

Weapons exports are not a huge money maker for Russia. Overall global weapons trade is about $100bln a year, just 0.5% of $20,000bln a year global trade.

This is important to Russia for two reasons. First is that modern weapon development is horrendously expensive. Spending all that R&D money and your own military being the only buyer, translates to enormous unit cost. Even US can just barely get away with it, and non-exportable F-22 was in retrospect a huge mistake, compared with exportable F-35.

Russia is just far too small a country to even attempt creating any modern non-exportable weapon systems.

The second reason is that weapon exports give Russia a lot of political influence among world's poorer countries. It's hard to criticize what Russia is doing, after your minister of defense took Russian bribes to get them to win the contracts, and now your air force is now made of Russian planes, and Russia is the only source of spare parts.

This is not going to last. Oven the next few years Chinese offers will be better, cheaper, and for most countries less politically toxic, than Russia's.

There will be some markets left, like India might be unwilling to buy from China, and too corrupt to buy from the West (which is far less willing to engage in outright corruption necessary to win military contracts), and too poor for high-end gear anyway, so they might still buy worse Russian jets over better Chinese ones. But overall, this part of Russian economy will collapse even faster than their energy exports.


As it turns out, I was late with this post. Europe is now scrambling to reduce their exposure to Russian fossil fuels, and Russian weaponry turned out to be a lot worse than advertised, so both sectors might collapse a lot sooner than I thought.

By my original guesstimated times for these, Russian energy sector would go into serious decline in 2030-2040 kind of range, but their weapon exports likely as soon as 2025-2030, while Chinese weapon exports would skyrocket just like their smartphone exports did.

People are now willing to talk about Russian fossil fuels, so that take isn't all that hot anymore. However, I haven't heard a single other person even entertaining the second point of the inevitably coming Chinese (and surprisingly Turkish) competition crushing Russian weapons exports.

Wednesday, March 23, 2022

Pandemic Retrospective

There won't be anything too controversial here, just a bit of big picture view.


Covid-19 is not over, and there's no indication that it will ever be eradicated, there are just a lot more important things going on right now.

So far the only established human disease we managed to eradicate was smallpox. Polio eradication efforts have largely stalled, with little progress since year 2000. I still have some hopes that we'll win over polio, but the chance of total elimination of covid-19 in any realistic timeframe is essentially zero.

The most outcome is that covid will be just another seasonal disease like the flu, with us for the long run. This is mostly fine, as going forward, most people will get exposed to mild infection when they're young, and by the time they're old and vulnerable, they'll have some degree of immunity, from some combination of previous infections and vaccines.

Age is the main risk factor, far greater than anything else. Every extra 20 years means 10x higher death rate, or in other words every additional year of your life is extra 12% risk of death if infected.

This is a good way to put things in perspective. For example according to the few RCTs we have, masking (with a real medical mask) may offer about 10%-20% reduction in infection chance, with no reduction in severity of symptoms in case of infection. So you're about as vulnerable masked in 2022 as you'd be unmasked in 2021, just because you aged enough to counter all that benefit. And "masking" with non-medical mask doesn't seem to do anything at all.

Vaccination with regular boosters may reduce risk of death by about 80%-ish, equivalent to being about 15 years younger. So a fully vaccinated and boosted 40 year old is at about as much a risk as completely unvaccinated 25 year old. There doesn't seem to be much reduction in chance of getting infection in the first place, mostly reduced severity.

It's often underestimated just how much covid is a single-risk-factor disease, that factor being age. For example obesity increases risk of covid death by 25%. So 40 year old obese person is at as much risk as 42 year old healthy weight person.

I think it's a useful visualization tools to translate all relative risk factors into equivalent age differences.

Risk of hospitalization and other serious health outcomes roughly follows risk of death, with similar risk increase for every additional year of age.

Anti-Covid Measures

There are three stages at which we could intervene to prevent covid deaths (and other severe outcomes):

  1. prevent pandemic from getting to your country in the first place
  2. reduce spread of infection once there's already community spread
  3. reduce chance of death for an infected person

A lot of measures have been taken, but only two have been very highly effective:

  • total border closures (step 1)
  • vaccinating old people (step 3)

Everything else did either nothing, or had minor effect, or was outright counterproductive. These include such measures as:

  • bank account closures
  • contract tracing
  • firing people for having different opinion
  • hand washing
  • ivermectin
  • lockdowns
  • mask mandates
  • masking
  • mass event closure
  • partial border closures
  • quarantines for travelers
  • riots
  • school closures
  • social media bans
  • stimulus checks
  • testing
  • vaccinating low risk people
  • vaccine mandates
  • voluntary masking
  • work from home
  • etc.

In the end, none of them had a big impact on the death rate. Notably almost all the measures attempted to target stage 2 (reduce infection rate once it's already established), and for covid that was simply the least effective stage to target.

The most unexpected thing about covid is that stage 1 interventions (total border closures) were extremely effective even after covid already got established. The original Wuhan lab leak variant was just not all that infectious, so closing borders and preventing much more infectious subsequent variants from coming in was an extremely successful approach, even in absence of other interventions. Japan is a good example of this combination.

Cargo Culting

A huge problem with global pandemic response is that countries threw away all established science, and mindlessly copied what other countries were doing, even if it was completely ineffective. So instead of 200 different policies we could meaningfully compare, it's largely same ineffective policies tried over and over.

Knowing just country age structure, border closures, and vaccination rates among old people, we can fairly accurately estimate pandemic severity, throwing away all other information.

Arguably the main problem with global pandemic response was that everyone was cargo culting part of Chinese response that was pointless (lockdowns), and in a half-assed way that couldn't have possibly worked anyway; and they did not copy the part of Chinese response that actually worked (total border closures).

What Was Not Tried

In retrospect was can safely say that nothing targetting stage 2 would have worked. Any response strict enough to eradicate transmission after it was well established would just completely crash the economy, and with borders even partially open, covid would get back in anyway. And if you closed the borders, then you didn't need to be that strict in the first place (see Japan again).

At least none of such interventions would work if they targetted general population. We could have absolutely done crazy strict lockdowns of nursing homes specifically. About a third of all covid deaths in US was in long-term-care facilities, and these are not economically significant. We could have completely isolated them from the rest of the population (food delivery in full body ppe suit kind of isolation), and likely avoided 1/3 of all covid deaths. By moving more old and vulnerable people into similar protected environments, deaths could have been reduced even more.

Nobody really tried that, and there's been overwhelming lack of interest in any interventions that segregated people by risk level. If we did something more along the lines of:

  • no restrictions of any kind on under-30s
  • some modest risk reduction recommendations for 30-60s (no mass events, work from home recommendations, masking on public transport recommendation etc.)
  • total lockdown for 60+s

That would be far more effective and far less destructive than what actually happened. To repeat the basic fact, 20 years of age difference means 10x risk of death difference. There's no sane way to treat kids and elderly the same, and that's what all countries did.

More idiotically, students were often restricted far more than adults, just because schools have far too much power over students' personal lives. It was cruel, and it did nothing to help with the pandemic.

There's some stage 3 interventions that could have had a meaningful effect, but weren't attempted.

The most notable one that would be mass vitamin D supplementation, as pre-infection vitamin D levels correlate very strongly with risk of death, and vitamin D insufficiency has been widespread in most modern populations. For people with most severe deficiency, effect size looks about as big as vaccines, based on observational studies. It would be much smaller averaged over entire population, as not everyone is as severely deficient. Unless you know that your vitamin D levels are adequate, you should absolutely get daily supplement, especially during winter, and not just for covid.

There's also some new antiviral drugs that could reduce risk of death. They happened late in the pandemic, but I guess if someone writes similar retrospective in 2025 they might get added to the list of interventions that made a big difference.

There's also an interesting idea for stage 1, to totally close not just countries but each city and region, and wait for covid to disappear there, before reopening only borders between covid-free areas. But this would only work if external country borders were closed as well, and it would be extremely disruptive. China sort of did that initially, but nobody else really tried that at all.

Who Predicted It Correctly?

Nobody at all.

Pre-pandemic expert consensus was very strongly against lockdowns, border closures, masking, and most other measures that ended up happening. Pretty much none of that was followed.

Epidemiologists' models were all universally worthless, and the whole field of epidemiology turned out to be about as reliable as social psychology.

Governments were both extremely incompetent and openly lying. The media were even dumber than usual. Social media companies were banning people for saying true things.

I don't think even any individuals got it right. As far as I know, nobody predicted either of these:

  • the initial Wuhan Lab variant was no big deal, the variants were a big deal, so total border closures would be super effective even after Wuhan lab leak variant was already there
  • vaccines would be developed very quickly, but they'd only offer big redution in severity and risk of death, and wouldn't meaningfully reduce infection rate, so mass vaccinating old people was really important, but any mass mandates are pointless

I don't think anything useful came out of prediction markets either.

Who Did Well?

The private sector did amazingly well. Rapid transformation of big parts of the economy from office-based to remote-first was amazing, and we should absolutely embrace the remote-first world, even if it made little difference for covid.

Similarly supermarkets, restaurants and so on switched very effectively from location-based services to delivery-based services. Restaurants have a lot more reason to exist than offices, but this shift is likely permanent, and a much bigger share of the economy will be online or delivery-based going forward.

Big Pharma did quite well. Multiple vaccines were developed in record time, of kind not used ever before, for kind of a virus that never had an effective vaccine before. Tests, antivirals, and so on were also developed very quickly.

What It All Means For The Next Pandemic?

Very little actually. Covid-19 had so many unusual features, there's no reason to expect the next one to be like that.

Wednesday, March 09, 2022


A small announcement. Mostly as a way to play with Crystal, I created Crystal bindings for Z3 library, and I think it might be quite usable as a MVP.

Check included examples and specs for how to use it.

Monday, March 07, 2022

New series - Open Source Adventures

I started a new series last week, Open Source Adventures. It's not terribly focused, it will be some random unrelated Open Source things I wanted to do. The first mini-project is Z3 support for Crystal programming language, but I'll jump to some very different subjects.

Just like with previous two series, you can read it on dev.to or hashnode.

The code for the series, unless it has specific reason to go elsewhere, will go to this repo.

Thursday, February 24, 2022

100 Languages Speedrun Finished!

About 100 days ago, I started the 100 Languages Speedrun series. It is now finished.

You can read all 100 episodes, as well as two bonus episodes - Tier List, and Series Retrospective.

Sunday, November 28, 2021

100 Languages Speedrun

Luna has landed! by hehaden from flickr (CC-NC)

I didn't take a long break after finishing the 100-episode daily Electron Adventures series. I already started another one - 100-episode daily "100 Languages Speedrun" series, where I'm trying out a new programming language every day.

It's been going for about a week now, and it's available:

I already explained the goals of the series in the first episode, so I'll just repost it below. Enjoy the series!

Time to start a 100 programming languages speedrun. Every day or so, I'll be posting about a different programming language. Not just doing 100 fizzbuzzes, but trying out something that's interesting about each language.

But that's not all, some of the programming languages I will create for purpose of this series. So if you follow along, you'll see not just a lot of different programming languages, but you might also learn a thing or two about how to create your own.

I won't be shy about my opinions, and I might be even exaggerating a bit. Feel free to share your thoughts in the comments.

Episodes will all be independent. Target audience is people who know programming, but don't know a 100 difference languages, so I'll often use some less idiomatic ways of doing things if I think it's clearer for such reader, or if it lets me showcase specific language feature better. For languages where it's not enforced, I'll mostly stick to best-practice cross-language code formatting (2 spaces indentation, double quoted strings, no semicolons etc.), even if that language generally uses something else.

Wednesday, November 17, 2021

Electron Adventures 100-post series is finished

Rena, with her black and white whiskers by Bennilover from flickr (CC-ND)

The Electron Adventures series I've been writing is now over.

The series is available on two platforms, with the same content:

If you want to read the conclusions, episode 99 (dev.to, hashnode) summarizes the technical aspects of the series, and episode 100 (dev.to, hashnode) talks about what it was like to do daily blogging. As it's already all there, I won't be repeating it here.

Or start from the first, or just check whichever episodes look interesting. Some subjects continue over a bunch of episodes, but there's plenty of fresh starts on the way, so you definitely don't need to read it 1 to 100.

I plan to do some more similar series in the future, they'll definitely be announced here, and for now I plan to double-post any such content to dev.to and hashnode, so feel free to follow me on whichever one's more convenient.

It's also possible that I might do a few bonus episodes beyond the 100 someday, as there's a few subjects I couldn't cover for various reasons.

Sunday, September 12, 2021

Electron Adventures 50 episodes so far

She's either helping me code or waiting to steal my pencil. #theLatter by AMsloan from flickr (CC-NC-ND)

Two months ago I got an idea of starting a small Electron coding project. And lacking any kind of moderation, I decided to just post daily coding episodes for like a 100 days. I'm halfway there.

There were definitely some technical issues early on, but I got that out of the way.

Since then I blogged at a rate of about 1 post a day - either creating or updating a small Electron program, and then doing a short writeup about it, with code samples and discussion of issues encountered along the way.

When I started, I had a vague idea of where I wanted to head:

  • I wanted to try out new code blogging platforms.
  • I wanted to collaborate with people. It's something I used to do a lot before the pandemic, but had too few opportunities since.
  • I wanted to figure out how I can code Electron in something that's not Javascript - Ruby, Python, basically anything whatsoever. Either purely non-JS, or in some kind of hybrid mode (JS frontend, non-JS backend). All other languages desperately need a good UI system, and I thought this might be worth investigating.
  • I wanted to be able to create Windows UIs for my Total War modding tools (and potentially Paradox modding tools too). I did them before with JRuby + Java-based toolkits, but none of that works very well.
  • mc more or less broke after software upgrade, and it freezes if I do anything funny, so I wanted to investigate how I can make my own Orthodox File Manager in Electron
  • and I might get some Electron and Svelte practice, as I don't use them too often

So far the adventure led me mostly somewhere else:

  • I did a few coding sessions with Amanda Cavallaro, but it's actually quite difficult to get someone to join such a big ongoing project for just an episode or two.
  • I started coding a file manager. Blogging about every tiny commit is fun, but it takes much longer to blog than to code, so I doubt I'll get even MVP this way.
  • I did some coding with Javascript frameworks I don't normally use like Vue or Marko; but zero with non-JS languages so far
  • I didn't even try to connect anything with my Total War modding tools
  • I definitely got that Electron and Svelte coding practice.

This is fine.

The series is available on two platforms, with the same content:

Each post has about 71 views total (60 views on dev.to and 11 views on hashnode).

Those numbers feel very low to me, as back in the good days a typical post on my blog would get thousands of views, occasionally tens of thousands. My most read post had 170k views.

I also don't know how many views new vs old posts get, so if people would read that for years and it would add up, or if they'd just fade away being barely searchable.

I'm also not sure how much value this series even has to the readers. A 100 post series is not something people really do, ever. Am I expecting people to read from start to finish? To pick it halfway? To just read random a post or two?

A number of the posts are reasonably self-contained, but especially the ones about building the file manager sort of assume some familiarity with existing code. I also didn't really make it obvious which episodes are self-contained and which aren't.

The codebase with each episode's code also has very little interest so far, at 2 stars and zero-activity 3 forks.

I'd probably still be coding something like this anyway, but the main point of writing is having some readers, so if people aren't very interested in this kind of content, I guess I could stop, or do something different.

I'll continue for the rest of the 100 episodes and then write another post about the whole experience.

Oh and I was contacted by multiple different people, who wanted me to write various educational content. Unfortunately I don't really have time for that.

Monday, August 23, 2021

Don't use codepen

Let's talk about websites you shouldn't use  - specifically codepen.

Back in the pre-pandemic days when I was helping people learn frontend programming, I used it a lot for showing various things. So I have 177 such "pens" there, where project is basically three files (HTML+CSS+JS).

Anyway, the why you shouldn't use it part. Codepen deliberately decided to block any way to export your data. Even getting list of your pens is not really possible without logging to Chrome and doing some console script loop. All automated access is deliberately blocked.

The only way to export is to go to 177 pens and click on a lot of buttons to get each individual zip file, and they did their best to block any way to automate this process.

The only way you can get your data - which they don't advertise in any way - is to send them GDPR data export request.

It comes in a fairly annoying format of one big csv file. I wrote a script to convert that data into a more usable form.

Being able to export your data is basic human right on the Internet, and deliberately making it difficult is a reason why you should not use websites like codepen.