<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Insomniac&#39;s Log</title><link>https://duti.dev/</link><description></description><generator>Gozer</generator><lastBuildDate>Sun, 08 Nov 2026 05:07:45 +0900</lastBuildDate><item><title>Hacking South Korea&#39;s National Cyber Security Center</title><link>https://duti.dev/blog/2026/hacking-south-korea/</link><description>&lt;p&gt;How? DNS Hijacking. How? Expired nameservers. No DNSSEC.&lt;/p&gt;&#xA;&lt;p&gt;Some logs from September:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plain&#34;&gt;yuu@fishy ~ &amp;gt; dig ncsc.go.kr NS @c.dns.kr.&#xA;&#xA;; &amp;lt;&amp;lt;&amp;gt;&amp;gt; DiG 9.20.30 &amp;lt;&amp;lt;&amp;gt;&amp;gt; ncsc.go.kr NS @c.dns.kr.&#xA;; (1 server found)&#xA;;; global options: +cmd&#xA;;; Got answer:&#xA;;; -&amp;gt;&amp;gt;HEADER&amp;lt;&amp;lt;- opcode: QUERY, status: NOERROR, id: 63757&#xA;;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 2&#xA;;; WARNING: recursion requested but not available&#xA;&#xA;;; OPT PSEUDOSECTION:&#xA;; EDNS: version: 0, flags:; udp: 1232&#xA;;; QUESTION SECTION:&#xA;;ncsc.go.kr.&#x9;&#x9;&#x9;IN&#x9;NS&#xA;&#xA;;; ANSWER SECTION:&#xA;ncsc.go.kr.&#x9;&#x9;180&#x9;IN&#x9;NS&#x9;ns1.aegis-k.com.&#xA;ncsc.go.kr.&#x9;&#x9;180&#x9;IN&#x9;NS&#x9;ns2.aegis-k.com.&#xA;ncsc.go.kr.&#x9;&#x9;180&#x9;IN&#x9;NS&#x9;ns.ncsc.go.kr.&#xA;&#xA;;; ADDITIONAL SECTION:&#xA;ns.ncsc.go.kr.&#x9;&#x9;180&#x9;IN&#x9;A&#x9;210.99.169.131&#xA;&#xA;;; Query time: 141 msec&#xA;;; SERVER: 210.101.61.1#53(c.dns.kr.) (UDP)&#xA;;; WHEN: Sun Sep 08 04:48:00 JST 2026&#xA;;; MSG SIZE  rcvd: 72&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plain&#34;&gt;yuu@fishy ~ &amp;gt; rdap aegis-k.com&#xA;Error: Object not found (404)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Probably the most stupid way to get hacked. The attack vector entered academic&#xA;literature all the way back in 2016 [1] and a bunch of them were discovered and&#xA;fixed in 2017 [2]. The UAE was hacked in 2018 [3] via DNS hijacking and a bunch&#xA;of others in 2019 [4].&lt;/p&gt;&#xA;&lt;p&gt;A couple months ago, I saw that &lt;a href=&#34;https://lina.sh&#34;&gt;Lina&lt;/a&gt;&#39;s post on&#xA;&lt;a href=&#34;https://lina.sh/blog/hijacking-e164-arpa&#34;&gt;how an expired nameserver let them log hundreds of thousands of phone calls to military bases&lt;/a&gt;&#xA;[5]. That was sorta what triggered me to take a brief look.&lt;/p&gt;&#xA;&lt;p&gt;Everyone always targets the US and Europe since I guess they&#39;re more familiar&#xA;and have more transparency. The US publishes a list of all government domains&#xA;[6] and so that also makes it fairly easy to automate.&lt;/p&gt;&#xA;&lt;p&gt;Was using certificate transparency in some other projects so I thought why not&#xA;use that for a list of all global government domains. Surely a problem that&#39;s&#xA;been around for so long has been fixed at this point.&lt;/p&gt;&#xA;&lt;p&gt;Well, no. Just for expired nameservers, I got ~21 hits. South Korea had the most&#xA;straight forward disclosure process and fixed the issue within 2 months, so good&#xA;for them.&lt;/p&gt;&#xA;&lt;p&gt;Don&#39;t bother looking for the others. I paid a couple hundred dollars to register&#xA;all the expired nameservers so nobody else could.&lt;/p&gt;&#xA;&lt;p&gt;Anyways, this could&#39;ve been bad. Intercepting mail, internal traffic, and&#xA;whatnot especially for the place where government vulnerabilities are reported&#xA;would&#39;ve been fun if I didn&#39;t jump the gun and register the domains with my&#xA;credit card instead of crypto.&lt;/p&gt;&#xA;&lt;p&gt;P.s. The other countries aren&#39;t really responding. Maybe I should be handing&#xA;this to ICANN or something? Don&#39;t have contacts, too lazy to bother. If there&#39;s&#xA;an email I can just ping with the list that&#39;d be nice.&lt;/p&gt;&#xA;&lt;p&gt;P.s.2 Lots of queries from Australia for Chinese government domains for some&#xA;reason. Suspicious.&lt;/p&gt;&#xA;&lt;p&gt;Been looking a bit more into government stuff since, and so so many stupid shit&#xA;like this. Anything from running ancient vulnerable versions of things to&#xA;unauthenticated internal shit visible on certificate transparency. &amp;quot;AI too&#xA;powerful&amp;quot; -&amp;gt; nah the world is just too fragile.&lt;/p&gt;&#xA;&lt;h2&gt;References&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;[1]&#xA;&lt;a href=&#34;https://www.computer.org/csdl/proceedings-article/sp/2016/0824a691/12OmNxRF739&#34;&gt;https://www.computer.org/csdl/proceedings-article/sp/2016/0824a691/12OmNxRF739&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;[2] &lt;a href=&#34;https://securitee.org/files/dnshijack_ccs2017.pdf&#34;&gt;https://securitee.org/files/dnshijack_ccs2017.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;[3]&#xA;&lt;a href=&#34;https://blog.talosintelligence.com/dnspionage-campaign-targets-middle-east/&#34;&gt;https://blog.talosintelligence.com/dnspionage-campaign-targets-middle-east/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;[4] &lt;a href=&#34;https://blog.talosintelligence.com/seaturtle/&#34;&gt;https://blog.talosintelligence.com/seaturtle/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;[5] &lt;a href=&#34;https://lina.sh/blog/hijacking-e164-arpa&#34;&gt;https://lina.sh/blog/hijacking-e164-arpa&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;[6] &lt;a href=&#34;https://get.gov/about/data/&#34;&gt;https://get.gov/about/data/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description><pubDate>Sun, 08 Nov 2026 00:00:00 +0000</pubDate><guid>https://duti.dev/blog/2026/hacking-south-korea/</guid></item><item><title>A New Beginning</title><link>https://duti.dev/blog/2026/a-new-start/</link><description>&lt;p&gt;This site was initially created as a semi-anonymous blog, where I, without a&#xA;real public identity could post whatever I wanted without consequence. Well, my&#xA;life has taken a bit of an unexpected turn, and privacy is no longer possible.&lt;/p&gt;&#xA;&lt;p&gt;I&#39;ve deleted &lt;em&gt;some&lt;/em&gt; posts but honestly there shouldn&#39;t be anything too&#xA;outrageous that anyone would wanna look into. For personal posts, I&#39;ll be&#xA;migrating to post on a new anonymous domain. Obviously not gonna link it.&lt;/p&gt;&#xA;&lt;h2&gt;A Brief History&lt;/h2&gt;&#xA;&lt;p&gt;The original &lt;code&gt;duti.site&lt;/code&gt; was started sometime in 2016 by my then senior,&#xA;Benjamin Hollon at Dalat International School (Penang, Malaysia). It had a few&#xA;things, namely an HTML tutorial, a few games, and wizard.css — something akin to&#xA;Bootstrap but with a minimalist aesthetic.&lt;/p&gt;&#xA;&lt;p&gt;While I had learned a bit of Scratch and &lt;em&gt;some weird magnetic tape robotic&#xA;thing&lt;/em&gt; before, this was where I learned web programming, and also the beginning&#xA;of the time I had unfettered internet access.&lt;/p&gt;&#xA;&lt;p&gt;Of course, being the Chūnibyō kids we were (2nd year of middle school), there&#xA;was also a &lt;code&gt;projectwd.duti.site&lt;/code&gt;, which stood for &amp;quot;Project World Domination&amp;quot; 🤦.&#xA;Memories are a bit fuzzy about exactly what we did, but I remember learning&#xA;about the dark web via Tor, sending spoofed emails (SPF/DKIM was rarely seen&#xA;back then), and various tidbits of Batch to remotely shut down library&#xA;computers. I created my first GitHub account around that time, but the username&#xA;has been lost to time.&lt;/p&gt;&#xA;&lt;p&gt;Sometime in 2018, the domain expires, and given that GitHub&#39;s Education pack&#xA;allowed you to get a free &lt;code&gt;.me&lt;/code&gt; or &lt;code&gt;.site&lt;/code&gt; domain, I snatched it up, but didn&#39;t&#xA;actually do anything with it... It ended up in the hands of squatters shortly&#xA;after.&lt;/p&gt;&#xA;&lt;p&gt;At some point, a family member wanted to start an internet business with a&#xA;decently short and memorable domain name. I bought the domain &lt;code&gt;duti.dev&lt;/code&gt; since&#xA;&lt;code&gt;.site&lt;/code&gt; wasn&#39;t available and &lt;code&gt;dev&lt;/code&gt; was well priced. It was gonna be a site to&#xA;sell organic vegetables from my grandparent&#39;s village, but considering I&#xA;wouldn&#39;t be available as tech support for most of the year, they ended up just&#xA;using Google Forms instead.&lt;/p&gt;&#xA;&lt;p&gt;Starting in 2023, I wrote a few blogs on random things I encountered with Linux.&#xA;Somehow I accidentally deleted the GitHub repository for the blog in 2025 with&#xA;no local backups. Most of the content was unrecoverable, though some copies live&#xA;on in Cardiff University&#39;s Discord in the form of a PDF (e.g. a tutorial on how&#xA;to get non-Ubuntu Linuxes connected to eduroam). Migrated to &lt;code&gt;gozer&lt;/code&gt; and started&#xA;doing proper backups from then on :)&lt;/p&gt;&#xA;&lt;p&gt;I got into a bit of trouble with earlier drafts on the post criticizing&#xA;HackEurope. Lots of professional connections reached out and warned me of&#xA;burning bridges &amp;amp; inappropriate language. I stopped posting as much since, as I&#xA;hate having to consider every word and how I may be perceived as a result. I&#xA;missed being a random anonymous person from a 3rd world country where internet&#xA;laws don&#39;t apply and nobody could find me anyways.&lt;/p&gt;&#xA;&lt;h2&gt;So What Now?&lt;/h2&gt;&#xA;&lt;p&gt;I suppose I&#39;ll start treating this site like I do LinkedIn. A somewhat official&#xA;place to put corporatized posts.&lt;/p&gt;&#xA;</description><pubDate>Wed, 29 Jul 2026 00:00:00 +0000</pubDate><guid>https://duti.dev/blog/2026/a-new-start/</guid></item><item><title>[Incomplete] On the Privacy of Apple Location Services &amp; Analytics</title><link>https://duti.dev/blog/2026/location-services/</link><description>&lt;blockquote&gt;&#xA;&lt;p&gt;Note: This was written late 2025 with the expectation that I will complete&#xA;this research at some point. I now realize I&#39;ll probably never have the time&#xA;to finish it, and am therefore releasing it now.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&#34;#user-relevant-info&#34;&gt;Skip technical stuff&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Btw this is a sequel to some of my prior research on how the location services&#xA;work. See&#xA;&lt;a href=&#34;https://github.com/acheong08/apple-corelocation-experiments/&#34;&gt;https://github.com/acheong08/apple-corelocation-experiments/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;Contrary to popular belief, GPS is no longer the primary method mobile devices&#xA;use to determine location.&lt;/p&gt;&#xA;&lt;p&gt;Instead, companies like Google and Apple maintain massive databases of Wi-Fi&#xA;hotspots and cell towers. Phones collect signals from these beacons, including&#xA;strength and identifiers, and use them to triangulate their position, with the&#xA;help of data provided by these vendors.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://r2.duti.dev/blog/images/trilateration.png&#34; alt=&#34;Trilateration algorithm for n points&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;To build these databases, iOS and Android devices act as passive wardrivers:&#xA;they continuously report nearby access points to Apple and Google. This data is&#xA;then aggregated across countless devices to determine the locations of access&#xA;points with high accuracy.&lt;/p&gt;&#xA;&lt;p&gt;A recent paper,&#xA;&lt;a href=&#34;https://www.cs.umd.edu/~dml/papers/wifi-surveillance-sp24.pdf&#34;&gt;&amp;quot;Surveilling the Masses with Wi-Fi-Based Positioning Systems&amp;quot;&lt;/a&gt;&#xA;(May 2024), explores how Apple’s location services can be weaponized to track&#xA;movements worldwide, particularly in sensitive contexts like war zones and&#xA;natural disasters.&lt;/p&gt;&#xA;&lt;p&gt;I found the paper fascinating. On the same day it was published, I began reverse&#xA;engineering the &lt;code&gt;clls/wloc&lt;/code&gt; endpoint using definitions decompiled from&#xA;&lt;code&gt;CoreLocationProtobuf.framework&lt;/code&gt;. Over the following weeks, I uncovered&#xA;additional endpoints, such as:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;wifi_request_tile&lt;/code&gt;: retrieves BSSIDs in a given area via an obfuscated tile&#xA;key&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;hcy/pbcwloc&lt;/code&gt;: uploads data about newly discovered endpoints&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;By combining the &lt;code&gt;tile&lt;/code&gt; endpoint with an expanding search algorithm layered on&#xA;top of &lt;code&gt;wloc&lt;/code&gt;, I was able to reproduce the dataset described in the paper within&#xA;a single day.&lt;/p&gt;&#xA;&lt;p&gt;With the external dataset re-created, the next question was: &lt;em&gt;how much data is&#xA;actually being sent to Apple from devices in the first place?&lt;/em&gt;&lt;br&gt;&#xA;I’m writing this from the University of Cambridge, where I’m spending three&#xA;weeks on a research project exploring exactly that.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2&gt;Reverse Engineering the Protocols&lt;/h2&gt;&#xA;&lt;p&gt;Apple relies on a custom RPC format known as &lt;strong&gt;ARPC&lt;/strong&gt;. Unlike typical&#xA;self-describing formats, ARPC does not embed enough information to fully decode&#xA;requests and responses on its own.&lt;/p&gt;&#xA;&lt;p&gt;A standard &lt;strong&gt;request&lt;/strong&gt; has the following structure:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&lt;thead&gt;&#xA;&lt;tr&gt;&#xA;&lt;th&gt;Field&lt;/th&gt;&#xA;&lt;th&gt;Size&lt;/th&gt;&#xA;&lt;th&gt;Type&lt;/th&gt;&#xA;&lt;th&gt;Description&lt;/th&gt;&#xA;&lt;/tr&gt;&#xA;&lt;/thead&gt;&#xA;&lt;tbody&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;Version&lt;/td&gt;&#xA;&lt;td&gt;2 bytes&lt;/td&gt;&#xA;&lt;td&gt;uint16&lt;/td&gt;&#xA;&lt;td&gt;Protocol version&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;Locale&lt;/td&gt;&#xA;&lt;td&gt;variable&lt;/td&gt;&#xA;&lt;td&gt;pascal string&lt;/td&gt;&#xA;&lt;td&gt;Locale string&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;AppIdentifier&lt;/td&gt;&#xA;&lt;td&gt;variable&lt;/td&gt;&#xA;&lt;td&gt;pascal string&lt;/td&gt;&#xA;&lt;td&gt;Application identifier string&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;OsVersion&lt;/td&gt;&#xA;&lt;td&gt;variable&lt;/td&gt;&#xA;&lt;td&gt;pascal string&lt;/td&gt;&#xA;&lt;td&gt;OS version string&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;FunctionId&lt;/td&gt;&#xA;&lt;td&gt;4 bytes&lt;/td&gt;&#xA;&lt;td&gt;uint32&lt;/td&gt;&#xA;&lt;td&gt;Function ID&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;Payload Length&lt;/td&gt;&#xA;&lt;td&gt;4 bytes&lt;/td&gt;&#xA;&lt;td&gt;uint32&lt;/td&gt;&#xA;&lt;td&gt;Length of payload&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;Payload&lt;/td&gt;&#xA;&lt;td&gt;variable&lt;/td&gt;&#xA;&lt;td&gt;bytes&lt;/td&gt;&#xA;&lt;td&gt;Payload data&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Responses are trickier: they can contain an arbitrary number of fields of&#xA;unknown sizes. To parse them, one can exploit the fact that the &lt;strong&gt;payload&#xA;length&lt;/strong&gt; encodes the number of bytes from its position to the end of the&#xA;message. Practically, this means scanning the response with a sliding 4-byte&#xA;window, checking if each candidate encodes a valid remaining length. If multiple&#xA;candidates match, the largest valid body size and corresponding header size are&#xA;chosen.&lt;/p&gt;&#xA;&lt;h2&gt;Working Out the Protobuf&lt;/h2&gt;&#xA;&lt;p&gt;The payload itself can contain any arbitrary bytes, including encrypted blobs -&#xA;but in most observed cases it uses &lt;strong&gt;protobuf&lt;/strong&gt;. The next challenge is&#xA;discovering the protobuf definitions.&lt;/p&gt;&#xA;&lt;p&gt;Tools like &lt;a href=&#34;https://github.com/arkadiyt/protodump&#34;&gt;protodump&lt;/a&gt; can extract&#xA;protobuf file descriptors from raw binaries, but they don’t work with Apple’s&#xA;custom compiler, which converts protobuf definitions directly to Objective-C.&lt;/p&gt;&#xA;&lt;p&gt;Most of the protobuf decoding logic isn’t located in the &lt;code&gt;locationd&lt;/code&gt;, &lt;code&gt;geod&lt;/code&gt;, or&#xA;&lt;code&gt;geoanalyticsd&lt;/code&gt; binaries themselves. Instead, it resides in private frameworks&#xA;inside the dyld cache. To extract them, use&#xA;&lt;a href=&#34;https://github.com/keith/dyld-shared-cache-extractor&#34;&gt;dyld-shared-cache-extractor&lt;/a&gt;.&#xA;To fetch the filesystem image for iOS, use&#xA;&lt;a href=&#34;https://github.com/blacktop/ipsw&#34;&gt;ipsw&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;ipsw download ipsw --version 18.6.2 --device iPhone15,2&#xA;ipsw extract --files --pattern &amp;quot;.*&amp;quot; iPhone15,2_18.6.2_22G100_Restore.ipsw&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;On macOS, the iOS Simulator runs its system binaries natively, which allows&#xA;attaching &lt;code&gt;lldb&lt;/code&gt;, but only with SIP (System Integrity Protection) disabled.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;ps aux | grep simruntime | grep locationd   # Find the PID of locationd running within the simulator&#xA;sudo lldb -p &amp;lt;pid&amp;gt;                          # Attach to process (requires SIP disabled)&#xA;br set -n &amp;quot;-[NSURLSessionTask resume]&amp;quot;      # Set breakpoint on network requests&#xA;po [$x0 originalRequest]                    # Inspect request details (e.g. URL)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The next step is mapping addresses in &lt;strong&gt;Ghidra&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To find the base load address, run:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;image list &amp;lt;binary name, e.g. geoanalyticsd&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then, from the backtrace, take the top frame address that matches your binary.&#xA;Subtract the base load address to get a file offset, then add &lt;code&gt;0x100000000&lt;/code&gt; to&#xA;obtain the virtual address expected by Ghidra.&lt;/p&gt;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;p/x 0x1048ddda0, 0x1048d4000 = 0x9da0&#xA;p/x 0x100000000 + 0x9da0      = 0x100009da0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Finally, in Ghidra: &lt;code&gt;Navigation &amp;gt; Go To&lt;/code&gt; → paste the calculated address.&lt;/p&gt;&#xA;&lt;img alt=&#34;Screenshot of decompiled C for wloc protobuf&#34; src=&#34;https://r2.duti.dev/blog/images/reversed-wloc-protoc.png&#34; style=&#34;max-height: 40rem;&#34;/&gt;&#xA;&lt;p&gt;Using the index numbers and associated symbols, the protobuf definition can then&#xA;be manually reconstructed. With protobuf definitions in hand, we can now find&#xA;exactly what data is getting sent off to Apple.&lt;/p&gt;&#xA;&lt;h2&gt;&lt;span id=&#34;user-relevant-info&#34;&gt;Privacy Settings and Observed Traffic&lt;/span&gt;&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Long story short: under &lt;strong&gt;Privacy &amp;amp; Security &amp;gt; Location Services &amp;gt; System&#xA;Services&lt;/strong&gt;, it’s worth turning off at least the following options:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Routing &amp;amp; Traffic&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Apple Pay Merchant Identification&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Improve Maps&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;iPhone Analytics&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3&gt;So what is collected?&lt;/h3&gt;&#xA;&lt;p&gt;Lets start off with what Apple claims.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Routing &amp;amp; Traffic&lt;/em&gt;&lt;/strong&gt;: While you are in &lt;strong&gt;transit&lt;/strong&gt; (for example, walking or&#xA;driving), your iPhone will periodically send &lt;strong&gt;GPS data, travel speed and&#xA;direction, and barometric pressure&lt;/strong&gt; information in an anonymous and encrypted&#xA;form to Apple... Additionally, when you &lt;strong&gt;open an app&lt;/strong&gt; near a &lt;strong&gt;point of&#xA;interest&lt;/strong&gt; (for example, a business or park) your iPhone will send &lt;strong&gt;location&#xA;data&lt;/strong&gt; in an &lt;strong&gt;anonymous and encrypted&lt;/strong&gt; form...&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Apple Pay Merchant Identification&lt;/em&gt;&lt;/strong&gt;: Your iPhone will use your &lt;strong&gt;current&#xA;location&lt;/strong&gt; to help provide more accurate &lt;strong&gt;merchant names&lt;/strong&gt; when you use your&#xA;physical Apple Card.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Improve Maps&lt;/em&gt;&lt;/strong&gt;: Apple will collect the GPS coordinates obtained through&#xA;the &lt;strong&gt;Significant Locations&lt;/strong&gt; feature on your device and correlate them with&#xA;the &lt;strong&gt;street address associated with your Apple Account&lt;/strong&gt;... Your iOS, iPadOS,&#xA;or visionOS device will also periodically send &lt;strong&gt;locations of where and when&#xA;you launched apps&lt;/strong&gt;, including the &lt;strong&gt;name of the apps&lt;/strong&gt;, in an anonymous and&#xA;encrypted form to Apple in order to improve Maps and other Apple&#xA;location-based products and services.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So in summary, GPS location, transaction information from NFC, your street&#xA;address even if not present, and when &amp;amp; where apps were launched. While this&#xA;isn&#39;t great, the fact that it is &amp;quot;anonymous&amp;quot;, &amp;quot;encrypted&amp;quot;, and periodic should&#xA;hopefully make traffic impossible to tie to an identity.&lt;/p&gt;&#xA;&lt;p&gt;Of course words mean nothing without data. Lets make use of the reverse&#xA;engineering and decode what Apple is sending off.&lt;/p&gt;&#xA;&lt;h3&gt;Data Collection and Analysis&lt;/h3&gt;&#xA;&lt;p&gt;To analyze Apple&#39;s location service traffic, I intercepted HTTPS requests from&#xA;an iPhone running IOS 18.6.2 with default settings over the course of 7 days&#xA;using &lt;code&gt;mitmproxy&lt;/code&gt;&#39;s WireGuard mode. The device was used as a normal daily driver&#xA;(apps opened, routes walked, payments made).&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;mitmweb --web-host 100.64.0.7 --mode wireguard --set allow_hosts=&amp;quot;mitm\.it|.*\.ls\.apple\.com|gs-loc\.apple\.com&amp;quot; --listen-host 167.99.85.207 -w apple.flow --set view_filter=&amp;quot;mitm\.it|.*\.ls\.apple\.com|gs-loc\.apple\.com&amp;quot;&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Efforts were made to ensure only traffic for location services were captured and&#xA;to prevent decryption of irrelevant data.&lt;/p&gt;&#xA;&lt;h3&gt;Routing &amp;amp; Traffic&lt;/h3&gt;&#xA;&lt;p&gt;The primary endpoints associated with this setting are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;https://gsp10-ssl.apple.com/pds/pd&lt;/code&gt;. Contains a large array of a structure&#xA;containing GPS coordinates, timestamps, and other sensor measurements.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;https://gsp10-ssl.apple.com/au&lt;/code&gt;. Contains a list of app bundle identifiers,&#xA;GPS coordinates, and timestamps&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Between 3 and 4 requests were observed per day varying from 1.5kb to 124kb in&#xA;size, directly corresponding to the number of steps taken since the previous&#xA;request&lt;/li&gt;&#xA;&lt;li&gt;The GPS locations are highly accurate and not obfuscated with technology like&#xA;differential privacy. I could spot the exact table I sat at events and the&#xA;general room I stayed in.&lt;/li&gt;&#xA;&lt;li&gt;Requests to the 2 endpoints are usually made within milliseconds of each&#xA;other.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Data is collected, aggregated, and sent in batches, tying lots of unique data&#xA;points together.&lt;/p&gt;&#xA;&lt;img src=&#34;https://r2.duti.dev/blog/images/pds-transit-map2.png&#34; width=&#34;400&#34; alt=&#34;Map of me walking home after an event&#34;&gt;&#xA;&lt;img src=&#34;https://r2.duti.dev/blog/images/au-app-map.png&#34; width=&#34;500&#34; alt=&#34;Map of open app locations&#34;&gt;&lt;img src=&#34;https://r2.duti.dev/blog/images/pds-raw-request.png&#34; width=&#34;400&#34; alt=&#34;Screenshot of raw request showing fingerprintable information&#34;&gt;&#xA;&lt;p&gt;The map shows just a single request, really visualizing how densely the points&#xA;are packed.&lt;/p&gt;&#xA;&lt;p&gt;The requests also include device fingerprints (locale, OS version) and a unique&#xA;UUID.&lt;/p&gt;&#xA;&lt;p&gt;In terms of timing, requests tend to be sent while the phone is plugged in and&#xA;idle. Oddly, requests also occur to be triggered when the alarm goes off.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;TODO: Get a rooted phone and ripgrep through where that ID may be stored to be&#xA;tied back to request&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3&gt;Apple Pay Merchant Information&lt;/h3&gt;&#xA;&lt;p&gt;The only associated endpoint is &lt;code&gt;https://gsp-ssl.ls.apple.com/dispatcher.arpc&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Decoded data from a collected request:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-json&#34;&gt;&amp;quot;6&amp;quot;: {&#xA;  &amp;quot;card_type&amp;quot;: &amp;quot;MasterCard&amp;quot;,&#xA;  &amp;quot;currency&amp;quot;: &amp;quot;EUR&amp;quot;,&#xA;  &amp;quot;16&amp;quot;: 1,&#xA;  &amp;quot;17&amp;quot;: &amp;quot;8D0DDB68-0C2D-4A39-AD20-77454B02D876&amp;quot;,&#xA;  &amp;quot;18&amp;quot;: 0,&#xA;  &amp;quot;merchant&amp;quot;: &amp;quot;2TL BRUSSEL, NOORD&amp;quot;,&#xA;  &amp;quot;21&amp;quot;: &amp;quot;&amp;quot;,&#xA;  &amp;quot;timestamp&amp;quot;: 4739811754110877696,&#xA;  &amp;quot;8&amp;quot;: 0,&#xA;  &amp;quot;9&amp;quot;: 1&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Card provider&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Currency&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Transaction ID&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Merchant name&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Timestamp&lt;/p&gt;&#xA;&lt;p&gt;Surprisingly, disabling the toggle only stops &lt;strong&gt;uploading&lt;/strong&gt; the data, not&#xA;&lt;strong&gt;collection&lt;/strong&gt;. Data is stored locally until you re-enable the setting, at&#xA;which point it’s uploaded. In this case, the timestamp (4739811754110877696 →&#xA;Aug 30, 2025) is from a week before September 6th when this request was&#xA;observed. All analytics settings were turned off at the time.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3&gt;Improve Maps &amp;amp; iPhone Analytics&lt;/h3&gt;&#xA;&lt;p&gt;Endpoint: &lt;code&gt;https://gsp64-ssl.ls.apple.com/hvr/v3/use&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;This endpoint doesn’t use protobuf, so decoding is limited to string analysis.&#xA;Observed payloads include:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Subsets of open apps (Network extensions like WireGuard, Mullvad, Little&#xA;Snitch were observed)&lt;/li&gt;&#xA;&lt;li&gt;Addresses linked to the Apple account even if not currently nearby. For&#xA;example, I observed multiple Cardiff addresses despite being in Cambridge.&#xA;Searching through the phone reveals that they come from the Contacts app.&lt;/li&gt;&#xA;&lt;li&gt;IPs and ports the device is connected to&lt;/li&gt;&#xA;&lt;li&gt;BSSIDs&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;With settings disabled, requests are still sent, but reduced to just home&#xA;location and timestamps.&lt;/p&gt;&#xA;&lt;h3&gt;&lt;span id=&#34;endpoint-summary&#34;&gt;Endpoint summary&lt;/span&gt;&lt;/h3&gt;&#xA;&lt;table&gt;&#xA;&lt;thead&gt;&#xA;&lt;tr&gt;&#xA;&lt;th&gt;Domain&lt;/th&gt;&#xA;&lt;th&gt;Path(s)&lt;/th&gt;&#xA;&lt;th&gt;Controlled by Setting&lt;/th&gt;&#xA;&lt;th&gt;Data Sent&lt;/th&gt;&#xA;&lt;th&gt;Notes&lt;/th&gt;&#xA;&lt;/tr&gt;&#xA;&lt;/thead&gt;&#xA;&lt;tbody&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;&lt;code&gt;gsp10-ssl.apple.com&lt;/code&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;code&gt;/pds/pd&lt;/code&gt;, &lt;code&gt;/au&lt;/code&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;strong&gt;Routing &amp;amp; Traffic&lt;/strong&gt;&lt;/td&gt;&#xA;&lt;td&gt;GPS coordinates, travel speed, barometric pressure, app launches near POIs&lt;/td&gt;&#xA;&lt;td&gt;Sent continuously; “anonymous” but easily linkable via app/device data&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;&lt;code&gt;gsp-ssl.ls.apple.com&lt;/code&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;code&gt;/dispatcher.arpc&lt;/code&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;strong&gt;Apple Pay Merchant Identification&lt;/strong&gt;&lt;/td&gt;&#xA;&lt;td&gt;Card provider, currency, transaction ID, merchant name, timestamp&lt;/td&gt;&#xA;&lt;td&gt;Data still collected locally when disabled; uploaded once re-enabled&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;&lt;code&gt;gsp64-ssl.ls.apple.com&lt;/code&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;code&gt;/hvr/v3/use&lt;/code&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;strong&gt;Improve Maps &amp;amp; iPhone Analytics&lt;/strong&gt;&lt;/td&gt;&#xA;&lt;td&gt;Open apps (esp. network tools), Apple account–linked addresses, IPs and ports, BSSIDs, timestamps&lt;/td&gt;&#xA;&lt;td&gt;Requests persist even when disabled, but with reduced detail&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;&lt;code&gt;gsp10-ssl.apple.com&lt;/code&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;code&gt;/hcy/pbcwloc&lt;/code&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;strong&gt;Improve Location Services&lt;/strong&gt;&lt;/td&gt;&#xA;&lt;td&gt;Nearby BSSIDs, cell provider, location, movement/activity&lt;/td&gt;&#xA;&lt;td&gt;Passive Wi-Fi/cell scanning; builds Apple’s positioning database&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3&gt;When and where is location data collected?&lt;/h3&gt;&#xA;&lt;p&gt;Apple’s terms use vague phrases like &lt;em&gt;“in transit”&lt;/em&gt; and &lt;em&gt;“points of interest.”&lt;/em&gt;&#xA;In practice, these cover nearly all daily activity:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Transit&lt;/strong&gt; applies whenever your phone is moving, whether you’re walking,&#xA;cycling, or driving.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Points of interest&lt;/strong&gt; applies whenever you stop somewhere with a map label -&#xA;your home, workplace, shops, restaurants, and so on.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The result is that your iPhone sends location data whether you’re moving or&#xA;standing still, essentially &lt;strong&gt;all the time&lt;/strong&gt;. During testing, I saw logs for&#xA;every commute, every stop at a shop or restaurant, and every app I opened&#xA;throughout the week.&lt;/p&gt;&#xA;&lt;h3&gt;Cross-request correlation and deanonymization&lt;/h3&gt;&#xA;&lt;p&gt;Apple’s traffic is highly susceptible to correlation across requests. Analytics&#xA;data is usually sent in batches by background daemons, which means requests&#xA;often share near-identical timestamps. For example, &lt;code&gt;/pds/pd&lt;/code&gt; and &lt;code&gt;/au&lt;/code&gt; are&#xA;almost always transmitted within milliseconds of each other, and their GPS&#xA;coordinates and timestamps can be matched to link app usage with a specific&#xA;route.&lt;/p&gt;&#xA;&lt;p&gt;Beyond timing, every request carries device fingerprints, locale, iOS version,&#xA;user agent, and IP address. Combined with the set of installed apps (which Apple&#xA;already knows for each account), these details form a unique device profile.&#xA;Even if Apple labels traffic as &lt;em&gt;“anonymous,”&lt;/em&gt; the mix of app usage, device&#xA;metadata, and network identifiers makes it straightforward to connect requests&#xA;back to an individual user.&lt;/p&gt;&#xA;&lt;h2&gt;Privacy implications and adversaries&lt;/h2&gt;&#xA;&lt;h3&gt;Passive network observer (ISP, VPN provider, DNS resolver)&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Can see &lt;strong&gt;frequency, timing, and size&lt;/strong&gt; of requests, though the payload is&#xA;encrypted.&lt;/li&gt;&#xA;&lt;li&gt;Because requests are usually sent when the phone is &lt;strong&gt;plugged in and idle&lt;/strong&gt;,&#xA;an observer can infer certain device states from traffic patterns. Over time,&#xA;this rhythm reveals aspects of the user’s daily habits.&lt;/li&gt;&#xA;&lt;li&gt;Request size also correlates with movement: the more you travel, the larger&#xA;the batch of location points, and thus the larger the encrypted request.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Overall, Apple’s choice to delay and batch uploads reduces what passive&#xA;observers can infer in real time, but longer-term patterns still leak useful&#xA;information.&lt;/p&gt;&#xA;&lt;h3&gt;Active network observer (e.g. corporate VPN with MITM)&lt;/h3&gt;&#xA;&lt;p&gt;An active network observer, such as a corporate VPN that performs MITM&#xA;decryption, gains visibility comparable to Apple itself while also linking the&#xA;traffic directly to employee identities.&lt;/p&gt;&#xA;&lt;p&gt;The main risk lies in &lt;strong&gt;aggregation&lt;/strong&gt;: routes and app launches recorded at home&#xA;may not be uploaded immediately but instead transmitted hours later during work&#xA;hours when the VPN is active. Combined across multiple employees, this delayed&#xA;reporting can reveal private relationships, conversations, or off-record&#xA;activities.&lt;/p&gt;&#xA;&lt;h3&gt;Governments and Apple&lt;/h3&gt;&#xA;&lt;p&gt;Consider a scenario: after an attack, investigators want to know who was&#xA;present. They could compel Apple to provide all location-service requests from&#xA;the area, along with the source IP addresses. With those, they can also obtain&#xA;authenticated traffic sent from the same IPs, building a list of potential&#xA;suspects.&lt;/p&gt;&#xA;&lt;p&gt;That dataset would contain:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Device metadata from ARPC requests (locale, iOS version, etc.).&lt;/li&gt;&#xA;&lt;li&gt;Routes taken, technically “anonymous,” but timestamped and precise.&lt;/li&gt;&#xA;&lt;li&gt;Lists of apps opened at specific locations.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;By aligning timing between (2) and (3), investigators can link routes to app&#xA;usage. Then, by cross-referencing with the list of installed apps Apple already&#xA;knows per user, they can map (1) to (3) and deanonymize individuals. The&#xA;reconstructed routes can also point to private addresses, workplaces, or&#xA;safehouses.&lt;/p&gt;&#xA;&lt;p&gt;In the hands of an authoritarian state, the same process could be used to&#xA;monitor everyone who attended a protest, then trace each person back to their&#xA;home. Hence the often-heard advice: &lt;em&gt;“Don’t bring your phone to&#xA;demonstrations.”&lt;/em&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;TODO&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Cross service correlation: Other Apple system services, possibly&#xA;authenticated, are sent from the same IP address and may contain information&#xA;that could be matched to the &amp;quot;anonymous&amp;quot; data.&lt;/li&gt;&#xA;&lt;li&gt;App uniqueness: Poll on app-install combinations to demonstrate how uniquely&#xA;idenntifying they are within a given population or IP range.&lt;/li&gt;&#xA;&lt;li&gt;Perspective of a network adversary: How much can an ISP glean from use the&#xA;traffic patterns and sizes. Train a ML model. (DEAD! ML model doesn&#39;t work&#xA;for motion activity due to batching and delays. Instead, we can tell &lt;em&gt;how&#xA;much&lt;/em&gt; a user has moved)&lt;/li&gt;&#xA;&lt;li&gt;Match paths together based on start/end points for a multi-day movement&#xA;report&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2&gt;[WIP] Update patterns of Apple&#39;s location database&lt;/h2&gt;&#xA;&lt;p&gt;Over the course of a week, I recorded &lt;strong&gt;436,771 location changes&lt;/strong&gt; and &lt;strong&gt;10,301&#xA;unique BSSIDs&lt;/strong&gt; across 10 evenly distributed groups of 5 tile keys.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Average distance change:&lt;/strong&gt; 0.69 m&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Minimum distance:&lt;/strong&gt; 0.01 m&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Maximum distance:&lt;/strong&gt; 24.87 m&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Standard deviation:&lt;/strong&gt; 1.01 m&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;img alt=&#34;Average distance moved over time&#34; src=&#34;https://r2.duti.dev/blog/images/distance_changes_plot.png&#34; style=&#34;max-height:30rem;&#34; /&gt;&#xA;&lt;p&gt;At first glance, the average distance and tight standard deviation seem&#xA;artificial. Digging deeper, the update behavior looks even stranger:&lt;/p&gt;&#xA;&lt;img alt=&#34;Distribution of time between updates&#34; src=&#34;https://r2.duti.dev/blog/images/unique_locations_analysis.png&#34; style=&#34;max-height:20rem;&#34;/&gt;&#xA;&lt;p&gt;Most changes involved oscillating between just a handful of unique coordinates&#xA;(typically 1–6 based on the number of days of recorded data), even though some&#xA;access points showed up to 93 separate “update” events. This strongly suggests&#xA;that only &lt;strong&gt;one genuine update occurs per day&lt;/strong&gt;, with locations oscillating&#xA;during the update window rather than reflecting real movement.&lt;/p&gt;&#xA;&lt;img alt=&#34;Distribution of time between updates&#34; src=&#34;https://r2.duti.dev/blog/images/update_intervals_analysis.png&#34; style=&#34;max-height:20rem;&#34;/&gt;&#xA;&lt;p&gt;Every day, there is a consistent 5-hour update window, from &lt;strong&gt;05:00 to 09:00&#xA;UTC&lt;/strong&gt;, during which database entries are refreshed. Each access point is&#xA;guaranteed at least one update every 24 hours, though many are updated multiple&#xA;times within the window. This clustering explains the bursts of short intervals&#xA;seen in the update graphs.&lt;/p&gt;&#xA;&lt;p&gt;Importantly, the update windows are not isolated to specific tiles. Instead,&#xA;updates occur across large numbers of tiles simultaneously, implying that Apple&#xA;maintains a centralized database rather than distributed, region-specific&#xA;updates.&lt;/p&gt;&#xA;</description><pubDate>Mon, 11 May 2026 00:00:00 +0000</pubDate><guid>https://duti.dev/blog/2026/location-services/</guid></item><item><title>Wikimedia attack: 2026-03-05</title><link>https://duti.dev/blog/2026/wikimedia-basemetrika/</link><description>&lt;p&gt;Today, Wikipedia was in read-only mode for a couple of hours due to a security&#xA;incident.&lt;/p&gt;&#xA;&lt;p&gt;Post from WMF staff member on Discord:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Hey all - as some of you have seen, we (WMF) were doing a security review of&#xA;the behavior of user scripts, and unintentionally activated one that turned&#xA;out to be malicious. That is what caused the page deletions you saw on the&#xA;Meta log, which are getting cleaned up. We have no reason to believe any&#xA;third-party entity was actively attacking us today, or that any permanent&#xA;damage occurred or any breach of personal information.&lt;/p&gt;&#xA;&lt;p&gt;We were doing this security review as part of an effort to limit the risks of&#xA;exactly this kind of attack. The irony of us triggering this script while&#xA;doing so is not lost on us, and we are sorry about the disruption. But the&#xA;risks in this system are real. We are going to continue working on security&#xA;protections for user scripts – in close consultation with the community, of&#xA;course – to make this sort of thing much harder to happen in the future.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You can read up on some sources here:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://wikipediocracy.com/forum/viewtopic.php?f=8&amp;amp;t=14555&#34;&gt;https://wikipediocracy.com/forum/viewtopic.php?f=8&amp;amp;t=14555&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://phabricator.wikimedia.org/T419143&#34;&gt;https://phabricator.wikimedia.org/T419143&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://old.reddit.com/r/wikipedia/comments/1rllcdg/megathread_wikimedia_wikis_locked_accounts/&#34;&gt;https://old.reddit.com/r/wikipedia/comments/1rllcdg/megathread_wikimedia_wikis_locked_accounts/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2&gt;What the script did&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Wow. This worm is fascinating. It seems to do the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Inject itself into the MediaWiki:Common.js page to persist globally, and&#xA;into the User:Common.js page to do the same as a fallback&lt;/li&gt;&#xA;&lt;li&gt;Uses jQuery to hide UI elements that would reveal the infection&lt;/li&gt;&#xA;&lt;li&gt;Vandalizes 20 random articles with a 5000px wide image and another XSS&#xA;script from basemetrika.ru&lt;/li&gt;&#xA;&lt;li&gt;If an admin is infected, it will use the Special:Nuke page to delete 3&#xA;random articles from the global namespace, AND use the Special:Random with&#xA;action=delete to delete another 20 random articles&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;EDIT! The Special:Nuke is really weird. It gets a default list of articles to&#xA;nuke from the search field, which could be any group of articles, and&#xA;rubber-stamps nuking them. It does this three times in a row.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Source: &lt;a href=&#34;https://news.ycombinator.com/item?id=47264202&#34;&gt;nhubbard on ycombinator&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For some reason, basemetrika.ru was not a registered domain. I have now&#xA;registered it and thus hopefully nobody else will be able to use it for&#xA;malicious purposes.&lt;/p&gt;&#xA;&lt;p&gt;This was not an active attack but simply a mistake by a wikimedia admin.&lt;/p&gt;&#xA;&lt;p&gt;If the wikimedia foundation would like to take the domain off me, they can&#xA;contact me at &lt;a href=&#34;mailto:acheong@duti.dev&#34;&gt;acheong@duti.dev&lt;/a&gt;.&lt;/p&gt;&#xA;</description><pubDate>Thu, 05 Mar 2026 00:00:00 +0000</pubDate><guid>https://duti.dev/blog/2026/wikimedia-basemetrika/</guid></item><item><title>The temptation of LLMs as slop generators</title><link>https://duti.dev/blog/2025/ai-is-tempting/</link><description>&lt;p&gt;I recently fell down this trap myself. I had an assignment i was rushing, and I&#xA;suck at writing prose (just look at this post...). I decided to simply note down&#xA;everything as bullet points. The thoughts were mine, and did research the&#xA;luddite way of crawling through Google Scholar, Sci-Hub, and random blog posts.&#xA;I liked the output very much - it conveyed all my arguments and had all the&#xA;relevant facts. However, it was a bit disordered and probably didn&#39;t meet the&#xA;mark scheme.&lt;/p&gt;&#xA;&lt;p&gt;So why not put it into an LLM? Surely a language model would be good at language&#xA;and simply transforming text from one form to another. At first glance, it all&#xA;looked fine. I see the stats, I see my citations, and there are now full&#xA;sentences.&lt;/p&gt;&#xA;&lt;p&gt;But actually reading through the text from top to bottom, it was obvious how&#xA;shit it was. Important points were missing, and unimportant points were&#xA;emphasized. The style was disgusting, full of weird em-dash usage and corporate&#xA;speak I&#39;d never use myself. Every time I corrected it, another mistake would&#xA;either pop up elsewhere, or it&#39;d over correct to some hippy-speak. This was not&#xA;a model-specific problem. No matter which model I used: Kimi K2, GPT-5.2, Claude&#xA;Opus 4.5, Deekseek R2, Gemini 3 Flash, none of them could follow my specific&#xA;preferences.&lt;/p&gt;&#xA;&lt;p&gt;$10 and an unreasonable amount of time later, I finally gave up and started&#xA;rewriting from scratch.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Nobody likes to read AI slop, so why do we keep making more of it?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;It&#39;s not about the quality of the content, but the aesthetics of delivery.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Not everyone has English as their first language, and even for native speakers,&#xA;it takes effort to construct prose in a way that flows well and sounds eloquent.&#xA;In academics, despite linguistic skill not necessarily reflecting the quality of&#xA;content, bias easily seeps in based on how things are worded.&lt;/p&gt;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Even in software engineering where our assignments are usually to write code,&#xA;we are assessed on reflective reports and essays where snaky wording can allow&#xA;a team member with 0 commits to still score a 1st.&lt;/li&gt;&#xA;&lt;li&gt;In 2024, during a hackathon by Huawei, the team that placed first in the&#xA;technical round completely fell out of the top 5 simply because English was&#xA;their second language, whereas my team that scored 4th in the technical round&#xA;got bumped up to 2nd due to presentation skills alone.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Especially when the substance is entirely beyond the ability of the assessor to&#xA;comprehend, writing quality becomes the subject of judgment.&lt;/p&gt;&#xA;&lt;p&gt;LLMs provide an easy way out... It is benchmaxxed on a very specific style&#xA;reminiscent of how we were taught to do so in middle and high school English:&#xA;Vary between sentence structures and lengths to avoid sounding repetitive,&#xA;structure content with numbering to make it easy to keep track, and use bigger&#xA;words to sound well educated.&lt;/p&gt;&#xA;&lt;p&gt;However, using LLMs take the soul out of content. It has no understanding of&#xA;what is important, what&#39;s tangential, and happily makes up details not&#xA;specified. It does put intelligent sounding text though, and that&#39;s what the&#xA;vast majority of non-technical people I&#39;ve met actually prefer anyways. Instead&#xA;of reading an email, business report, or anything of substantial length,&#xA;managers, acquaintances, and even family I know would simply dump it into&#xA;ChatGPT or Gemini and read their hallucination-ridden output instead.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, using an LLM is like gambling. Maybe you&#39;ll one-shot it, but&#xA;probably not. Maybe the next try will be the one where it gets everything right.&#xA;The probabilistic nature of LLMs as well as the dopamine hit of feeling like&#xA;you&#39;ve been productive without actually doing anything. &amp;quot;Ah I&#39;ve done what would&#xA;usually take me the whole day to do. I can slack off now&amp;quot; is always at the back&#xA;of my mind. It makes you feel an illusion of productivity and forget that most&#xA;of the time spent writing is actually time spent thinking and refining.&lt;/p&gt;&#xA;&lt;p&gt;Heck, put in &amp;quot;Write an essay on why LLM Slop writing is so tempting&amp;quot; to ChatGPT&#xA;and it writes a better blog than I do with all my points and more.&lt;/p&gt;&#xA;</description><pubDate>Wed, 31 Dec 2025 00:00:00 +0000</pubDate><guid>https://duti.dev/blog/2025/ai-is-tempting/</guid></item><item><title>Failing a Java interview by NOT CONFIGURING NEOVIM CORRECTLY</title><link>https://duti.dev/blog/2025/java-no-sdk/</link><description>&lt;p&gt;So I&#39;m not really a Java programmer, but I can write Java since all university&#xA;coursework pretty much mandates it. But since I haven&#39;t written it in a while, I&#xA;didn&#39;t properly set it up when I rewrote&#xA;&lt;a href=&#34;https://github.com/acheong08/nvim&#34;&gt;my Neovim config&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Q: Why are you applying to a Java position if you&#39;re not a Java programmer?&lt;/p&gt;&#xA;&lt;p&gt;A: Those are the only jobs around...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Before the interview, I set up &lt;code&gt;nvim-java&lt;/code&gt; as usual and tested that it worked&#xA;with a simple Java file, not thinking much of it. Definitions, errors,&#xA;formatting, all working.&lt;/p&gt;&#xA;&lt;p&gt;Then, during the interview, I decided it was probably a good idea to set up a&#xA;proper gradle project with testing and whatnot. But then everything fell apart.&#xA;&lt;code&gt;jdtls&lt;/code&gt; gave me the most random errors such as&#xA;&lt;code&gt;1. String cannot be resolved to a type [16777218]&lt;/code&gt; and&#xA;&lt;code&gt;1. System cannot be resolved [570425394]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I didn&#39;t know how much time it&#39;d take to solve the issue, and obviously spending&#xA;the entire interview debugging a neovim config was a bad idea. The interviewer&#xA;was already annoyed at that point: &amp;quot;You know when you start working a real job,&#xA;you&#39;d need a real IDE.&amp;quot;. I had already uninstalled IntelliJ a couple months back&#xA;after my last Java coursework, and for such a large package, it was gonna take&#xA;forever to download.&lt;/p&gt;&#xA;&lt;p&gt;So VSCode it was.&lt;/p&gt;&#xA;&lt;p&gt;However, the combination of Java, VSCode, and Google Meet caused my CPU to run&#xA;at 100% and crashed my laptop. For the entire rest of the interview, I was&#xA;thermal throttled with a couple seconds latency between a key press and text&#xA;showing up on screen. I ultimately ran out of time by ~5 seconds which&#xA;infuriates me since that is significantly less than the time wasted by&#xA;performance issues.&lt;/p&gt;&#xA;&lt;p&gt;After the interview, I solved the problem in barely 5 minutes. Shorter than the&#xA;amount of time it took to recover from all the crashes.&lt;/p&gt;&#xA;&lt;p&gt;The reason appears to be that &lt;code&gt;nvim-java&lt;/code&gt; defaults to Java 17 found at&#xA;&lt;code&gt;~/.local/share/nvim/nvim-java/packages/openjdk/17/&lt;/code&gt; while Gradle was using&#xA;Java 25. Some weird combination of the configuration made the JDK fail to load.&lt;/p&gt;&#xA;&lt;p&gt;The solution here was really simple:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-lua&#34;&gt;vim.lsp.config(&amp;quot;jdtls&amp;quot;, {&#xA;  settings = {&#xA;    java = {&#xA;      configuration = {&#xA;        runtimes = {&#xA;          {&#xA;            name = &amp;quot;JavaSE-25&amp;quot;,&#xA;            path = &amp;quot;$HOME/.sdkman/candidates/java/current&amp;quot;,&#xA;            default = true,&#xA;          },&#xA;        },&#xA;      },&#xA;    },&#xA;  },&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The correct solution might actually be to just get a better laptop, but&#xA;unfortunately I&#39;m broke. So Neovim it is.&lt;/p&gt;&#xA;</description><pubDate>Tue, 30 Dec 2025 00:00:00 +0000</pubDate><guid>https://duti.dev/blog/2025/java-no-sdk/</guid></item><item><title>Weird Network Reconnects on Arch</title><link>https://duti.dev/blog/2025/arch-wifi-reconnects/</link><description>&lt;pre&gt;&lt;code&gt;Dec 30 05:43:40 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073420.5523] device (duti): Activation: successful, device activated.&#xA;Dec 30 05:43:40 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073420.5683] device (wlan0): supplicant interface state: internal-starting -&amp;gt; disconnected&#xA;Dec 30 05:43:40 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073420.5684] Wi-Fi P2P device controlled by interface wlan0 created&#xA;Dec 30 05:43:40 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073420.5685] manager: (p2p-dev-wlan0): new 802.11 Wi-Fi P2P device (/org/freedesktop/NetworkManager/Devices/146)&#xA;Dec 30 05:43:40 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073420.5686] device (p2p-dev-wlan0): state change: unmanaged -&amp;gt; unavailable (reason &#39;managed&#39;, managed-type: &#39;external&#39;)&#xA;Dec 30 05:43:40 fishy NetworkManager[1364]: &amp;lt;warn&amp;gt;  [1767073420.5686] device (p2p-dev-wlan0): error setting IPv4 forwarding to &#39;0&#39;: Success&#xA;Dec 30 05:43:40 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073420.5689] device (wlan0): state change: unavailable -&amp;gt; disconnected (reason &#39;supplicant-available&#39;, managed-type: &#39;full&#39;)&#xA;Dec 30 05:43:40 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073420.5692] device (p2p-dev-wlan0): state change: unavailable -&amp;gt; disconnected (reason &#39;none&#39;, managed-type: &#39;full&#39;)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0093] policy: auto-activating connection &#39;MyWifi&#39; (134f6382-9241-46b4-90a0-7e052d168eda)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0100] device (wlan0): Activation: starting connection &#39;MyWifi&#39; (134f6382-9241-46b4-90a0-7e052d168eda)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0100] device (wlan0): state change: disconnected -&amp;gt; prepare (reason &#39;none&#39;, managed-type: &#39;full&#39;)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0468] device (wlan0): set-hw-addr: reset MAC address to de:ad:ba:be:ca:fe (preserve)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0509] device (wlan0): state change: prepare -&amp;gt; config (reason &#39;none&#39;, managed-type: &#39;full&#39;)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0512] device (wlan0): Activation: (wifi) access point &#39;MyWifi&#39; has security, but secrets are required.&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0512] device (wlan0): state change: config -&amp;gt; need-auth (reason &#39;none&#39;, managed-type: &#39;full&#39;)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0517] device (wlan0): supplicant interface state: disconnected -&amp;gt; inactive&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0517] device (p2p-dev-wlan0): supplicant management interface state: disconnected -&amp;gt; inactive&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0528] device (wlan0): state change: need-auth -&amp;gt; prepare (reason &#39;none&#39;, managed-type: &#39;full&#39;)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0531] device (wlan0): state change: prepare -&amp;gt; config (reason &#39;none&#39;, managed-type: &#39;full&#39;)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0535] device (wlan0): Activation: (wifi) connection &#39;MyWifi&#39; has security, and secrets exist.  No new secrets needed.&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0541] Config: added &#39;ssid&#39; value &#39;MyWifi&#39;&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0541] Config: added &#39;scan_ssid&#39; value &#39;1&#39;&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0542] Config: added &#39;bgscan&#39; value &#39;simple:30:-70:86400&#39;&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0542] Config: added &#39;key_mgmt&#39; value &#39;WPA-PSK WPA-PSK-SHA256 SAE&#39;&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.0542] Config: added &#39;psk&#39; value &#39;&amp;lt;hidden&amp;gt;&#39;&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.6283] device (wlan0): supplicant interface state: inactive -&amp;gt; authenticating&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.6283] device (p2p-dev-wlan0): supplicant management interface state: inactive -&amp;gt; authenticating&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.6830] device (wlan0): supplicant interface state: authenticating -&amp;gt; associating&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.6831] device (p2p-dev-wlan0): supplicant management interface state: authenticating -&amp;gt; associating&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.7385] device (wlan0): supplicant interface state: associating -&amp;gt; completed&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.7385] device (wlan0): Activation: (wifi) Stage 2 of 5 (Device Configure) successful. Connected to wireless network &amp;quot;MyWifi&amp;quot;&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.7385] device (p2p-dev-wlan0): supplicant management interface state: associating -&amp;gt; completed&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.7398] device (wlan0): state change: config -&amp;gt; ip-config (reason &#39;none&#39;, managed-type: &#39;full&#39;)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.7401] dhcp4 (wlan0): activation: beginning transaction (timeout in 45 seconds)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.7572] dhcp4 (wlan0): state changed new lease, address=192.168.1.104, acd pending&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.9267] dhcp4 (wlan0): state changed new lease, address=192.168.1.104&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.9425] device (wlan0): state change: ip-config -&amp;gt; ip-check (reason &#39;none&#39;, managed-type: &#39;full&#39;)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.9442] device (wlan0): state change: ip-check -&amp;gt; secondaries (reason &#39;none&#39;, managed-type: &#39;full&#39;)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.9444] device (wlan0): state change: secondaries -&amp;gt; activated (reason &#39;none&#39;, managed-type: &#39;full&#39;)&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.9457] device (wlan0): Activation: successful, device activated.&#xA;Dec 30 05:49:06 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073746.6061] audit: op=&amp;quot;connection-update&amp;quot; uuid=&amp;quot;bbc81535-f6e4-341f-92ef-7df37432204b&amp;quot; name=&amp;quot;Wired connection 1&amp;quot; args=&amp;quot;ipv6.addr-gen-mode,ipv6.method,connection.timestamp&amp;quot; pid=14084 uid=1000 result=&amp;quot;success&amp;quot;&#xA;[ 2327.606933] wlan0: RX AssocResp from de:ad:ba:be:ca:fe (capab=0x1411 status=0 aid=4)&#xA;[ 2327.622592] wlan0: associated&#xA;[ 2327.706904] wlan0: Limiting TX power to 35 (35 - 0) dBm as advertised by de:ad:ba:be:ca:fe&#xA;[ 2331.429787] wlan0: deauthenticating from de:ad:ba:be:ca:fe by local choice (Reason: 3=DEAUTH_LEAVING)&#xA;[ 2333.786872] wlan0: authenticate with de:ad:ba:be:ca:fe (local address=de:ad:ba:be:ca:fe)&#xA;[ 2333.787662] wlan0: send auth to de:ad:ba:be:ca:fe (try 1/3)&#xA;[ 2333.821379] wlan0: authenticated&#xA;[ 2333.822532] wlan0: associate with de:ad:ba:be:ca:fe (try 1/3)&#xA;[ 2333.930474] wlan0: associate with de:ad:ba:be:ca:fe (try 2/3)&#xA;[ 2333.944659] wlan0: RX AssocResp from de:ad:ba:be:ca:fe (capab=0x1411 status=0 aid=1)&#xA;[ 2333.957576] wlan0: associated&#xA;[ 2333.957667] wlan0: Limiting TX power to 35 (35 - 0) dBm as advertised by de:ad:ba:be:ca:fe&#xA;[ 2338.461674] wlan0: deauthenticating from de:ad:ba:be:ca:fe by local choice (Reason: 3=DEAUTH_LEAVING)&#xA;[ 2340.751310] wlan0: authenticate with de:ad:ba:be:ca:fe (local address=de:ad:ba:be:ca:fe)&#xA;[ 2340.752571] wlan0: send auth to de:ad:ba:be:ca:fe (try 1/3)&#xA;[ 2340.786019] wlan0: authenticated&#xA;[ 2340.786568] wlan0: associate with de:ad:ba:be:ca:fe (try 1/3)&#xA;[ 2340.800918] wlan0: RX AssocResp from de:ad:ba:be:ca:fe (capab=0x1411 status=0 aid=1)&#xA;[ 2340.838602] wlan0: associated&#xA;[ 2340.838679] wlan0: Limiting TX power to 35 (35 - 0) dBm as advertised by de:ad:ba:be:ca:fe&#xA;[ 2344.497748] wlan0: deauthenticating from de:ad:ba:be:ca:fe by local choice (Reason: 3=DEAUTH_LEAVING)&#xA;[ 2346.767408] wlan0: authenticate with de:ad:ba:be:ca:fe (local address=de:ad:ba:be:ca:fe)&#xA;[ 2346.768118] wlan0: send auth to de:ad:ba:be:ca:fe (try 1/3)&#xA;[ 2346.801876] wlan0: authenticated&#xA;[ 2346.802617] wlan0: associate with de:ad:ba:be:ca:fe (try 1/3)&#xA;[ 2346.813667] wlan0: RX AssocResp from de:ad:ba:be:ca:fe (capab=0x1411 status=0 aid=1)&#xA;[ 2346.825683] wlan0: associated&#xA;[ 2346.855327] wlan0: Limiting TX power to 35 (35 - 0) dBm as advertised by de:ad:ba:be:ca:fe&#xA;[ 2351.528729] wlan0: deauthenticating from de:ad:ba:be:ca:fe by local choice (Reason: 3=DEAUTH_LEAVING)&#xA;[ 2357.303297] wlan0: authenticate with de:ad:ba:be:ca:fe (local address=de:ad:ba:be:ca:fe)&#xA;[ 2357.304282] wlan0: send auth to de:ad:ba:be:ca:fe (try 1/3)&#xA;[ 2357.335522] wlan0: authenticated&#xA;[ 2357.336873] wlan0: associate with de:ad:ba:be:ca:fe (try 1/3)&#xA;[ 2357.344912] wlan0: RX AssocResp from de:ad:ba:be:ca:fe (capab=0x1011 status=0 aid=1)&#xA;[ 2357.358139] wlan0: associated&#xA;[ 2357.412622] wlan0: Limiting TX power to 35 (35 - 0) dBm as advertised by de:ad:ba:be:ca:fe&#xA;Dec 30 05:43:45 fishy NetworkManager[1364]: &amp;lt;info&amp;gt;  [1767073425.9457] device (wlan0): Activation: successful, device activated.&#xA;Dec 30 05:43:49 fishy systemd-networkd[1206]: wlan0: DHCPv4 address 192.168.1.104/24, gateway 192.168.1.1 acquired from 192.168.1.1&#xA;Dec 30 05:43:50 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:43:50 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 172.20.10.5/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:45:11 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:45:11 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 172.20.10.5/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:47:10 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:47:10 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 172.20.10.5/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:48:32 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:48:32 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 172.20.10.5/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:49:06 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:49:06 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 172.20.10.5/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:51:05 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:51:05 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 172.20.10.5/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:52:33 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;Dec 30 05:52:33 fishy tailscaled[1477]: LinkChange: major, rebinding. New state: interfaces.State{defaultRoute=enp0s20f0u1c4i2 ifs={duti:[10.8.0.7/24] enp0s20f0u1c4i2:[172.20.10.2/28 172.20.10.5/28 240e:430:2a11:c5dd:5af6:e64a:6c3d:e896/64 240e:430:2a11:c5dd:b890:47ff:fe0a:8ca8/64 llu6] tailscale0:[100.64.0.8/32 fd7a:115c:a1e0::8/128 llu6] wlan0:[192.168.1.104/24]} v4=true v6=true}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;My internet kept disconnecting and reconnecting in a loop. Only seemed to happen&#xA;on one specific network in China.&lt;/p&gt;&#xA;&lt;p&gt;What ended up being the problem was having both &lt;code&gt;NetworkManager&lt;/code&gt; and&#xA;&lt;code&gt;systemd-networkd&lt;/code&gt; active at the same time. I don&#39;t know why that was the case&#xA;but never had problems before. Probably due to this specific network being&#xA;unstable and thus leading to the race condition.&lt;/p&gt;&#xA;&lt;p&gt;Solution was to simply&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo systemctl disable --now systemd-networkd.service&#xA;sudo systemctl disable --now systemd-resolved.service&#xA;sudo systemctl mask systemd-networkd.service&#xA;sudo systemctl mask systemd-networkd-varlink.socket&#xA;sudo systemctl mask systemd-networkd.socket&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Posting here so the next person that searches these strings from their logs can&#xA;find it.&lt;/p&gt;&#xA;&lt;p&gt;Sometimes, &lt;code&gt;iwd&lt;/code&gt; and &lt;code&gt;wpa_supplicant&lt;/code&gt; are also both active. Just disable &lt;code&gt;iwd&lt;/code&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo pacman -Rcns iwd&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You may need to reboot your laptop and later edit connections using&#xA;&lt;code&gt;nm-connection-editor&lt;/code&gt; to use &lt;code&gt;wlp0s20f3&lt;/code&gt; instead of &lt;code&gt;wlan0&lt;/code&gt;&lt;/p&gt;&#xA;</description><pubDate>Tue, 30 Dec 2025 00:00:00 +0000</pubDate><guid>https://duti.dev/blog/2025/arch-wifi-reconnects/</guid></item><item><title>Snippet: GitHub workflow to sync downstream forks</title><link>https://duti.dev/blog/2025/github-fork/</link><description>&lt;p&gt;Had enough of going through the all the personal forks I have of projects where&#xA;I containerize them and make personal preference changes that will never make it&#xA;into upstream. Here&#39;s a dead simple workflow for rebase and force push.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yml&#34;&gt;name: Sync Fork with Upstream (Force Push)&#xA;&#xA;on:&#xA;  schedule:&#xA;    - cron: &#39;0 1 * * *&#39;&#xA;  workflow_dispatch:&#xA;&#xA;# ============================================&#xA;# CONFIGURATION - Edit these for your fork&#xA;# ============================================&#xA;env:&#xA;  UPSTREAM_REPO: &#39;https://github.com/iv-org/invidious-companion.git&#39;&#xA;  UPSTREAM_BRANCH: &#39;master&#39;&#xA;  FORK_BRANCH: &#39;master&#39;&#xA;# ============================================&#xA;&#xA;jobs:&#xA;  sync:&#xA;    runs-on: ubuntu-latest&#xA;&#xA;    steps:&#xA;      - name: Checkout repository&#xA;        uses: actions/checkout@v4&#xA;        with:&#xA;          ref: ${{ env.FORK_BRANCH }}&#xA;          fetch-depth: 0&#xA;&#xA;      - name: Configure Git identity&#xA;        run: |&#xA;          git config user.email &amp;quot;41898282+github-actions[bot]@users.noreply.github.com&amp;quot;&#xA;          git config user.name &amp;quot;github-actions[bot]&amp;quot;&#xA;&#xA;      - name: Add upstream and fetch&#xA;        run: |&#xA;          git remote add upstream ${{ env.UPSTREAM_REPO }}&#xA;          git fetch upstream&#xA;&#xA;      - name: Rebase fork onto upstream&#xA;        id: rebase&#xA;        run: |&#xA;          git checkout ${{ env.FORK_BRANCH }}&#xA;&#xA;          # Attempt rebase&#xA;          if git rebase upstream/${{ env.UPSTREAM_BRANCH }}; then&#xA;            echo &amp;quot;result=clean&amp;quot; &amp;gt;&amp;gt; $GITHUB_OUTPUT&#xA;          else&#xA;            echo &amp;quot;result=conflict&amp;quot; &amp;gt;&amp;gt; $GITHUB_OUTPUT&#xA;            git rebase --abort || true&#xA;          fi&#xA;&#xA;      - name: Force push if clean&#xA;        if: steps.rebase.outputs.result == &#39;clean&#39;&#xA;        run: |&#xA;          git push --force-with-lease origin HEAD:refs/heads/${{ env.FORK_BRANCH }}&#xA;          echo &amp;quot;Rebase clean — ${{ env.FORK_BRANCH }} updated from upstream/${{ env.UPSTREAM_BRANCH }}.&amp;quot;&#xA;&#xA;      - name: Create or update conflict issue&#xA;        if: steps.rebase.outputs.result == &#39;conflict&#39;&#xA;        uses: peter-evans/create-issue-from-file@v5&#xA;        with:&#xA;          title: &#39;Upstream Sync Conflict&#39;&#xA;          content-filepath: .github/conflict-notice.md&#xA;          labels: upstream-sync, conflict&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You need to create a &lt;code&gt;.github/conflict-notice.md&lt;/code&gt; file with just some&#xA;text/instructions in case rebase fails. It&#39;ll open an issue informing you about&#xA;it.&lt;/p&gt;&#xA;</description><pubDate>Sat, 06 Dec 2025 00:00:00 +0000</pubDate><guid>https://duti.dev/blog/2025/github-fork/</guid></item><item><title>Kuwahara Filter</title><link>https://duti.dev/blog/2025/kuwahara/</link><description>&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;# /// script&#xA;# requires-python = &amp;quot;&amp;gt;=3.12&amp;quot;&#xA;# dependencies = [&#xA;#     &amp;quot;numpy&amp;quot;,&#xA;#     &amp;quot;pillow&amp;quot;,&#xA;#     &amp;quot;pyopencl&amp;quot;,&#xA;# ]&#xA;# ///&#xA;import pyopencl as cl&#xA;import numpy as np&#xA;from PIL import Image&#xA;&#xA;&#xA;def generalized_kuwahara_gpu_opencl(&#xA;    image_path,&#xA;    output_path,&#xA;    kernel_size=8,&#xA;    sharpness=8.0,&#xA;    hardness=8.0,&#xA;    zero_crossing=0.58,&#xA;    zeta=None,&#xA;    passes=1,&#xA;):&#xA;    ctx = cl.create_some_context(False)&#xA;    queue = cl.CommandQueue(ctx)&#xA;&#xA;    img = Image.open(image_path).convert(&amp;quot;RGB&amp;quot;)&#xA;    img_array = np.array(img, dtype=np.float32) / 255.0&#xA;    height, width, _ = img_array.shape&#xA;&#xA;    kernel_radius = kernel_size // 2&#xA;&#xA;    if zeta is None:&#xA;        zeta = np.float32(2.0 / kernel_radius)&#xA;&#xA;    mf = cl.mem_flags&#xA;    img_buf = cl.Buffer(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=img_array)&#xA;    result_buf = cl.Buffer(ctx, mf.READ_WRITE, img_array.nbytes)&#xA;&#xA;    kernel_code = &amp;quot;&amp;quot;&amp;quot;&#xA;    #define PI 3.14159265358979323846f&#xA;    #define clamp(x, low, high) (((x) &amp;lt;= (high)) ? (((x) &amp;gt;= (low)) ? (x) : (low)) : (high))&#xA;&#xA;    __kernel void kuwahara_filter(&#xA;        __global const float *input,&#xA;        __global float *output,&#xA;        const int width,&#xA;        const int height,&#xA;        const int kernel_radius,&#xA;        const float sharpness,&#xA;        const float hardness,&#xA;        const float zero_crossing,&#xA;        const float zeta)&#xA;    {&#xA;        int x = get_global_id(0);&#xA;        int y = get_global_id(1);&#xA;&#xA;        if (x &amp;lt; kernel_radius || x &amp;gt;= width - kernel_radius ||&#xA;            y &amp;lt; kernel_radius || y &amp;gt;= height - kernel_radius) {&#xA;            // Copy border pixels unchanged&#xA;            int idx = (y * width + x) * 3;&#xA;            output[idx] = input[idx];&#xA;            output[idx+1] = input[idx+1];&#xA;            output[idx+2] = input[idx+2];&#xA;            return;&#xA;        }&#xA;&#xA;        float4 m[8];&#xA;        float3 s[8];&#xA;&#xA;        for (int k = 0; k &amp;lt; 8; ++k) {&#xA;            m[k] = (float4)(0.0f);&#xA;            s[k] = (float3)(0.0f);&#xA;        }&#xA;&#xA;        float sin_zero_cross = sin(zero_crossing);&#xA;        float eta = (zeta + cos(zero_crossing)) / (sin_zero_cross * sin_zero_cross);&#xA;&#xA;        for (int ky = -kernel_radius; ky &amp;lt;= kernel_radius; ++ky) {&#xA;            for (int kx = -kernel_radius; kx &amp;lt;= kernel_radius; ++kx) {&#xA;                float2 v = (float2)((float)kx/kernel_radius, (float)ky/kernel_radius);&#xA;&#xA;                // Read pixel with boundary checking&#xA;                int px = clamp(x + kx, 0, width-1);&#xA;                int py = clamp(y + ky, 0, height-1);&#xA;                int pidx = (py * width + px) * 3;&#xA;&#xA;                float3 c = (float3)(&#xA;                    input[pidx],&#xA;                    input[pidx+1],&#xA;                    input[pidx+2]&#xA;                );&#xA;                c = clamp(c, 0.0f, 1.0f);&#xA;&#xA;                float w[8];&#xA;                float sum = 0.0f;&#xA;&#xA;                // Calculate weights&#xA;                float vxx = zeta - eta * v.x * v.x;&#xA;                float vyy = zeta - eta * v.y * v.y;&#xA;&#xA;                w[0] = pow(max(0.0f, v.y + vxx), 2.0f);&#xA;                sum += w[0];&#xA;                w[2] = pow(max(0.0f, -v.x + vyy), 2.0f);&#xA;                sum += w[2];&#xA;                w[4] = pow(max(0.0f, -v.y + vxx), 2.0f);&#xA;                sum += w[4];&#xA;                w[6] = pow(max(0.0f, v.x + vyy), 2.0f);&#xA;                sum += w[6];&#xA;&#xA;                v = (float2)(v.x - v.y, v.x + v.y) * 0.707106781f; // sqrt(2)/2&#xA;                vxx = zeta - eta * v.x * v.x;&#xA;                vyy = zeta - eta * v.y * v.y;&#xA;&#xA;                w[1] = pow(max(0.0f, v.y + vxx), 2.0f);&#xA;                sum += w[1];&#xA;                w[3] = pow(max(0.0f, -v.x + vyy), 2.0f);&#xA;                sum += w[3];&#xA;                w[5] = pow(max(0.0f, -v.y + vxx), 2.0f);&#xA;                sum += w[5];&#xA;                w[7] = pow(max(0.0f, v.x + vyy), 2.0f);&#xA;                sum += w[7];&#xA;&#xA;                float g = exp(-3.125f * dot(v,v)) / sum;&#xA;&#xA;                for (int k = 0; k &amp;lt; 8; ++k) {&#xA;                    float wk = w[k] * g;&#xA;                    m[k].xyz += c * wk;&#xA;                    m[k].w += wk;&#xA;                    s[k] += c * c * wk;&#xA;                }&#xA;            }&#xA;        }&#xA;&#xA;        float4 output_pixel = (float4)(0.0f);&#xA;&#xA;        for (int k = 0; k &amp;lt; 8; ++k) {&#xA;            if (m[k].w &amp;gt; 0.0f) {&#xA;                float3 mean = m[k].xyz / m[k].w;&#xA;                float3 variance = fabs(s[k] / m[k].w - mean * mean);&#xA;                float sigma2 = variance.x + variance.y + variance.z;&#xA;                float wk = 1.0f / (1.0f + pow(hardness * 1000.0f * sigma2, 0.5f * sharpness));&#xA;&#xA;                output_pixel.xyz += mean * wk;&#xA;                output_pixel.w += wk;&#xA;            }&#xA;        }&#xA;&#xA;        int idx = (y * width + x) * 3;&#xA;        if (output_pixel.w &amp;gt; 0.0f) {&#xA;            float3 result = clamp(output_pixel.xyz / output_pixel.w, 0.0f, 1.0f);&#xA;            output[idx] = result.x;&#xA;            output[idx+1] = result.y;&#xA;            output[idx+2] = result.z;&#xA;        } else {&#xA;            output[idx] = input[idx];&#xA;            output[idx+1] = input[idx+1];&#xA;            output[idx+2] = input[idx+2];&#xA;        }&#xA;    }&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;&#xA;    prg = cl.Program(ctx, kernel_code).build()&#xA;&#xA;    # Set work group size (important for avoiding artifacts)&#xA;    local_size = (16, 16)&#xA;    global_size = (&#xA;        ((width + local_size[0] - 1) // local_size[0]) * local_size[0],&#xA;        ((height + local_size[1] - 1) // local_size[1]) * local_size[1],&#xA;    )&#xA;&#xA;    # Run kernel for each pass&#xA;    for _ in range(passes):&#xA;        prg.kuwahara_filter(&#xA;            queue,&#xA;            global_size,&#xA;            local_size,&#xA;            img_buf,&#xA;            result_buf,&#xA;            np.int32(width),&#xA;            np.int32(height),&#xA;            np.int32(kernel_radius),&#xA;            np.float32(sharpness),&#xA;            np.float32(hardness),&#xA;            np.float32(zero_crossing),&#xA;            np.float32(zeta),&#xA;        )&#xA;        # Swap buffers for next pass&#xA;        img_buf, result_buf = result_buf, img_buf&#xA;&#xA;    result = np.empty_like(img_array)&#xA;    cl.enqueue_copy(queue, result, img_buf)&#xA;&#xA;    output_array = (np.clip(result, 0, 1) * 255).astype(np.uint8)&#xA;    Image.fromarray(output_array).save(output_path)&#xA;&#xA;&#xA;if __name__ == &amp;quot;__main__&amp;quot;:&#xA;    generalized_kuwahara_gpu_opencl(&#xA;        &amp;quot;input.jpg&amp;quot;,&#xA;        &amp;quot;output.jpg&amp;quot;,&#xA;        kernel_size=15,&#xA;        sharpness=8.0,&#xA;        hardness=8.0,&#xA;        zero_crossing=0.58,&#xA;        passes=1,&#xA;    )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Derived from &lt;a href=&#34;https://github.com/GarrettGunnell/Post-Processing/&#34;&gt;https://github.com/GarrettGunnell/Post-Processing/&lt;/a&gt;&lt;/p&gt;&#xA;</description><pubDate>Mon, 09 Jun 2025 00:00:00 +0000</pubDate><guid>https://duti.dev/blog/2025/kuwahara/</guid></item><item><title>On Kubernetes and some footguns</title><link>https://duti.dev/blog/2025/k3s/</link><description>&lt;p&gt;I&#39;ve been running my own Kubernetes cluster for a few weeks now and thought I&#39;d&#xA;document my thoughts and things I ran into.&lt;/p&gt;&#xA;&lt;h2&gt;Premise&lt;/h2&gt;&#xA;&lt;p&gt;I self host pretty much every service I use - email, calendar, password manager,&#xA;matrix, etc. Hosting is expensive, so my approach has been to have everything&#xA;running on Raspberry Pis, spare laptops, and jailbroken Kindles with a few tiny&#xA;rented servers for ingress.&lt;/p&gt;&#xA;&lt;img src=&#34;https://r2.duti.dev/blog/images/self-hosting-architecture.svg&#34; width=&#34;500&#34;&gt;&#xA;&lt;p&gt;One major flaw of this approach is data loss. Many of the devices are simply not&#xA;reliable and sometimes sitting halfway around the world in my grandparent&#39;s&#xA;house. If it crashes, there is simply no way to recover anything. This happened&#xA;multiple times and caused me to lose my Vaultwarden instance along with all my&#xA;passwords. Thankfully they were cached in my browser but it could&#39;ve been a huge&#xA;disaster. I also host an &lt;a href=&#34;https://iv.duti.dev&#34;&gt;invidious instance&lt;/a&gt; with a couple&#xA;hundred daily users for which I need to set up load balancing to handle the&#xA;bandwidth and avoid IP bans.&lt;/p&gt;&#xA;&lt;p&gt;I at first tried writing my own Kubernetes-esq software that imitated fly.io&#39;s&#xA;CLI and parsed a subset of docker-compose.yml to spawn podman containers, made a&#xA;badly written nameserver, and used Caddy&#39;s API to handle proxying/TLS. To avoid&#xA;data loss, all volumes were periodically exported and saved on a specific server&#xA;since all the others simply didn&#39;t have enough storage - actually restoring from&#xA;backups was never implemented. Overall, it was a horrid mess full of hacks&#xA;specific to my setup.&lt;/p&gt;&#xA;&lt;p&gt;While looking into distributed storage, I found &lt;a href=&#34;https://longhorn.io/&#34;&gt;longhorn&lt;/a&gt;&#xA;which solved just about everything I wanted. I had been holding off on learning&#xA;Kubernetes due to the perceived difficulty, but considering the amount of effort&#xA;it took just to &lt;em&gt;not&lt;/em&gt; use it, might as well.&lt;/p&gt;&#xA;&lt;p&gt;I was initially considering &lt;a href=&#34;https://github.com/canonical/microk8s&#34;&gt;microk8s&lt;/a&gt;&#xA;since it offered a collection of common addons which I wouldn&#39;t have to deal&#xA;with myself. However, it is extremely tied to snaps and contains hard coded&#xA;paths that simply forces it to not work outside of snaps. I absolutely detest&#xA;snaps - they&#39;re slow to start, take too much RAM and disk, automatically updates&#xA;without permission, and is proprietary to Canonical, essentially the Microsoft&#xA;of Linux.&lt;/p&gt;&#xA;&lt;p&gt;So &lt;a href=&#34;https://k3s.io&#34;&gt;k3s&lt;/a&gt; it is - A single static binary, supposedly lightweight,&#xA;and written in Golang, which is always a plus since I can dig into the code and&#xA;contribute if necessary. Before even getting started, I tried migrating the&#xA;UrfaveCLI dependency to v3 and support fish completion to get a feel for the&#xA;codebase. Due to heavy integration with containerd which still relies on v2, it&#xA;wasn&#39;t possible - but overall I liked how the code was structured.&lt;/p&gt;&#xA;&lt;h2&gt;Footguns&lt;/h2&gt;&#xA;&lt;h3&gt;&lt;a href=&#34;https://github.com/k3s-io/k3s/discussions/2997&#34;&gt;k3s does not forward the real client IP&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;This means that if you try to use something like crowdsec or fail2ban for rate&#xA;limiting, it will ban the internal IP of traefik and block all traffic.&lt;/p&gt;&#xA;&lt;img src=&#34;https://r2.duti.dev/blog/images/servicelb.svg&#34; width=&#34;500&#34;&gt;&#xA;&lt;p&gt;In kubernetes, a load balancer pod is tied to only a single node, which may or&#xA;may not be the one actually taking in traffic. When any traffic reaches a node,&#xA;it is passed through servicelb to reach the one actually hosting the ingress&#xA;controller, and by doing so, masks the originating IP.&lt;/p&gt;&#xA;&lt;p&gt;It&#39;s not possible to determine the assigned external IP and ensure the load&#xA;balancer deployment is deployed onto the same node. Instead, you must set the&#xA;deployment as &lt;code&gt;DaemonSet&lt;/code&gt; and use &lt;code&gt;nodeSelector&lt;/code&gt; to create replicas on every&#xA;node with an external IP given to metallb. For the load balancer service, also&#xA;ensure &lt;code&gt;externalTrafficPolicy: Local&lt;/code&gt; and disable servicelb by adding&#xA;&lt;code&gt;--disable servicelb&lt;/code&gt; to the k3s service.&#xA;&lt;a href=&#34;https://github.com/acheong08/kube/blob/049cc651496bed27b2f95d1ae0e575d016b1a7b2/ingress/traefik-values.yaml&#34;&gt;Here&lt;/a&gt;&#xA;is the values I use for traefik as an example.&lt;/p&gt;&#xA;&lt;h3&gt;&lt;a href=&#34;https://github.com/longhorn/longhorn/issues/7116&#34;&gt;Longhorn: failed to connect to unix://csi/csi.sock&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;There are multiple reasons this might occur, some of which are well documented.&#xA;e.g. iscsi-initiator-utils or open-iscsi needs to be installed.&lt;/p&gt;&#xA;&lt;p&gt;However, there are also really obscure and misleading reasons - in my case, a&#xA;failing tailscale route. If you have nodes behind a NAT, k3s offers tailscale&#xA;integration - which I use with my own headscale instance. At first, I manually&#xA;approved every route via the UI but they seem to be reissued every time k3s&#xA;restarts, causing the csi error despite having nothing to do with unix sockets.&lt;/p&gt;&#xA;&lt;p&gt;The solution was to use acls to auto approve these routes. Keep in mind that&#xA;with headscale you need to manually tag the nodes with&#xA;&lt;code&gt;headscale nodes tag -i &amp;lt;ID&amp;gt; -t tag:cluster&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-json&#34;&gt;{&#xA;  &amp;quot;tagOwners&amp;quot;: {&#xA;    &amp;quot;tag:cluster&amp;quot;: [&amp;quot;autogroup:admin&amp;quot;],&#xA;    &amp;quot;tag:ci&amp;quot;: [&amp;quot;autogroup:admin&amp;quot;]&#xA;  },&#xA;  &amp;quot;autoApprovers&amp;quot;: {&#xA;    &amp;quot;routes&amp;quot;: {&#xA;      &amp;quot;10.42.0.0/16&amp;quot;: [&amp;quot;tag:cluster&amp;quot;]&#xA;    }&#xA;  },&#xA;  &amp;quot;acls&amp;quot;: [&#xA;    {&#xA;      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&#xA;      &amp;quot;src&amp;quot;: [&amp;quot;tag:owner&amp;quot;, &amp;quot;0.0.0.0&amp;quot;],&#xA;      &amp;quot;dst&amp;quot;: [&amp;quot;*:*&amp;quot;]&#xA;    },&#xA;    {&#xA;      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&#xA;      &amp;quot;src&amp;quot;: [&amp;quot;tag:cluster&amp;quot;, &amp;quot;10.42.0.0/16&amp;quot;],&#xA;      &amp;quot;dst&amp;quot;: [&amp;quot;tag:cluster:*&amp;quot;, &amp;quot;10.42.0.0/16:*&amp;quot;]&#xA;    }&#xA;  ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yml&#34;&gt;# /etc/headscale/config.yaml&#xA;policy:&#xA;  mode: file&#xA;  path: &#39;/etc/headscale/acl.json&#39;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3&gt;Resource consumption&lt;/h3&gt;&#xA;&lt;p&gt;k3s with a single master node takes up around 1GB of memory by itself while the&#xA;agent takes up around 200MB, not very lightweight at all. Longhorn takes a&#xA;further 500MB per node. Overall, you want at least 2GB of memory in the most&#xA;optimistic scenario, even for agents. With multiple master nodes, etcd takes up&#xA;significantly more memory, especially on secondary master nodes. Even more&#xA;damaging is that a single unhealthy master node will cause other master nodes to&#xA;go offline, possibly due to failed elections and increased load. Unless you have&#xA;at least 4GB of RAM on each master node, I would not recommend having more than&#xA;one master node. If using crowdsec, make sure to disable the dashboard. Metabase&#xA;(java) will take up 1GB of RAM even if left unused.&lt;/p&gt;&#xA;&lt;h3&gt;Tailscale causes a complete disconnect on OpenStack&lt;/h3&gt;&#xA;&lt;p&gt;In specific setups on OpenStack, starting &lt;code&gt;k3s-agent&lt;/code&gt; will immediately cause you&#xA;to lose ssh access and brick the instance. To recover, reboot the machine and&#xA;ensure /etc/resolv.conf is properly set. Then prevent tailscale from taking over&#xA;DNS by running &lt;code&gt;sudo tailscale set --accept-dns=false&lt;/code&gt; and restarting&#xA;tailscaled.&lt;/p&gt;&#xA;&lt;h3&gt;Crowdsec fails to make any decision&lt;/h3&gt;&#xA;&lt;p&gt;I assume you followed the example from&#xA;&lt;a href=&#34;https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/tree/78869ecf776c5932888c6bf93e07150fa4e32642/examples/kubernetes&#34;&gt;crowdsec-bouncer-traefik-plugin&lt;/a&gt;.&#xA;Traefik no longer defaults to JSON logs, set&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;logs:&#xA;  access:&#xA;    enabled: true&#xA;    format: json&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;in &lt;code&gt;traefik-values.yaml&lt;/code&gt;.&lt;/p&gt;&#xA;</description><pubDate>Mon, 05 May 2025 00:00:00 +0000</pubDate><guid>https://duti.dev/blog/2025/k3s/</guid></item></channel></rss>