Thursday, 2022-12-01

Advent of Code 2022

Project website: Advent of Code 2021.

This is a placeholder entry. Current progress can be tracked in the GitHub repo: https://github.com/gustafe/aoc2022#advent-of-code-2022. Comments for solutions are in Pod format in the individual solution files.

Previous years: 2015, 2016, 2017, 2018. 2019. 2020. 2021.

Related to this entry.

Wednesday, 2022-11-30

The moral bankrupcy of the IR “realists”

Only a so-called “international relations realist” can present these demands for an end of the war in Ukraine as “extremist”:

What I find especially striking is how liberal interventionists, unrepentant neoconservatives, and a handful of progressives who are all-in for Ukraine seem to have no doubts whatsoever about the origins of the conflict or the proper course of action to follow today. For them, Russian President Vladimir Putin is solely and totally responsible for the war, and the only mistakes others may have made in the past was to be too nice to Russia and too willing to buy its oil and gas. The only outcome they are willing to entertain is a complete Ukrainian victory, ideally accompanied by regime change in Moscow, the imposition of reparations to finance Ukrainian reconstruction, and war crimes trials for Putin and his associates. Convinced that anything less than this happy result will reward aggression, undermine deterrence, and place the current world order in jeopardy, their mantra is: “Whatever it takes for as long as it takes.”

I mean… yes? Putin is solely responsible for this war. The ideal end is for Russia to leave Ukrainian territory. Russia should pay reparations for the destruction it has wrought.

This same group has also been extraordinarily critical of those who believe responsibility for the war is not confined to Russia’s president and who think these war aims might be desirable in the abstract but are unlikely to be achieved at an acceptable cost and risk. If you have the temerity to suggest that NATO enlargement (and the policies related to it) helped pave the road to war, if you believe the most likely outcome is a negotiated settlement and that getting there sooner rather than later would be desirable, and if you favor supporting Ukraine but think this goal should be weighed against other interests, you’re almost certain to be denounced as a pro-Putin stooge, an appeaser, an isolationist, or worse.

Note to conflation of two separate things here: the supposition that NATO expansion caused Putin to start the war and that the likely end of the war will be a negotiated settlement or a frozen conflict. I personally am a pessimist. I do believe that a negotiated settlement is likely. But having the ideal of a full Ukrainian victory in mind is the morally correct one, not to try to aim for a settlement a priori.

But it is not clear to me that NATO expansion left Putin with only one option. Note that he himself did not refer to NATO in the beginning of the war, when he was sure he was going to force a regime change in Ukraine within days. Now that Russia is losing badly it’s “because of NATO”, but that’s because he, like the author of this piece, cannot see Ukrainians as a worthy foe.

By starting the war, Putin ensured that Finland and Sweden applied to join NATO, suddenly increasing Russia’s border with NATO by thousands of kilometers. So Russia has now a worse position vis-a-vis NATO than before the war, even discounting the sanctions and the billions of treasure lost to Ukrainian forces armed by NATO countries.

It’s possible that the hawks are right and that giving Ukraine whatever it thinks it needs to achieve victory is the best course of action. But this approach is hardly guaranteed to succeed; it might just prolong the war to no good purpose, increase Ukrainian suffering, and eventually lead Russia to escalate or even use a nuclear weapon.

Russia is not holding the line and calling for negotiations. It is using its cruise missiles and drones to deliberately target Ukrainian civilian infrastructure, in contravention of the laws of war. In every territory liberated by the Ukrainians, evidence of torture and mass murder by Russia has been uncovered. Every day Russia occupies Ukrainian territory increases Ukrainian suffering.

As to the nuclear threat, it’s real, but it’s not a war winning strategy. Either Russia employs a “tactical” nuke to strike Ukrainian military positions. Will this knock Ukraine out? Probably not, but it will condemn Russia to a pariah state. Likewise, literally flattening Kyiv with a strike to decapitate the leadership might end the war, but then Putin will have nuked the “cradle of Slav civilization” he was so bent on saving for “Greater Russia”.

In no way will employing a nuclear weapon “prove” that Russia is strong and capable of winning a war against one of Europe’s poorest countries. On the contrary, it will be very hard for Poland for example not to get nukes themselves, to defend themselves against an enemy that has shown it is fully prepared to use nuclear weapons in wars of aggression.

Friday, 2022-11-25

Parsing RFC 3339 timestamps using strptime in Perl

RFC 3339 is a subset[1] of ISO 8601 time formats for use in Internet communications.

An RFC 3339 timestamp can look like this: 2022-11-25T09:26:04+01:00.[2] This is the format required by the Atom and JSONfeed specifications.

Perl’s standard module Time::Piece has a simple string parsing functionality implementing the POSIX strptime format.

The problem is that the strftime directive %z does not match a timezone designation in the format +01:00, only +0100.

So to use Time::Piece to parse RFC 3339 dates, use the following Perl snippet:

my $string = "2022-11-25T09:26:04+01:00";  
$string =~ s/:(\d+)$/$1/; # strip last colon  
my $ts = Time::Piece->strptime($string, "%FT%T%z");   
# output Unix timestamp  
say $ts->epoch;

The %F directive represents the date %Y-%m-%d and is present as a GNU extension. It does not seem to be part of the original POSIX specification.


[1] For an exhaustive list of differences, see this page

[2] GNU date omits the separating T from its rfc-3339 output, but includes it in the iso-8601 version. Both indicate the timezone with a colon.

Sunday, 2022-10-23

[SvSe] Mest normala partidistrikt

Med hjälp av rådata från val.se körde jag lite statistik för att hitta vilket valdistrikt som var mest lik hela riket vad gäller partiernas procentandelar.

Jag beräknade avvikelsen genom att summera kvadraten på skillnaderna mellan varje partis procentandelar och partiets procentandel på riksnivå.

I tabellen nedan redovisas vilket distrik som låg närmast - och längst ifrån.

Jag beräknade även vilket distrikt där de olika riksdagspartierna hade mest representation, procentuellt sett.

Fördelning av partiernas procentandel i olika valdistrikt jämfört med riket

DistriktVMPSCLKDMSDÖvrAvvikelse
(Σ Δ2)
Antal röster
Riket6,755,0830,336,714,615,3419,1020,541,540,006 477 794
NärmastNorrmalm
(Skövde)
5,924,2929,766,514,527,1119,5420,951,415,171 351
Längst ifrånSödra Djursholm
(Danderyd)
1,112,113,336,769,878,2058,439,760,442 468,07902
Mest VMöllevångstorget S
(Malmö)
44,5916,9419,762,942,710,473,766,941,882 145,77850
Mest MPSkarpnäck 2 Brotorp
(Stockholm)
21,4829,3629,204,612,701,035,175,970,481 240,441 257
Mest STjärna Allé
(Borlänge)
8,907,6167,961,620,490,973,406,962,101 920,43618
Mest CNorrflärke-Solberg
(Örnsköldsvik)
3,511,8934,8624,321,359,739,1915,140,00508,70370
Mest LVästerled 15 Ålsten S
(Stockholm)
1,674,4210,8213,9617,804,8240,315,900,291 297,781 017
Mest KDNorsborg småhusområde
(Botkyrka)
5,390,2625,363,152,2327,9917,0816,032,50605,56761
Mest MSödra Djursholm
(Danderyd)
1,112,113,336,769,878,2058,439,760,442 468,07902
Mest SDOderljunga
(Perstorp)
1,293,0714,386,301,136,7913,5752,990,481 386,25619

Här är en tabell över samtliga “övriga anmälda partier” i källfilen. Jag tog reda på dom distrikt där varje parti fick flest röster.

En del är starkt lokala. “Gula Västarna” fick en röst totalt, nära Järna. Andra går inte att hitta någon information om online, som “Eropean radical reflektion a european dream party ERR” (sic!). Även dom fick en röst totalt.

Övriga anmälda partier: distrikt med flest antal röster. Om ett distrikt har lika många presenteras den med flest avlagda röster totalt.
PartiBästa distriktAntal röster distriktAntal röster riket
Partiet NyansSpånga 27 Rinkeby mellersta (Stockholm)18928 352
Alternativ för SverigeDeje (Forshaga)1416 646
Medborgerlig SamlingFredsborg (Österåker)1812 882
PiratpartietHögskolan/Trängen (Skövde)239 135
MoDSödertälje 45 Järna landsbygd (Södertälje)126 077
Kristna VärdepartietKiruna nordost (Kiruna)245 983
KnapptryckarnaStenstaliden (Kristinehamn)115 493
Feministiskt initiativEnskede 24 Dalen V (Stockholm)73 157
Landsbygdspartiet OberoendeHorn-Hycklinge-Björkfors (Kinda)352 215
DirektdemokraternaHulta (Ronneby)61 755
KlimatalliansenAnten/Gräfsnäs (Alingsås)61 702
EnhetSödertälje 45 Järna landsbygd (Södertälje)51 234
SKPLindsdal NO (Kalmar)71 181
Socialisterna-VälfärdspartietVisby Bingeby (Gotland)21892
Nordiska motståndsrörelsenSunnansjö-Saxdalen (Ludvika)6847
Partiet VändpunktBrynäs Ö (Gävle)4419
BasinkomstpartietBullermyren (Borlänge)4374
Klassiskt liberala partietFalsterbo norra (Vellinge)3344
SKÅNEPARTIETSibbarp N (Malmö)6206
Sverige ut ur EU/Frihetliga Rättvisepartiet (FRP)Höganäs NV (Höganäs)5174
Förenade Demokratiska PartietNordöstra Göteborg, Angereds Centrum (Göteborg)9157
Stram Kurs SverigeHaninge 6 Källtorp (Haninge)3156
Kalle ankapartietLorensborg SO (Malmö)2131
Volt SverigeÅtvidaberg öst (Åtvidaberg)389
Partiet FrihetGottsunda Centrum (Uppsala)374
TRYGGHETSPARTIETLorensborg V (Malmö)266
NY REFORM (NR)Albydalen C/Rotemannen (Botkyrka)347
Ond Kyckling PartietMikael (Örebro)239
Politiskt SkifteSmålandsstenar Ö (Gislaved)321
MITT SVERIGEPåarp V (Helsingborg)319
FAMILJENS FRIHETSkarpnäck 21 Pungpinan mfl (Stockholm)216
Svenska RikslagenMjällby m fl (Sölvesborg)216
ValsamverkanspartietSpånga 11 Erikslund (Stockholm)216
Europeiska Arbetarpartiet-EAPUppsamlingsdistrikt (Stockholm)115
Common sense in SwedenEdsbyn (Ovanåker)210
SwexitpartietBrittsbo-Lugnviksstrand (Östersund)210
FrihetsrörelsenKista 3 Akalla N (Stockholm)18
Nu får det fan vara nogVitsand (Torsby)28
KärlekVästra Husby-Gårdeby (Söderköping)17
ReformpartietMargretelund N (Lidköping)17
Ändrings partiet revolutionHyltebruk (Hylte)17
ANARKISTERNANorra Örnäset (Luleå)16
Det minst dåliga partietVästerled 14 Höglandet-Olovslund (Stockholm)16
Nix to the SixVästra Göteborg, Fiskebäck (Göteborg)35
ANDOPARTIET45 Hagalund N (Solna)24
Fritt valUppsamlingsdistrikt (Uppsala)14
GRÖNA DEMOKRATERNårunga-Ornunga m.fl. (Vårgårda)14
NaturistpartietIggesund Söder (Hudiksvall)14
PaxBjörksättra-Högsättra (Österåker)24
SverigepartietHällingsjö (Härryda)14
Fattigmans partiÖ Tullingeberg (Botkyrka)13
Fria WermlandGrava (Karlstad)13
John MikkonenVästerljung (Trosa)13
Min röstHaninge 40 Krogtäppan och Sommarbo (Haninge)13
NeoteknokraternaBjuv 4 (Bjuv)13
Ny DemokratiStrandvägsområdet (Katrineholm)13
Partiet FolkomröstningFröslunda-Björkhultsvägen (Eskilstuna)13
BjornpartietVästra Lund-Trojenborg (Mjölby)12
FredspartietTaxinge (Nykvarn)12
Företaget SverigeJohannes 8 Karl Staafs Park (Stockholm)22
InvandrarpartietKålgården Ö (Jönköping)12
MajspartietTorn (Lund)12
SociallibertarianernaKomarken S-Grinden (Kungälv)12
YggdrasilMårtens Fälad (Lund)12
Enad Politik12 Södra Rotebro (Sollentuna)11
Eropean radical reflektion a european dream party ERRÖstra Göteborg, Utbynäs (Göteborg)11
FramtidsTro9 Huvudsta Centrum Ö (Solna)11
Gula västarnaSödertälje 45 Järna landsbygd (Södertälje)11
Humanistisk demokrati (HD)Backa-Eskilsby m.fl. (Härryda)11
KSPHöganäs västra (Uppsala)11
MonisternaMellanheden (Malmö)11
Nationalsocialistiska reformistiska PartietS:t Olov (Landskrona)11
Nya SamhällspartietLjustadalen-Johannedal (Sundsvall)11
OKHägersten 36 Västberga Ö (Stockholm)11
Positivt Samhällsinitiativ (PSI)Lövåsen (Katrineholm)11
Stora Norrlands oberoende FrihetspartiBacke (Strömsund)11
SVENSKARNABromma 24 Blackeberg N (Stockholm)11

Thursday, 2022-07-07

A simple update queue for HN&&LO

HN&&LO is chugging along fine, almost three years after release.

One thing that’s bothered me for a while is that I don’t keep the score and comments for Hackernews entries up to date in a timely manner. So far, I’ve been going back and re-reading last month’s entries but this means that the daily view generally isn’t up-to-date.

The HN API is hosted on Firebase and thus has the ability to get real-time data, but there’s no Perl interface to it, and I really don’t have time to tinker with an entire async setup for a page that’s updated every hour at most.

Instead I’ve implemented a simple queue to keep items up to date.

Every time I read new entries from HN, I add them to the queue. I set a time about an hour in the future.

Every ten minutes or so, I check for items that are older than the current time. If there are items, I compare the data stored in my database to the current status in HN. If there’s a change, I update my datastore and re-submit the item into the queue about 2 hours in the future.

If an item is unchanged, I re-submit it 2 times in case it gets some attention.

If an item is “low score” (currently max 2 upvotes and no comments) it’s given on more chance before being removed from the queue entirely.

I’ve been working on a crude visualization of the queue, it can be seen here:

https://gerikson.com/hnlo/queue.html

I log items that are added to the DB here:

https://gerikson.com/hnlo/log.html

Hopefully this will make the main page a bit more informative than before, although just as.

Friday, 2022-07-01

Microblog blatherings, June

Get ‘em half-fresh here: https://gerikson.com/m/2022/06/index.html

Tuesday, 2022-06-07

Microblog blatherings, May

It’s where the action is.

Like and subscribe, as the saying goes.

Tuesday, 2022-05-31

Friday, 2022-05-27

19,000 dead in Sweden

DateDeaths DaysDeaths/day
2020-03-11 1 0 0,0
2020-04-09 1 000 29 34,4
2020-04-19 2 000 10 100,0
2020-05-02 3 000 13 76,9
2020-05-18 4 000 16 62,5
2020-06-11 5 000 24 41,7
2020-11-01 6 000 143 7,0
2020-11-27 7 000 26 38,5
2020-12-12 8 000 15 66,7
2020-12-23 9 000 11 90,9
2021-01-02 10 000 10 100,0
2021-01-14 11 000 12 83,3
2021-01-27 12 000 13 76,9
2021-03-01 13 000 33 30,3
2021-04-24 14 000 54 18,5
2021-10-27 15 000 186 5,4
2022-01-26 16 000 91 11,0
2022-02-15 17 000 20 50,0
2022-03-12 18 000 25 40,0
2022-05-27 19 000 76 13,2

Thursday, 2022-05-19

Libera.chat, one year later

One year ago, the failed businessman and accused felon Andrew Lee burned the Freenode network to the ground in a fit of childish pique. Luckily, responsible people were hip to his inept shenanigans and managed to launch a new network - Libera.chat - under his very nose.

In the intervening year, Freenode is a shadow of its former self. Even the alt-right lowlifes who gleefully became mods to settle old scores have slunk away to their slimy holes, and what’s left is an empty tomb, briefly visited by confused chatters who haven’t gotten the memo.

About 2 months after the events, I wrote the following little essay which never got polished enough for publication. I figured I could just dump it here now.

Slava Libera!

Irc culture wars (2020-07-20)

IRC as a mainstream cultural phenomenon peaked in 2002. At around that time, Freenode was started to address the issues with IRC as it was: spam, warez, channel and nick hijacking, and a general juvenile attitude.

Freenode saw a need for FOSS projects to have stability. To be able to claim and keep the channels they wanted, to be able to address spam and trolls, and to have a stable environment to point users to.

At the time, Freenode was the fussy nerd, not participating in the chaos the cool kids reveled in. But it filled the need for FOSS projects, and found its own niche within IRC.

As time passed, people left IRC, but many FOSS projects stayed on Freenode. This meant that as time passed, Freenode become more and more dominant within IRC. And the IRC culture that Freenode fostered became the norm, instead of the exception.

As IRC shrank, those that held the old IRC ideals dear were forced to use Freenode more and more. There they came into conflict with the Freenode norms. Conflicts about channel ownership and the wider issues of “free speech” erupted and were dealt with. Coupled with the entryism strategy of the alt-right and the general undercurrent of right-libertarianism of FOSS, this created a minority of dissidents on Freenode, at least as well versed in IRC warfare as the staff.

The takeover/coup of Freenode should be seen in this context. The dominant ideology of new Freenode is free speech, anti-LGBT, and adherence to fringe Unix shibboleths such as anti-systemd, anti-Codes of Conduct, and anti anti-RMS. And they would have gotten away with it too, had not the old staff adroitly moved to Libera.chat, and convinced almost every FOSS project to move too. Those that didn’t move were soon alienated by the new staff, who were more interested in settling old scores than the boring work of IRC stewardship.

Andrew Lee and his hardcore supporters are now betting that there’s still a market for old-style IRC, while at the same time loudly proclaiming their continued allegiance to FOSS. But their victory is hollow. They have won the battle but probably lost the war.

Monday, 2022-05-16

PSA: unmaintained project channels on Freenode automatically redirect to #freenode

During the management changes at Freenode in Jul 2021, all access lists and channel ownerships were reset. Existing channels that were not reclaimed by projects now automatically redirect to the main channel, which is #freenode.

If you have a specific question about a project, please make sure you’re actually in a maintained channel, and not in the main channel.

If the channel is not maintained, try checking the project’s homepage for their IRC presence. It’s usually under the “Community” section.

Saturday, 2022-04-30

Gemini in April

Link to portal.

Thursday, 2022-03-31

March

Helgeandsholmen

Mar 2021 | Mar 2020 | Mar 2019 | Mar 2018 | Mar 2017 | Mar 2016 | Mar 2015 | Mar 2014 | Mar 2013 | Mar 2012 | Mar 2011 | Mar 2010 | Mar 2009