<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Emir Mrkaljević</title>
    <description>The latest articles on DEV Community by Emir Mrkaljević (@emirmrkaljevic).</description>
    <link>https://dev.to/emirmrkaljevic</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4173741%2Fc4a83360-e88a-4eb8-a467-c3df03f8af7d.png</url>
      <title>DEV Community: Emir Mrkaljević</title>
      <link>https://dev.to/emirmrkaljevic</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/emirmrkaljevic"/>
    <language>en</language>
    <item>
      <title>Hackaday wrote about my STL to CAD tool, and the first bug report it brought was a good one</title>
      <dc:creator>Emir Mrkaljević</dc:creator>
      <pubDate>Fri, 20 Nov 2026 07:56:36 +0000</pubDate>
      <link>https://dev.to/emirmrkaljevic/hackaday-wrote-about-my-stl-to-cad-tool-and-the-first-bug-report-it-brought-was-a-good-one-271j</link>
      <guid>https://dev.to/emirmrkaljevic/hackaday-wrote-about-my-stl-to-cad-tool-and-the-first-bug-report-it-brought-was-a-good-one-271j</guid>
      <description>&lt;p&gt;This week Hackaday ran a short piece on mesh2cad, my open source tool that turns an STL of a simple mechanical part into STEP or an editable CadQuery, OpenSCAD or FreeCAD script: &lt;a href="https://hackaday.com/2026/11/19/mesh2cad-automates-re-modelling/" rel="noopener noreferrer"&gt;https://hackaday.com/2026/11/19/mesh2cad-automates-re-modelling/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The repo went from 14 to around 80 stars in a day, which is more than the previous month. More useful than the stars was the first proper bug report from someone I don't know.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the report found
&lt;/h2&gt;

&lt;p&gt;The reporter converted a noisy test plate (80 x 50 x 6 mm, four holes) and opened the STEP with OCP instead of trusting the exit code. The solid was inside-out. Negative volume, written with exit 0. On another seed the solid was valid but about 6 mm away from the mesh.&lt;/p&gt;

&lt;p&gt;The cause was in the fallback path. When a least squares snap moved a vertex too far, the code projected that vertex onto the first fitted surface instead, with no distance check. On a thin plate the first surface was sometimes the opposite wall, so the top face got pulled down by the plate thickness.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changed in 0.32.0
&lt;/h2&gt;

&lt;p&gt;The projection is now guarded too: if it moves the vertex more than the snap limit, the original vertex stays. Then, before anything is written, the writer checks the signed volume. A reversed solid gets flipped. A snapped hybrid whose volume misses the mesh by more than 5%, or that sits too far from the mesh, is dropped and the plain faceted solid is written instead. An inside-out solid is never written.&lt;/p&gt;

&lt;p&gt;The report also said one of the Original Prusa i3 parts came back faceted on 0.31.0. I could not reproduce that: on 0.22.0 and 0.32.0 it is exact (210 planes, 4 cylinders), and the sewing code did not change in between. I added a slow test that locks the face counts of all six Prusa parts, and asked for the reporter's OCP version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits, same as before
&lt;/h2&gt;

&lt;p&gt;mesh2cad is for brackets, plates and similar parts made of planes, cylinders and cones. Organic shapes, figurines and scans with heavy noise still come out faceted or are refused. That is on purpose: I would rather it say no than write a wrong solid, and this bug was exactly the case where it did not say no.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install -U mesh2cad
mesh2cad convert part.stl part.step
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/emirmrkaljevic/mesh2cad" rel="noopener noreferrer"&gt;https://github.com/emirmrkaljevic/mesh2cad&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have an STL that converts badly, an issue with the file attached helps more than anything else.&lt;/p&gt;

</description>
      <category>3dprinting</category>
      <category>cad</category>
      <category>python</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Find which domains in a list run Shopify (Python, no paid API)</title>
      <dc:creator>Emir Mrkaljević</dc:creator>
      <pubDate>Thu, 19 Nov 2026 09:04:28 +0000</pubDate>
      <link>https://dev.to/emirmrkaljevic/find-which-domains-in-a-list-run-shopify-python-no-paid-api-472p</link>
      <guid>https://dev.to/emirmrkaljevic/find-which-domains-in-a-list-run-shopify-python-no-paid-api-472p</guid>
      <description>&lt;p&gt;I often get a list of domains from a CRM export or a trade show list and need to know one thing first: which of these sites run on Shopify? Shopify app developers, theme agencies and ecommerce consultants all start from that question.&lt;/p&gt;

&lt;p&gt;You do not need a paid lookup service for a few hundred domains. A Shopify storefront leaves very clear fingerprints in its homepage, and a short Python script can check them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What gives a Shopify store away
&lt;/h2&gt;

&lt;p&gt;When you load the homepage of a Shopify store, you usually see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a &lt;code&gt;powered-by: Shopify&lt;/code&gt; response header&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;_shopify_y&lt;/code&gt; / &lt;code&gt;_shopify_s&lt;/code&gt; cookies&lt;/li&gt;
&lt;li&gt;assets loaded from &lt;code&gt;cdn.shopify.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;a global JavaScript object, &lt;code&gt;window.Shopify&lt;/code&gt; and &lt;code&gt;Shopify.theme&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;the store's permanent &lt;code&gt;something.myshopify.com&lt;/code&gt; domain somewhere in the source&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Any one of these is a strong signal. Seeing several at once is close to certain. The &lt;code&gt;myshopify.com&lt;/code&gt; domain is also handy later, because it keeps working even when the custom domain changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The script
&lt;/h2&gt;

&lt;p&gt;It reads a text file with one domain per line (full URLs are fine), checks the homepages in parallel and writes a CSV to stdout. The only dependency is &lt;code&gt;requests&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;concurrent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;futures&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;ThreadPoolExecutor&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="no"&gt;HEADERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"User-Agent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Mozilla/5.0 (compatible; shopify-check/1.0)"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Signals that only a Shopify storefront sends&lt;/span&gt;
&lt;span class="no"&gt;HTML_SIGNALS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"cdn\.shopify\.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"Shopify\.theme"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"window\.Shopify"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"myshopify\.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;clean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;domain&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;domain&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"^https?://"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;check&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"domain"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"shopify"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"evidence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"myshopify"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"https://{domain}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;HEADERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;RequestException&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;

    &lt;span class="n"&gt;evidence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="c1"&gt;# 1. Response headers (most stores send some of these)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"x-shopid"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"x-shopify-stage"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"powered-by"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"powered-by"&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="s2"&gt;"shopify"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"header:{h}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;"_shopify_y"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"set-cookie"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="s2"&gt;"_shopify_s"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"set-cookie"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"cookie:_shopify"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# 2. HTML fingerprints&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;pattern&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;HTML_SIGNALS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"html:{pattern.replace(chr(92), '')}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# 3. The permanent myshopify.com domain is often in the page source&lt;/span&gt;
    &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"([a-z0-9-]+\.myshopify\.com)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"myshopify"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;group&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"shopify"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"evidence"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;";"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;domains&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;clean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;ThreadPoolExecutor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_workers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;check&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;domains&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;writer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DictWriter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fieldnames&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;writer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeheader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;writer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writerows&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install requests
python find_shopify.py domains.txt &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; shopify.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Output
&lt;/h2&gt;

&lt;p&gt;This is a real run on a small test list:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;domain,shopify,evidence,myshopify,error
gymshark.com,True,header:powered-by;html:cdn.shopify.com;html:Shopify.theme;html:window.Shopify;html:myshopify.com,gymsharkusa.myshopify.com,
kyliecosmetics.com,True,header:powered-by;html:cdn.shopify.com;html:Shopify.theme;html:window.Shopify;html:myshopify.com,kylie-jenner-us.myshopify.com,
nalgene.com,False,,,
not-a-real-domain-xyz123.com,False,,,SSLError
python.org,False,,,
wikipedia.org,False,,,
www.allbirds.com,True,header:powered-by;html:cdn.shopify.com;html:Shopify.theme;html:window.Shopify;html:myshopify.com,weareallbirds.myshopify.com,
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;evidence&lt;/code&gt; column matters. When someone asks "why is this one marked as Shopify?", you can point to exactly what was found instead of trusting a black box.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things to watch out for
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Keep the error column.&lt;/strong&gt; A domain that times out or has a broken certificate is "unknown", not "not Shopify". Retry those later instead of dropping them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Headless stores.&lt;/strong&gt; Some big brands use Shopify only as a backend (Hydrogen or a custom frontend). Their homepage may show none of the classic signals. A follow-up check of &lt;code&gt;https://domain/products.json&lt;/code&gt; often still answers for those.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bot protection.&lt;/strong&gt; A few stores sit behind Cloudflare challenges and return a challenge page. Low concurrency and a normal user agent help, but you will not get 100% this way.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Be polite.&lt;/strong&gt; One request per domain, a few workers, and no hammering. That is enough for this job.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Next step: the products
&lt;/h2&gt;

&lt;p&gt;Once you know which domains are Shopify, most Shopify stores expose a public &lt;code&gt;/products.json&lt;/code&gt; feed with titles, prices, variants and stock flags, so you can go from "list of domains" to "list of products" with one more script.&lt;/p&gt;

&lt;h2&gt;
  
  
  When the list gets big
&lt;/h2&gt;

&lt;p&gt;For a few hundred domains the script above is all you need. If you want to check other platforms too (WooCommerce, HubSpot, Klaviyo and thousands more) or run it on a schedule without keeping a machine on, I built a hosted version on Apify: &lt;a href="https://apify.com/tinyrex/tech-stack-detector" rel="noopener noreferrer"&gt;Bulk Tech Stack Detector&lt;/a&gt; takes a domain list plus an &lt;code&gt;onlyIfUses: ["Shopify"]&lt;/code&gt; filter and saves only the matching domains, and &lt;a href="https://apify.com/tinyrex/shopify-products-scraper" rel="noopener noreferrer"&gt;Shopify Products Scraper&lt;/a&gt; exports the catalogs of those stores. Unreachable domains are not charged.&lt;/p&gt;

&lt;p&gt;Disclosure: I built and maintain both of these Apify actors.&lt;/p&gt;

</description>
      <category>python</category>
      <category>shopify</category>
      <category>webscraping</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How I export WooCommerce sale products and keep only the 20%+ discounts</title>
      <dc:creator>Emir Mrkaljević</dc:creator>
      <pubDate>Thu, 12 Nov 2026 09:02:56 +0000</pubDate>
      <link>https://dev.to/emirmrkaljevic/how-i-export-woocommerce-sale-products-and-keep-only-the-20-discounts-ald</link>
      <guid>https://dev.to/emirmrkaljevic/how-i-export-woocommerce-sale-products-and-keep-only-the-20-discounts-ald</guid>
      <description>&lt;p&gt;I sometimes need a spreadsheet of what a WooCommerce store actually has on sale, not the full catalog. A "sale" badge is not enough: I want a minimum discount, variation prices and stock in the same table, and I want products that miss the cut to cost me nothing.&lt;/p&gt;

&lt;p&gt;WooCommerce exposes a public Store API on most shops (no admin login), so you can do the basic version yourself in about 40 lines of Python. Further down I show the hosted version I use for bigger jobs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Doing it yourself with the Store API
&lt;/h2&gt;

&lt;p&gt;The endpoint is &lt;code&gt;/wp-json/wc/store/v1/products&lt;/code&gt;. It is paginated (&lt;code&gt;X-WP-TotalPages&lt;/code&gt; header), accepts &lt;code&gt;on_sale=true&lt;/code&gt;, and returns prices as integer strings in minor units (so &lt;code&gt;1699&lt;/code&gt; with &lt;code&gt;currency_minor_unit: 2&lt;/code&gt; means 16.99). This script pulls every on-sale product, computes the discount from regular vs sale price, keeps 20%+ and writes a CSV:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="no"&gt;STORE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="s2"&gt;"https://nalgene.com"&lt;/span&gt;
&lt;span class="no"&gt;MIN_DISCOUNT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;  &lt;span class="c1"&gt;# percent&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;products&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;per_page&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{store}/wp-json/wc/store/v1/products"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                         &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"per_page"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;per_page&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"page"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"on_sale"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"true"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                         &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"User-Agent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"sale-filter-demo/1.0"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raise_for_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;batch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;batch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;batch&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"X-WP-TotalPages"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;products&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;STORE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;pr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"prices"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;unit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;pr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"currency_minor_unit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;regular&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sale&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"regular_price"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;unit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"sale_price"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;unit&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;regular&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;sale&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;regular&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;continue&lt;/span&gt;
    &lt;span class="n"&gt;discount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regular&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;sale&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;regular&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;discount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="no"&gt;MIN_DISCOUNT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"regular"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;regular&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"sale"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sale&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                     &lt;span class="s2"&gt;"discount_pct"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;discount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"currency"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"currency_code"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                     &lt;span class="s2"&gt;"in_stock"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"is_in_stock"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"permalink"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"discount_pct"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"sale.csv"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"w"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newline&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DictWriter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fieldnames&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"regular"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"sale"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"discount_pct"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"currency"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"in_stock"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeheader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writerows&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{len(rows)} products at {MIN_DISCOUNT}%+ off -&amp;gt; sale.csv"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s1"&gt;'{r["discount_pct"]:&amp;gt;3}%  {r["sale"]:&amp;gt;7.2f} (was {r["regular"]:.2f})  {r["title"]}'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it with &lt;code&gt;pip install requests&lt;/code&gt; and &lt;code&gt;python sale_filter.py https://nalgene.com&lt;/code&gt;. When I ran it, it printed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;9 products at 20%+ off -&amp;gt; sale.csv
 64%     5.00 (was 13.99)  24oz Neoprene Sleeve
 62%     5.00 (was 13.26)  24oz Gray Neoprene Sleeve
 35%    10.99 (was 16.99)  12oz Kids On-The-Fly Lock-Top Bottle
 35%    10.99 (was 16.99)  12oz Kids Grip-N-Gulp Sustain Water Bottle
 35%    10.99 (was 16.99)  12oz On-The-Fly Kids Lock-Top Bottle with Graphics
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Caveats: variable products report the cheapest variation in &lt;code&gt;prices&lt;/code&gt;, so per-size or per-color discounts need a request per variation. Some stores disable the Store API or rate-limit it (HTTP 429), and a few put it behind a different path. Be polite: keep &lt;code&gt;per_page&lt;/code&gt; reasonable, do not hammer the shop, and check &lt;code&gt;robots.txt&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The hosted version
&lt;/h2&gt;

&lt;p&gt;I got tired of stitching pages, sale flags and variation requests by hand, so I use an &lt;a href="https://apify.com/tinyrex/woocommerce-products-scraper" rel="noopener noreferrer"&gt;Apify Actor&lt;/a&gt; I maintain (TinyRex). It reads that same Store API, respects &lt;code&gt;robots.txt&lt;/code&gt;, and writes one row per product (or one row per variation) that you can download as CSV, Excel or JSON.&lt;/p&gt;

&lt;h2&gt;
  
  
  The input I use
&lt;/h2&gt;

&lt;p&gt;A single store, only products whose discount is at least 20%, cap at 25 rows so the run stays short, no variation details on the first pass:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"stores"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"https://nalgene.com"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"maxProductsPerStore"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"outputMode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"products"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"minDiscountPercent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"includeVariations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"descriptionFormat"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"none"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;minDiscountPercent&lt;/code&gt; uses regular price vs sale price. Set it to &lt;code&gt;0&lt;/code&gt; (or omit it) to turn the cut off. If I only care that something is on sale at all, I use &lt;code&gt;"onlyOnSale": true&lt;/code&gt; instead. Products below the cut, products with no discount, and sites that are not WooCommerce or that block the API are not charged.&lt;/p&gt;

&lt;p&gt;Other filters I reach for on bigger catalogs: &lt;code&gt;search&lt;/code&gt; (the store's own product search), &lt;code&gt;keywords&lt;/code&gt; / &lt;code&gt;excludeKeywords&lt;/code&gt;, &lt;code&gt;categories&lt;/code&gt;, &lt;code&gt;brands&lt;/code&gt;, &lt;code&gt;minPrice&lt;/code&gt; / &lt;code&gt;maxPrice&lt;/code&gt;, and &lt;code&gt;onlyInStock&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a row looks like
&lt;/h2&gt;

&lt;p&gt;A saved product looks like this (fields trimmed). This one is a real row from a short test on nalgene.com:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"storeUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://nalgene.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"storeName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Nalgene"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"12oz Kids On-The-Fly Lock-Top Bottle"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"price"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;10.99&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"regularPrice"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;16.99&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"salePrice"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;10.99&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"onSale"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"discountPercent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;35&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"currency"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"USD"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"inStock"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://nalgene.com/product/12oz-kids-on-the-fly-lock-top-bottle/"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a run I download the dataset as CSV or JSON, or send it to Sheets, n8n or a webhook. A STORES report and a SUMMARY record tell me how many products were found, how many passed the filters, and how many were saved.&lt;/p&gt;

&lt;p&gt;On that same short test I set the cut at 10% and the cap at 5. The run looked at 46 products from nalgene.com, saved 5 sale items (discounts from 24% to 62%), finished in about 20 seconds and cost a fraction of a cent. The cap stopped the run after five matches, so 5 of 46 is not "only five products were on sale."&lt;/p&gt;

&lt;h2&gt;
  
  
  Filters and monitoring I actually use
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Minimum discount %:&lt;/strong&gt; keep 20% or 30% off, drop the 5% "sale" stickers. Below the cut is free.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Only in stock:&lt;/strong&gt; useful when I am building a buy list, not a historical catalog.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One row per variation:&lt;/strong&gt; set &lt;code&gt;"outputMode": "variants"&lt;/code&gt; when I need size or color prices in a spreadsheet. Variation details do not add a second charge in product mode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring:&lt;/strong&gt; &lt;code&gt;"monitorMode": "changes"&lt;/code&gt; on a daily schedule returns new products plus price or stock changes, with the previous values. The first run is the baseline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Several stores:&lt;/strong&gt; paste a list of shop domains in &lt;code&gt;stores&lt;/code&gt;. Non-WooCommerce sites are reported as &lt;code&gt;not_woocommerce&lt;/code&gt; and are free.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pricing is $0.60 per 1,000 products saved (per variation row in variation mode). Filtered, blocked and non-WooCommerce inputs are free. If a store rate-limits you (HTTP 429), turn on a proxy or lower &lt;code&gt;maxConcurrency&lt;/code&gt; and try again; a blocked run is not charged for products it did not save.&lt;/p&gt;

&lt;p&gt;If you want the longer walkthrough (category URLs, variation mode, and how the Store API is discovered), I wrote it here: &lt;a href="https://emirmrkaljevic.github.io/tinyrex-data-tools/export-woocommerce-store-products-to-csv/" rel="noopener noreferrer"&gt;How to export products from any WooCommerce store to CSV or JSON&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The actor is here: &lt;a href="https://apify.com/tinyrex/woocommerce-products-scraper" rel="noopener noreferrer"&gt;WooCommerce Products Scraper&lt;/a&gt;. If something breaks on a public store, open an issue on the Store page with the URL.&lt;/p&gt;

</description>
      <category>woocommerce</category>
      <category>ecommerce</category>
      <category>webscraping</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Adding a first-run setup wizard to a Windows tray app</title>
      <dc:creator>Emir Mrkaljević</dc:creator>
      <pubDate>Wed, 11 Nov 2026 13:08:14 +0000</pubDate>
      <link>https://dev.to/emirmrkaljevic/adding-a-first-run-setup-wizard-to-a-windows-tray-app-2n3f</link>
      <guid>https://dev.to/emirmrkaljevic/adding-a-first-run-setup-wizard-to-a-windows-tray-app-2n3f</guid>
      <description>&lt;p&gt;I build PanelOS, a Windows tray app for small 3.5-inch USB screens in a PC case (480x320, 5-inch support is still beta). Until 1.4.4, first launch started with the defaults. Theme, orientation, music source, and the weather city all lived in Settings.&lt;/p&gt;

&lt;p&gt;The new wizard is a three-step window in the Settings style. It opens by itself only when there is no settings file yet. You can start it later from the tray, under Setup wizard...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhr4scdi0s6gg4nsb4v23.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhr4scdi0s6gg4nsb4v23.png" alt="PanelOS setup step 1" width="800" height="904"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 1 looks for the panel on USB id 1A86:5722, plus the 5-inch name check. If nothing is plugged in, it says to plug it in and click Retry. The scan cannot crash the app, and you can still go Next without a screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdmi98lvn72qv4f46b2mi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdmi98lvn72qv4f46b2mi.png" alt="PanelOS setup step 2" width="800" height="904"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 2 is the theme: the six built-in layouts, a thumbnail when the preview renderer works, and landscape or portrait.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi7l4ca9brrhzzw0mihn0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi7l4ca9brrhzzw0mihn0.png" alt="PanelOS setup step 3" width="800" height="904"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 3 is music: Auto, SMTC, or Spotify (Auto is the default), plus an optional city for the weather view.&lt;/p&gt;

&lt;p&gt;Finish saves through the same path as Settings "Save and apply". Skip, and closing the window, keep the current defaults and mark setup finished so the wizard does not open by itself again.&lt;/p&gt;

&lt;p&gt;The same release moves user data into a PanelOS folder under Local AppData. Existing data is copied once and the old folder stays. Uninstall leaves both folders.&lt;/p&gt;

&lt;p&gt;Lite is free, and Pro is a one-time $6.99.&lt;br&gt;
Site: &lt;a href="https://emirmrkaljevic.github.io/panelos-site/" rel="noopener noreferrer"&gt;https://emirmrkaljevic.github.io/panelos-site/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>windows</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Why canned food unit prices lie about net and drained weight</title>
      <dc:creator>Emir Mrkaljević</dc:creator>
      <pubDate>Wed, 11 Nov 2026 09:16:37 +0000</pubDate>
      <link>https://dev.to/emirmrkaljevic/why-canned-food-unit-prices-lie-about-net-and-drained-weight-o28</link>
      <guid>https://dev.to/emirmrkaljevic/why-canned-food-unit-prices-lie-about-net-and-drained-weight-o28</guid>
      <description>&lt;p&gt;A can of tuna on a German grocery page is labelled "Thunfisch in Olivenöl 185 g". It costs €1.99. If you divide the price by 185 g, you get €10.76 per kg. The same can also lists "Abtropfgewicht 140 g", the drained weight of the fish after the oil is poured off. Using that figure, the price is €14.21 per kg. The cheaper number is the can plus the oil. The dearer number is the food.&lt;/p&gt;

&lt;p&gt;I ran into this while building &lt;a href="https://github.com/emirmrkaljevic/shrinkwatch-eu" rel="noopener noreferrer"&gt;ShrinkWatch EU&lt;/a&gt;, a free open-source extension that shows the price per kg or litre on EU grocery shops and warns when a pack gets smaller for the same price. It is listed on &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/shrinkwatch-eu/" rel="noopener noreferrer"&gt;Firefox Add-ons&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the net weight is the wrong denominator
&lt;/h2&gt;

&lt;p&gt;EU food labelling (Regulation 1169/2011) asks shops to print a drained net weight when a solid food sits in a liquid that you are not meant to eat as part of the product: oil, brine, or water. German shops call it Abtropfgewicht. French shops use poids égoutté, often in a short form such as "dont 140 g égoutté". Italian, Spanish, Portuguese and Dutch pages say peso sgocciolato, peso escurrido, peso escorrido, or uitlekgewicht.&lt;/p&gt;

&lt;p&gt;The title of the page almost always uses the net weight of the full can, 185 g. A parser that only looks for "number plus unit" locks onto that first size and never reads the drained field. The unit price then makes one brand look cheaper than another because it put more oil in the can, not more fish.&lt;/p&gt;

&lt;p&gt;A naive extra rule such as "any size next to the word égoutté" is worse. A recipe line like "Pour 200 g de pâtes égouttées, 500 g de tomates" is not a drained weight of pasta in a can. The 200 g is a cooking instruction.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I match instead
&lt;/h2&gt;

&lt;p&gt;I look for a known drained-weight phrase next to a size, on either side of it, and I also read a labelled field when the page has one (a definition list entry "Abtropfgewicht: 140 g", or a line "Poids égoutté : 140 g").&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;DRAINED_WORD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'(?:abtropf-?\\s*gewicht|'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s1"&gt;'poids(?:\\s+net)?\\s+[eé]goutt[eé]s?|[eé]goutt[eé]s?|'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s1"&gt;'peso(?:\\s+netto)?\\s+sgocciolato|'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s1"&gt;'peso\\s+escurrido|peso\\s+escorrido|'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s1"&gt;'uitlekgewicht|drained(?:\\s+net)?\\s+weight)'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;DRAINED_SIZE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'(?:'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;NUM&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;'\\s*(?:'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;CONTAINER&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;'\\s*)?[x×*]\\s*)?'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="no"&gt;NUM&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;'\\s*'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;UNIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;DRAINED_THEN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;RegExp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="no"&gt;DRAINED_WORD&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;'\\s*[:=]?\\s*'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;DRAINED_SIZE&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;'(?![\\p{L}])'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'iu'&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;THEN_DRAINED&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;RegExp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="no"&gt;DRAINED_SIZE&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;'\\s*'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;DRAINED_WORD&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'iu'&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The full word list in the repo is longer (Nordic, Polish, Czech, Hungarian, Romanian and Greek forms as well). &lt;code&gt;DRAINED_SIZE&lt;/code&gt; can itself be a multipack, so "Abtropfgewicht 3 x 85 g" is 255 g, not 85 g.&lt;/p&gt;

&lt;p&gt;When a drained size is found, it replaces the net size only if the units match and the drained amount is not larger than the net. A typo that claims 400 g of drained tuna in a 185 g can is ignored.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;finish&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;drained&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unit&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;drained&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unit&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;drained&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;drained&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On a product page, a labelled drained field wins over a net weight in the title:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;drained&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;labelledSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;DRAINED_LABEL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
  &lt;span class="nf"&gt;parseDrainedSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
  &lt;span class="nf"&gt;parseDrainedSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;desc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
  &lt;span class="nf"&gt;parseDrainedSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;og&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
  &lt;span class="nf"&gt;parseDrainedSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;drained&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;drained&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unit&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s1"&gt;'pc'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unit&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;drained&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unit&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;drained&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;drained&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;parseSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Thunfisch in Öl 185 g (Abtropfgewicht 140 g)'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// { amount: 140, unit: 'g', count: 1, each: 140 }&lt;/span&gt;

&lt;span class="nf"&gt;parseSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Thon 185 g dont 140 g égoutté'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;  &lt;span class="c1"&gt;// 140&lt;/span&gt;
&lt;span class="nf"&gt;parseSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Tonno 185 g, peso sgocciolato 140 g'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;  &lt;span class="c1"&gt;// 140&lt;/span&gt;
&lt;span class="nf"&gt;parseSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Mais 3 x 140 g (Abtropfgewicht 3 x 85 g)'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// { amount: 255, unit: 'g', count: 3, each: 85 }&lt;/span&gt;

&lt;span class="nf"&gt;unitPrice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.99&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;parseSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Thunfisch in Öl 185 g (Abtropfgewicht 140 g)'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// '14.21'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the cases that must stay as a net weight still do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;parseSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Thunfisch in Öl 185 g'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;  &lt;span class="c1"&gt;// 185&lt;/span&gt;
&lt;span class="nf"&gt;parseSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Pour 200 g de pâtes égouttées, 500 g de tomates'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;  &lt;span class="c1"&gt;// 200&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shipped in &lt;a href="https://github.com/emirmrkaljevic/shrinkwatch-eu/releases/tag/v0.3.14" rel="noopener noreferrer"&gt;ShrinkWatch EU 0.3.14&lt;/a&gt;. If you shop on Lidl, Carrefour or similar sites and want the unit price to use the food, not the liquid in the can, you can install it from &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/shrinkwatch-eu/" rel="noopener noreferrer"&gt;Firefox Add-ons&lt;/a&gt; or get the source at &lt;a href="https://github.com/emirmrkaljevic/shrinkwatch-eu" rel="noopener noreferrer"&gt;github.com/emirmrkaljevic/shrinkwatch-eu&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I used an AI assistant to help draft this article.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>regex</category>
      <category>firefox</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Adding mounting holes to an editable L-bracket from an STL</title>
      <dc:creator>Emir Mrkaljević</dc:creator>
      <pubDate>Wed, 11 Nov 2026 09:13:04 +0000</pubDate>
      <link>https://dev.to/emirmrkaljevic/adding-mounting-holes-to-an-editable-l-bracket-from-an-stl-3c0m</link>
      <guid>https://dev.to/emirmrkaljevic/adding-mounting-holes-to-an-editable-l-bracket-from-an-stl-3c0m</guid>
      <description>&lt;p&gt;I keep building &lt;a href="https://github.com/emirmrkaljevic/mesh2cad" rel="noopener noreferrer"&gt;mesh2cad&lt;/a&gt;, a small open source tool that takes an STL of a simple mechanical part and gives you back editable CAD: a CadQuery script, an OpenSCAD file, a FreeCAD macro, and a STEP solid.&lt;/p&gt;

&lt;p&gt;Version 0.24.0 already turned a filleted L-bracket into a script where the corner radius and the plate sizes were named numbers. Version 0.25.0 adds the missing piece I actually need when I print one: mounting holes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you get
&lt;/h2&gt;

&lt;p&gt;Give it an STL of an L-bracket with rounded vertical edges and through-holes in the foot, the upright, or both. The script it writes keeps the earlier sizes (&lt;code&gt;fillet_r&lt;/code&gt;, &lt;code&gt;base_x&lt;/code&gt;, &lt;code&gt;base_y&lt;/code&gt;, &lt;code&gt;base_t&lt;/code&gt;, &lt;code&gt;leg_x&lt;/code&gt;, &lt;code&gt;leg_y&lt;/code&gt;) and adds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;base_hole_1_d&lt;/code&gt;, &lt;code&gt;base_hole_1_x&lt;/code&gt;, &lt;code&gt;base_hole_1_y&lt;/code&gt; for a hole through the base&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;leg_hole_1_d&lt;/code&gt;, &lt;code&gt;leg_hole_1_x&lt;/code&gt;, &lt;code&gt;leg_hole_1_y&lt;/code&gt; for a hole through the upright&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A second hole in the same member is &lt;code&gt;base_hole_2&lt;/code&gt; or &lt;code&gt;leg_hole_2&lt;/code&gt;. Changing a hole is one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install -U mesh2cad
mesh2cad convert bracket.stl --cadquery bracket.py
mesh2cad params bracket.py
mesh2cad edit bracket.py --set &lt;span class="nv"&gt;base_hole_1_d&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5 --in-place -o bracket.step
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--cadquery bracket.py&lt;/code&gt; writes the script. Add &lt;code&gt;-o bracket.step&lt;/code&gt; on &lt;code&gt;convert&lt;/code&gt; if you also want the solid. The same parameter names work with &lt;code&gt;--openscad&lt;/code&gt; and &lt;code&gt;--freecad&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it decides
&lt;/h2&gt;

&lt;p&gt;mesh2cad only writes a script if the rebuilt solid matches the mesh. The deviation has to stay under max(4 x tolerance, 0.1 mm) and the volume error under 1%. A miss writes no file and exits with the reason, so you never get a script that quietly looks wrong. It fillets the L first, then cuts the holes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest numbers
&lt;/h2&gt;

&lt;p&gt;I test a synthetic 40 x 30 x 12 mm bracket with r=3 mm, an Ø4 hole in the foot and an Ø4 hole in the upright, on three random seeds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;no noise: passes 3 of 3&lt;/li&gt;
&lt;li&gt;0.05 mm noise: passes 2 of 3&lt;/li&gt;
&lt;li&gt;0.2 mm noise: refused&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Limits, plainly: only through-holes along Z are supported. A hole along X or Y, a blind hole, a counterbore, and a hole that crosses from the exclusive foot into the exclusive upright are not written. FreeCAD output is generated from the same checked model, but I did not run FreeCAD itself in these tests.&lt;/p&gt;

&lt;p&gt;It is still a tool for simple prismatic parts. Organic shapes and scans with heavy noise are out of scope, and the README says so.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/emirmrkaljevic/mesh2cad" rel="noopener noreferrer"&gt;https://github.com/emirmrkaljevic/mesh2cad&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Release: &lt;a href="https://github.com/emirmrkaljevic/mesh2cad/releases/tag/v0.25.0" rel="noopener noreferrer"&gt;https://github.com/emirmrkaljevic/mesh2cad/releases/tag/v0.25.0&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;PyPI: &lt;a href="https://pypi.org/project/mesh2cad/" rel="noopener noreferrer"&gt;https://pypi.org/project/mesh2cad/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have a simple mechanical STL where it fails, an issue with the file (or a description of the shape) helps me most.&lt;/p&gt;

</description>
      <category>python</category>
      <category>cad</category>
      <category>3dprinting</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Why some smart devices bypass your Pi-hole (hardcoded DNS, DoT and DoH)</title>
      <dc:creator>Emir Mrkaljević</dc:creator>
      <pubDate>Tue, 10 Nov 2026 20:52:21 +0000</pubDate>
      <link>https://dev.to/emirmrkaljevic/why-some-smart-devices-bypass-your-pi-hole-hardcoded-dns-dot-and-doh-1o1d</link>
      <guid>https://dev.to/emirmrkaljevic/why-some-smart-devices-bypass-your-pi-hole-hardcoded-dns-dot-and-doh-1o1d</guid>
      <description>&lt;p&gt;I run a local DNS filter on my home network, the same idea as Pi-hole: the router hands out one resolver, queries hit that box, and ads or trackers I do not want never get an answer. That works for phones and laptops that honor DHCP. It does not work for every cheap camera, plug or feeder.&lt;/p&gt;

&lt;p&gt;Some devices never send those queries to your resolver at all. They talk to a public DNS service directly. From the filter's point of view, nothing happened. The device still reaches &lt;code&gt;vendor.example.com&lt;/code&gt; just fine.&lt;/p&gt;

&lt;p&gt;I added detection for this in &lt;a href="https://github.com/emirmrkaljevic/iotaudit" rel="noopener noreferrer"&gt;iotaudit&lt;/a&gt; 0.1.19, the local CLI and MCP server I use to audit devices I own. This post is about the three patterns it looks for, and what the report is and is not allowed to claim.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three ways a device skips your resolver
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Classic DNS to a public resolver.&lt;/strong&gt; The device sends plain UDP (or TCP) DNS to a well-known address such as &lt;code&gt;8.8.8.8&lt;/code&gt;, &lt;code&gt;1.1.1.1&lt;/code&gt; or &lt;code&gt;9.9.9.9&lt;/code&gt;, including the usual IPv6 counterparts. Port 53 is how DNS has always worked. Your Pi-hole never sees the question because it was never asked.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. DNS-over-TLS (DoT).&lt;/strong&gt; The device opens TLS on port 853, which IANA assigned to encrypted DNS. The query is not visible as plaintext, but the port is distinctive. A connection to &lt;code&gt;1.1.1.1:853&lt;/code&gt; is almost certainly DNS, not a web session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. DNS-over-HTTPS (DoH).&lt;/strong&gt; The device uses HTTPS, usually on port 443, to a known DoH hostname such as &lt;code&gt;dns.google&lt;/code&gt; or &lt;code&gt;cloudflare-dns.com&lt;/code&gt; (visible as TLS SNI, HTTP Host, or a DNS name that already resolved). That traffic looks like ordinary HTTPS unless you check the name. If you only see HTTPS to a known resolver IP, with no hostname, that is a weaker signal: it often is DoH, but the same address can be used for other services, so I treat it as high confidence, not as a certainty.&lt;/p&gt;

&lt;p&gt;None of this is proof that a vendor is doing something malicious. It is an observed routing choice: the device is not using the resolver your router offered.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to spot it on a network you own
&lt;/h2&gt;

&lt;p&gt;You need to see traffic from the device itself. A browser on your laptop will not show you what the camera queries. On a network you own, capture that device (for example with ARP on the LAN, a hotspot the device joins, or a pcap you already have), then look at destinations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;port 53 to a public resolver IP&lt;/li&gt;
&lt;li&gt;port 853 to anyone, especially a known resolver&lt;/li&gt;
&lt;li&gt;port 443 whose SNI or domain is a known DoH name&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;iotaudit does that pass for you. After a capture or &lt;code&gt;iotaudit analyze capture.pcap&lt;/code&gt;, a device that did this gets a finding, and the one-line verdict names it, for example "uses public DNS directly" or "uses DNS-over-HTTPS".&lt;/p&gt;

&lt;p&gt;A synthetic example of the kind of line you should see (no real addresses from my LAN):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Device 192.168.0.50
  DNS-over-TLS (bypasses router)
    Device sent DNS-over-TLS (port 853) to 1.1.1.1, bypassing your
    router's DNS. Queries may leave your network even if you run Pi-hole.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install and run it locally. There is no account and no telemetry:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install -U iotaudit
iotaudit analyze capture.pcap
&lt;span class="c"&gt;# or, on a network you own, after the consent prompt:&lt;/span&gt;
sudo iotaudit auto
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The HTML report and the one-line verdict are the useful parts. The grade moves a little when public DNS is present (it is a medium finding, same weight as the older hardcoded-DNS check). I would not treat the letter as a moral score. It is a way to sort devices that deserve a second look.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this does not tell you
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It does not decrypt DoT or DoH. You learn that encrypted DNS was used, not which names were asked.&lt;/li&gt;
&lt;li&gt;HTTPS to a resolver IP without a DoH hostname is a hint, not a fact. The finding is worded that way on purpose.&lt;/li&gt;
&lt;li&gt;A device that uses your router DNS will not show these findings. That is success, not a gap in the tool.&lt;/li&gt;
&lt;li&gt;You should only capture networks and devices you own, and you should accept the consent prompt. This is not a scanner for other people's Wi-Fi.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want a shareable report later, &lt;code&gt;iotaudit report AUDIT.json --redact&lt;/code&gt; replaces local IPs, MACs and hostnames first.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I do when I see it
&lt;/h2&gt;

&lt;p&gt;Blocking port 53 to the internet on the router is the easy first step, and it stops the classic case. It does not stop DoT or DoH. For those, I also block outbound 853, and I think about whether 443 to known resolver IPs or DoH names should be denied on the IoT network. Some devices fall back to the router DNS and keep working. Some break until you allow the vendor's cloud.&lt;/p&gt;

&lt;p&gt;A guest or IoT VLAN still helps: even if a device bypasses the filter, it is not sitting on the same segment as your laptop.&lt;/p&gt;

&lt;p&gt;I wrote earlier about &lt;a href="https://dev.to/emirmrkaljevic/what-my-smart-pet-feeder-does-on-the-network-and-why-i-couldnt-capture-the-video-31l7"&gt;what a pet feeder did on the network&lt;/a&gt; and about &lt;a href="https://dev.to/emirmrkaljevic/your-router-may-have-opened-ports-for-your-smart-devices-heres-how-to-list-them-read-only-535k"&gt;listing UPnP port forwards read-only&lt;/a&gt;. This is the next gap I kept hitting: the filter was fine, the device simply never asked it.&lt;/p&gt;

&lt;p&gt;Code, docs and the 0.1.19 notes are at &lt;a href="https://github.com/emirmrkaljevic/iotaudit" rel="noopener noreferrer"&gt;github.com/emirmrkaljevic/iotaudit&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>iot</category>
      <category>security</category>
      <category>privacy</category>
      <category>networking</category>
    </item>
    <item>
      <title>What I found when I pointed a CLI recorder at a second Rust rewrite</title>
      <dc:creator>Emir Mrkaljević</dc:creator>
      <pubDate>Tue, 10 Nov 2026 16:13:45 +0000</pubDate>
      <link>https://dev.to/emirmrkaljevic/what-i-found-when-i-pointed-a-cli-recorder-at-a-second-rust-rewrite-282</link>
      <guid>https://dev.to/emirmrkaljevic/what-i-found-when-i-pointed-a-cli-recorder-at-a-second-rust-rewrite-282</guid>
      <description>&lt;p&gt;I have been using &lt;a href="https://github.com/emirmrkaljevic/behave" rel="noopener noreferrer"&gt;behave&lt;/a&gt; to record how GNU coreutils 9.12 behaves, then replay the same cases against &lt;a href="https://github.com/uutils/coreutils" rel="noopener noreferrer"&gt;uutils&lt;/a&gt;, the Rust rewrite. That work has already led to a run of upstream bug reports and merged fix PRs. This week I pointed the same recorder at a second Rust rewrite: &lt;a href="https://github.com/uutils/findutils" rel="noopener noreferrer"&gt;uutils findutils&lt;/a&gt;, starting with &lt;code&gt;xargs&lt;/code&gt;, and compared it to GNU findutils 4.10.&lt;/p&gt;

&lt;p&gt;The idea is the same. Record stdout, stderr, and the exit status from the reference tool, then replay the cases against the rewrite. A failure is a concrete difference, not a guess about what the tool "should" do.&lt;/p&gt;

&lt;p&gt;The new suite lives at &lt;a href="https://github.com/emirmrkaljevic/behave/tree/main/examples/xargs" rel="noopener noreferrer"&gt;&lt;code&gt;examples/xargs&lt;/code&gt;&lt;/a&gt;. It has 44 cases, recorded from GNU findutils 4.10.0, and they run in behave's CI. Three of those differences were real bugs. Each one is now an issue plus a fix PR with a test.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;code&gt;-I&lt;/code&gt; with the default command printed the input items
&lt;/h2&gt;

&lt;p&gt;When &lt;code&gt;-I&lt;/code&gt;, &lt;code&gt;-i&lt;/code&gt;, or &lt;code&gt;--replace&lt;/code&gt; is used without an explicit command, &lt;code&gt;xargs&lt;/code&gt; should run &lt;code&gt;echo&lt;/code&gt; once per input item. The default command has no initial arguments, so the replace string never appears, and each invocation should print a blank line (the same as &lt;code&gt;echo&lt;/code&gt; with no arguments).&lt;/p&gt;

&lt;p&gt;uutils printed the input items instead.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'hello\nworld\n'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; xargs -I R
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GNU findutils 4.10.0 prints two blank lines. uutils findutils 0.11.0 (current main, when I recorded it) printed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hello
world
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same happened with &lt;code&gt;xargs -i&lt;/code&gt; and &lt;code&gt;xargs --replace&lt;/code&gt;. Passing an explicit command was already fine on both sides:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'hello\nworld\n'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; xargs -I R &lt;span class="nb"&gt;echo&lt;/span&gt;
&lt;span class="c"&gt;# two blank lines&lt;/span&gt;

&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'hello\nworld\n'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; xargs -I R &lt;span class="nb"&gt;echo&lt;/span&gt; R
&lt;span class="c"&gt;# hello&lt;/span&gt;
&lt;span class="c"&gt;# world&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the happy path looked correct, and the default-command case was the one that drifted. I filed &lt;a href="https://github.com/uutils/findutils/issues/984" rel="noopener noreferrer"&gt;uutils/findutils#984&lt;/a&gt; and the fix in &lt;a href="https://github.com/uutils/findutils/pull/986" rel="noopener noreferrer"&gt;PR #986&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. &lt;code&gt;-a&lt;/code&gt; rejected a filename that starts with a dash
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;xargs -a FILE&lt;/code&gt; reads items from &lt;code&gt;FILE&lt;/code&gt; instead of stdin. If that name starts with a dash, GNU still treats it as a filename. uutils treated it as an unknown option and refused to run.&lt;/p&gt;

&lt;p&gt;The same gap showed up on the other options that take a value: &lt;code&gt;-n&lt;/code&gt;, &lt;code&gt;-s&lt;/code&gt;, &lt;code&gt;-L&lt;/code&gt;, &lt;code&gt;-d&lt;/code&gt;, and &lt;code&gt;-P&lt;/code&gt;. A name or number that looks like a flag should still be accepted as the option's value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# GNU findutils 4.10.0: reads items from the file named -foo&lt;/span&gt;
&lt;span class="c"&gt;# uutils: rejected the filename&lt;/span&gt;
xargs -a -foo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I filed &lt;a href="https://github.com/uutils/findutils/issues/985" rel="noopener noreferrer"&gt;issue #985&lt;/a&gt; and &lt;a href="https://github.com/uutils/findutils/pull/987" rel="noopener noreferrer"&gt;PR #987&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is a small class of bugs I keep seeing when a rewrite parses flags with a stricter library default than the original tool. The reference tool often accepts a value that starts with a dash. A probe that only tries tidy names will never see it.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;code&gt;--eof&lt;/code&gt; swallowed the next option
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;--eof&lt;/code&gt; and &lt;code&gt;-e&lt;/code&gt; set the logical end-of-file string. The argument is optional. When it is omitted, the next token should still be parsed as a normal option. uutils consumed that token as the EOF string, so a following flag disappeared.&lt;/p&gt;

&lt;p&gt;The short form I used while recording was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;xargs --eof -l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GNU findutils still honours &lt;code&gt;-l&lt;/code&gt;. uutils treated &lt;code&gt;-l&lt;/code&gt; as the EOF string and ignored the line-limit flag. I filed &lt;a href="https://github.com/uutils/findutils/issues/992" rel="noopener noreferrer"&gt;issue #992&lt;/a&gt; and &lt;a href="https://github.com/uutils/findutils/pull/993" rel="noopener noreferrer"&gt;PR #993&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Optional arguments are a reliable place to look. A recorder that walks flag pairs will put &lt;code&gt;--eof&lt;/code&gt; next to &lt;code&gt;-l&lt;/code&gt; without anyone writing that case by hand.&lt;/p&gt;

&lt;h2&gt;
  
  
  A lesson I had already paid for: pin the reference version
&lt;/h2&gt;

&lt;p&gt;While this suite was going in, behave's CI was red on a pre-existing &lt;code&gt;base32&lt;/code&gt; case, and it never reached &lt;code&gt;xargs&lt;/code&gt;. The runner ships GNU coreutils 9.4. I record from 9.12, because that is the release uutils aims at. The failing cases were about decoding unpadded input: GNU 9.5 and later decode it, 9.4 rejects it.&lt;/p&gt;

&lt;p&gt;The fix was not to weaken the cases. I tagged those three specs &lt;code&gt;gnu-9.5&lt;/code&gt; (two in &lt;code&gt;examples/base32&lt;/code&gt;, one in &lt;code&gt;examples/base64&lt;/code&gt;) and skipped that tag in CI, so they still run against a current GNU locally. CI went green again, including the 44 &lt;code&gt;xargs&lt;/code&gt; cases.&lt;/p&gt;

&lt;p&gt;The same lesson showed up when I was testing coreutils, and it is worth repeating. If you claim compatibility with a specific reference release, record from that release. A case that is correct on 9.12 can fail on 9.4, and the noise looks like a product bug. Version-sensitive specs belong behind a tag, or they teach people to ignore failures.&lt;/p&gt;

&lt;h2&gt;
  
  
  A third rewrite: uutils sed
&lt;/h2&gt;

&lt;p&gt;I also pointed behave at &lt;a href="https://github.com/uutils/sed" rel="noopener noreferrer"&gt;uutils sed&lt;/a&gt;, compared to GNU sed 4.9, using non-interactive cases. Two differences stood out, and both are now filed with a test and a fix.&lt;/p&gt;

&lt;p&gt;The GNU &lt;code&gt;v&lt;/code&gt; command is a version assertion. It does nothing at runtime if the running sed is new enough, and it is a common guard at the top of GNU sed scripts. uutils already compiled &lt;code&gt;v&lt;/code&gt; and rejected versions newer than 4.9, but a successful check still panicked at runtime with &lt;code&gt;invalid command code&lt;/code&gt; as soon as there was any input. Existing tests called &lt;code&gt;sed v&lt;/code&gt; with no stdin, so they never reached the processor. Feeding a line was enough:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'a\n'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; sed &lt;span class="s1"&gt;'v'&lt;/span&gt;
&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'a\n'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; sed &lt;span class="s1"&gt;'v4.9'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GNU sed 4.9 prints &lt;code&gt;a&lt;/code&gt; and exits 0. uutils aborted. The argument parser also read the rest of the line as the version, so &lt;code&gt;v;s/a/A/&lt;/code&gt; was rejected, and addresses like &lt;code&gt;1v&lt;/code&gt; were refused. I filed this as &lt;a href="https://github.com/uutils/sed/issues/669" rel="noopener noreferrer"&gt;uutils/sed#669&lt;/a&gt; and the fix in &lt;a href="https://github.com/uutils/sed/pull/671" rel="noopener noreferrer"&gt;PR #671&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The second gap was comments. GNU sed treats &lt;code&gt;#&lt;/code&gt; after a command, including after &lt;code&gt;s///&lt;/code&gt; flags, as the start of a comment. uutils treated &lt;code&gt;#&lt;/code&gt; as an invalid substitute flag or as extra characters at the end of the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'a\n'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; sed &lt;span class="s1"&gt;'s/a/A/#comment'&lt;/span&gt;
&lt;span class="c"&gt;# GNU: A&lt;/span&gt;
&lt;span class="c"&gt;# uutils: invalid substitute flag: '#'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same happened for &lt;code&gt;p#comment&lt;/code&gt;, &lt;code&gt;y/a/A/#c&lt;/code&gt;, and &lt;code&gt;{p}#c&lt;/code&gt;. A related terminator was missing too: &lt;code&gt;{s/a/A/}&lt;/code&gt; was rejected because flag parsing did not stop at &lt;code&gt;}&lt;/code&gt;. I filed &lt;a href="https://github.com/uutils/sed/issues/670" rel="noopener noreferrer"&gt;issue #670&lt;/a&gt; and &lt;a href="https://github.com/uutils/sed/pull/672" rel="noopener noreferrer"&gt;PR #672&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would take to the next rewrite
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Reuse the recorder.&lt;/strong&gt; The xargs bugs were not exotic. Default command plus &lt;code&gt;-I&lt;/code&gt;, a filename starting with a dash, and an optional argument followed by another flag are ordinary corners. A suite of 44 recorded cases was enough to surface all three.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pin the reference release, and tag the rest.&lt;/strong&gt; The 9.4 versus 9.5 unpadded-decode mismatch would have buried the new xargs specs in a red CI job. Skipping a version tag is honest; deleting the cases is not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feed the tool some input when you test a no-op.&lt;/strong&gt; The &lt;code&gt;v&lt;/code&gt; panic was hidden by tests that compiled the script and exited before a line arrived.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;File a fix with a test.&lt;/strong&gt; Upstream reviewers can see the case fail without the patch and pass with it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want to try the same specs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew install emirmrkaljevic/tap/behave
&lt;span class="c"&gt;# or: go install github.com/emirmrkaljevic/behave/cmd/behave`latest&lt;/span&gt;

behave run examples/xargs
behave diff examples/xargs --impl /path/to/uutils/xargs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The recorder, the suites, and the upstream links are in the &lt;a href="https://github.com/emirmrkaljevic/behave" rel="noopener noreferrer"&gt;behave&lt;/a&gt; repository.&lt;/p&gt;

</description>
      <category>rust</category>
      <category>testing</category>
      <category>cli</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Where EU shops hide the 30-day lowest price before Black Friday</title>
      <dc:creator>Emir Mrkaljević</dc:creator>
      <pubDate>Tue, 10 Nov 2026 16:07:21 +0000</pubDate>
      <link>https://dev.to/emirmrkaljevic/where-eu-shops-hide-the-30-day-lowest-price-before-black-friday-382n</link>
      <guid>https://dev.to/emirmrkaljevic/where-eu-shops-hide-the-30-day-lowest-price-before-black-friday-382n</guid>
      <description>&lt;p&gt;I already wrote about the EU 30-day rule: when a shop announces a discount, the crossed-out "old" price is supposed to be the lowest price it charged in the previous 30 days. This post is a walk through the places where shops actually put that number, and the lookalike figures next to it.&lt;/p&gt;

&lt;p&gt;I built truediscount, a free open-source browser extension and userscript, to read those numbers on the product page. What follows comes from the shop adapters and the saved product pages I test against, not from today's live prices.&lt;/p&gt;

&lt;h2&gt;
  
  
  A generic sweep, then a dedicated reader
&lt;/h2&gt;

&lt;p&gt;Many EU shops already print a sentence such as "lowest price in the last 30 days", "niedrigster Preis der letzten 30 Tage", "più basso ultimi 30gg" or "le plus bas". truediscount walks visible text for a "lowest" word plus a mention of 30 days, then reads the price next to that label.&lt;/p&gt;

&lt;p&gt;That sweep is enough when the disclosure is ordinary text. Some shops need a dedicated reader, because the 30-day figure is in page state, in a labelled buy box, or next to a recommended retail price that looks similar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Amazon: the was-price in the buy box
&lt;/h2&gt;

&lt;p&gt;On Amazon EU stores, the current price is the one in the buy box. The crossed-out "was" price lives in the same block, often as a &lt;code&gt;basisPrice&lt;/code&gt; or a struck &lt;code&gt;a-price&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That "was" figure is not automatically the 30-day low. If Amazon prints a separate "lowest price in the last 30 days" label, the generic sweep picks it up. If it does not, the crossed-out price is just a was-price until you have your own history from a later visit.&lt;/p&gt;

&lt;p&gt;One parsing trap I fixed in &lt;a href="https://github.com/emirmrkaljevic/truediscount/releases/tag/v0.13.3" rel="noopener noreferrer"&gt;truediscount 0.13.3&lt;/a&gt;: amounts of 1,000 or more must be read in full. A price written as &lt;code&gt;€1,599.00&lt;/code&gt;, &lt;code&gt;1.299,99&lt;/code&gt; or a Swiss &lt;code&gt;1'299.00&lt;/code&gt; used to get cut after the first digits, so the comparison never saw the real reference price.&lt;/p&gt;

&lt;h2&gt;
  
  
  Zalando: a struck price in the price container
&lt;/h2&gt;

&lt;p&gt;Zalando's old price, when it is shown, is a strikethrough in the product price container. The current price often comes from JSON-LD. On one live product page I saved for tests, there was no struck old price at all, so there was nothing to compare until a 30-day label or a later visit provided a reference.&lt;/p&gt;

&lt;h2&gt;
  
  
  MediaMarkt, Saturn and MediaWorld: the type of the struck price matters
&lt;/h2&gt;

&lt;p&gt;These three share a layout. The struck figure's &lt;code&gt;data-test&lt;/code&gt; type is the whole story:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;rrp&lt;/code&gt; is a recommended retail price (in Germany, the "UVP" label). It is not the shop's 30-day low.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;previous&lt;/code&gt; is a claimed earlier shop price.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lop&lt;/code&gt; or &lt;code&gt;lowest&lt;/code&gt; (and the Italian "Più basso ultimi 30gg") is the 30-day disclosure. It must not be treated as a "was" price.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On a saved MediaMarkt.de page the struck amount was labelled UVP, so it is an RRP. On a saved MediaWorld Italy page a "30gg" label was the 30-day disclosure, with no claimed old price. Swiss pages group thousands with an apostrophe, which has to be read as a whole, not as 1.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lidl: look at the word next to the strike
&lt;/h2&gt;

&lt;p&gt;Lidl prints the current price in one element and the struck amount in another. If the label next to the strike is "UVP", it is a manufacturer's recommended price. If the strike is bare, it is Lidl's own earlier price.&lt;/p&gt;

&lt;p&gt;I have checked that on saved pages from lidl.de and lidl.fr. Other Lidl country sites share the same layout, but I have not live-tested each of them yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Notino: the selected size, not the JSON-LD offer
&lt;/h2&gt;

&lt;p&gt;Notino is the shop that made me stop trusting the first JSON-LD offer on the page. That block lists every size, and the first offer is often another size or the price before a voucher code.&lt;/p&gt;

&lt;p&gt;The shelf price is the selected size. The 30-day low is &lt;code&gt;recentMinPrice&lt;/code&gt; on that same variant in the page state, also printed as "Mindestpreis" or "Letzter niedrigster Preis". If the page state is missing, the printed label is enough. A recommended price in that state is not crossed out, so it is not treated as a previous shop price.&lt;/p&gt;

&lt;p&gt;This reader is in &lt;a href="https://github.com/emirmrkaljevic/truediscount/releases/tag/v0.13.3" rel="noopener noreferrer"&gt;v0.13.3&lt;/a&gt;, for 25 Notino country sites. I checked it on saved pages from notino.de, and the same price state on notino.fr.&lt;/p&gt;

&lt;h2&gt;
  
  
  Euronics Italy: "prezzo precedente" versus "prezzo consigliato"
&lt;/h2&gt;

&lt;p&gt;This is the RRP trap I want people to watch for this Black Friday. On euronics.it, the buy box holds the current price and two labels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;prezzo precedente&lt;/strong&gt;, the barred previous price, is defined on the page as the lowest price charged in the 30 days before the promotion. That is the 30-day low.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;prezzo consigliato&lt;/strong&gt; is the manufacturer's recommended price. It is only an RRP. The extension uses it as a reference only when there is no previous price, and flags it as an RRP.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A later compare column repeats other prices, including figures that do not belong to this product, so it is ignored. On a saved promotion page the current price was under the barred previous price, so the discount looked real against the shop's own 30-day figure. On a saved page with only a recommended price, there was no 30-day number, so tracking starts and that figure is flagged as an RRP.&lt;/p&gt;

&lt;p&gt;Euronics Italy landed on the main branch after 0.13.3. Other country sites are separate storefronts and are not included.&lt;/p&gt;

&lt;h2&gt;
  
  
  Otto and bol.com: what I have not checked yet
&lt;/h2&gt;

&lt;p&gt;For otto.de I look for a retail-style old price. For bol.com I look for the list price in the buy block. Neither selector is, by itself, a 30-day disclosure. I have not yet checked those shops against a saved live product page, so I am not going to describe a disclosure I have not seen.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to do with this
&lt;/h2&gt;

&lt;p&gt;If you only remember one thing before Black Friday: a crossed-out number is not enough. Check the label. UVP, "prezzo consigliato", "retail price" and "adviesprijs" are recommended prices. The 30-day low may be in a quieter line, in a "30gg" or "Mindestpreis" label, or in the page's own definition of "prezzo precedente".&lt;/p&gt;

&lt;p&gt;truediscount does that comparison on the product page. Price history stays in your browser. No account, no tracking, nothing is sent anywhere.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Firefox: &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/truediscount/" rel="noopener noreferrer"&gt;install from addons.mozilla.org&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Chrome, Edge and Brave: load the Chrome zip from the &lt;a href="https://github.com/emirmrkaljevic/truediscount/releases/latest" rel="noopener noreferrer"&gt;latest GitHub release&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Userscript: &lt;a href="https://greasyfork.org/en/scripts/602599-truediscount-is-this-discount-real" rel="noopener noreferrer"&gt;Greasy Fork&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The current release is &lt;a href="https://github.com/emirmrkaljevic/truediscount/releases/tag/v0.13.3" rel="noopener noreferrer"&gt;truediscount 0.13.3&lt;/a&gt;. A live demo is on &lt;a href="https://emirmrkaljevic.github.io/truediscount/" rel="noopener noreferrer"&gt;the site&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Install it before you trust a "-50%" label this November.&lt;/p&gt;

</description>
      <category>blackfriday</category>
      <category>opensource</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How I draw real CPU and GPU load sparklines on a 480x320 USB PC screen</title>
      <dc:creator>Emir Mrkaljević</dc:creator>
      <pubDate>Tue, 10 Nov 2026 16:00:33 +0000</pubDate>
      <link>https://dev.to/emirmrkaljevic/how-i-draw-real-cpu-and-gpu-load-sparklines-on-a-480x320-usb-pc-screen-3dg5</link>
      <guid>https://dev.to/emirmrkaljevic/how-i-draw-real-cpu-and-gpu-load-sparklines-on-a-480x320-usb-pc-screen-3dg5</guid>
      <description>&lt;p&gt;I build PanelOS, a Windows tray app for those small 3.5-inch USB screens people put in a PC case (480x320, or 320x480 in portrait). The usual job is simple: temps, watts, fans, and now-playing, in a layout that stays readable at that size.&lt;/p&gt;

&lt;p&gt;A few of the themes already had a tiny load graph, the kind of sparkline that sits next to a CPU or GPU figure. In Signature, Noir, and Nature Flow it looked alive. It was not. Those themes drew a fixed wave. The custom Load sparkline in the theme editor did the same thing whenever it had no history: it invented a wave so the layout would not look empty.&lt;/p&gt;

&lt;p&gt;The rest of the app already had the real series. The panel keeps thirty CPU load samples and thirty GPU load samples, about one a second. Classic was already drawing from that history. The other themes, and the editor, never received it.&lt;/p&gt;

&lt;p&gt;In 1.4.3 I pass that same history through and scale it from 0 to 100. The sparkline is just those points, stretched across a narrow strip on a 480x320 (or 320x480) frame. If there are fewer than two samples, it draws a flat line instead of a fake wave. An empty history should not crash the render, and a single sample should not pretend to be a trend.&lt;/p&gt;

&lt;p&gt;I left FPS out of this. The red temperature alert was already enough, and a second moving line on that small panel would have fought the layout more than it helped. The temperature alert is unchanged.&lt;/p&gt;

&lt;p&gt;There was a second, related Settings bug in the same release. Opening Settings rebuilt the fan menu, and the first pass only had Auto. If your saved fan was not in that pass, the control jumped back to Auto, and Save and apply would have written Auto. The screen itself had kept the right fan. The menu now keeps the current choice, including a fan that is not in this refresh, and Save and apply writes Auto only when Auto is the choice.&lt;/p&gt;

&lt;p&gt;If you have one of these panels and want to try it, Lite is free:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://emirmrkaljevic.github.io/panelos-site/" rel="noopener noreferrer"&gt;https://emirmrkaljevic.github.io/panelos-site/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is confirmed on 3.5-inch USB screens with Hardware Id 1A86:5722. 5-inch support is still beta. The installer is unsigned for now, so Windows SmartScreen may ask you to choose More info, then Run anyway. Not affiliated with any hardware manufacturer.&lt;/p&gt;

</description>
      <category>python</category>
      <category>windows</category>
      <category>showdev</category>
      <category>hardware</category>
    </item>
    <item>
      <title>From an STL of an L-bracket to a CAD script where the fillet is one number</title>
      <dc:creator>Emir Mrkaljević</dc:creator>
      <pubDate>Tue, 10 Nov 2026 15:13:14 +0000</pubDate>
      <link>https://dev.to/emirmrkaljevic/from-an-stl-of-an-l-bracket-to-a-cad-script-where-the-fillet-is-one-number-43o</link>
      <guid>https://dev.to/emirmrkaljevic/from-an-stl-of-an-l-bracket-to-a-cad-script-where-the-fillet-is-one-number-43o</guid>
      <description>&lt;p&gt;I keep building &lt;a href="https://github.com/emirmrkaljevic/mesh2cad" rel="noopener noreferrer"&gt;mesh2cad&lt;/a&gt;, a small open source tool that takes an STL mesh of a simple mechanical part and gives you back editable CAD: a CadQuery script, an OpenSCAD file, a FreeCAD macro and a STEP solid.&lt;/p&gt;

&lt;p&gt;Version 0.24.0 adds one part I print a lot: the filleted L-bracket.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you get
&lt;/h2&gt;

&lt;p&gt;Give it an STL of an L-bracket with a rounded inner corner and rounded vertical edges, and the script it writes has named parameters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;fillet_r&lt;/code&gt; for the corner radius&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;base_x&lt;/code&gt;, &lt;code&gt;base_y&lt;/code&gt;, &lt;code&gt;base_t&lt;/code&gt; for the base plate&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;leg_x&lt;/code&gt;, &lt;code&gt;leg_y&lt;/code&gt; for the vertical leg&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So changing the part is one command instead of mesh surgery:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install -U mesh2cad
mesh2cad convert bracket.stl --cadquery -o bracket.py
mesh2cad params bracket.py
mesh2cad edit bracket.py --set &lt;span class="nv"&gt;fillet_r&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3 --set &lt;span class="nv"&gt;base_t&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5 --in-place -o bracket.step
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How it decides
&lt;/h2&gt;

&lt;p&gt;mesh2cad only writes a script if the rebuilt solid matches the mesh. It compares the two and refuses when the deviation is above max(4 x tolerance, 0.1 mm) or the volume is off by more than 1%. A refusal writes no file at all, so you never get a script that quietly looks wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest numbers
&lt;/h2&gt;

&lt;p&gt;I test on synthetic brackets with three random seeds and added noise:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;no noise: passes 3 of 3&lt;/li&gt;
&lt;li&gt;0.05 mm noise: passes 2 of 3&lt;/li&gt;
&lt;li&gt;0.2 mm noise: refused&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;FreeCAD output is generated from the same checked model, but I did not run FreeCAD itself in these tests.&lt;/p&gt;

&lt;p&gt;It is still a tool for simple prismatic parts: boxes, plates, brackets, holes, bosses, fillets. Organic shapes and scans with heavy noise are out of scope for now, and the README says so.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/emirmrkaljevic/mesh2cad" rel="noopener noreferrer"&gt;https://github.com/emirmrkaljevic/mesh2cad&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;PyPI: &lt;a href="https://pypi.org/project/mesh2cad/" rel="noopener noreferrer"&gt;https://pypi.org/project/mesh2cad/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have a simple mechanical STL where it fails, an issue with the file (or a description of the shape) helps me most.&lt;/p&gt;

</description>
      <category>python</category>
      <category>cad</category>
      <category>3dprinting</category>
      <category>opensource</category>
    </item>
    <item>
      <title>How "4 Becher à 125 g" breaks price-per-kg math</title>
      <dc:creator>Emir Mrkaljević</dc:creator>
      <pubDate>Tue, 10 Nov 2026 13:03:13 +0000</pubDate>
      <link>https://dev.to/emirmrkaljevic/how-4-becher-a-125-g-breaks-price-per-kg-math-3ecp</link>
      <guid>https://dev.to/emirmrkaljevic/how-4-becher-a-125-g-breaks-price-per-kg-math-3ecp</guid>
      <description>&lt;p&gt;On a German grocery page, a yogurt is labelled "4 Becher à 125 g". The pack costs €1.99. If you treat that as 125 g, you get €15.92 per kg. The real pack is 500 g, so the price is €3.98 per kg. That is a four-times error, and it shows up in French and Italian shops too: "4 pots de 125 g", "6 bottiglie da 1,5 l".&lt;/p&gt;

&lt;p&gt;I ran into this while building &lt;a href="https://github.com/emirmrkaljevic/shrinkwatch-eu" rel="noopener noreferrer"&gt;ShrinkWatch EU&lt;/a&gt;, a free open-source extension that shows the price per kg or litre on EU grocery shops and warns when a pack gets smaller for the same price. It is listed on &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/shrinkwatch-eu/" rel="noopener noreferrer"&gt;Firefox Add-ons&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a simple "number plus unit" parse fails
&lt;/h2&gt;

&lt;p&gt;The easy case is already handled: &lt;code&gt;4 x 125 g&lt;/code&gt; and &lt;code&gt;6x0,5l&lt;/code&gt; are a count, a times sign, and a size. German, French and Italian shops often write the container instead of the times sign:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Joghurt 4 Becher à 125 g
Yaourt nature 4 pots de 125 g
Acqua 6 bottiglie da 1,5 l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the parser only looks for a size, it locks onto &lt;code&gt;125 g&lt;/code&gt; or &lt;code&gt;1,5 l&lt;/code&gt; and ignores the count. The unit price then uses one cup or one bottle, not the whole pack.&lt;/p&gt;

&lt;p&gt;A naive fix such as "any number, then &lt;code&gt;de&lt;/code&gt; or &lt;code&gt;à&lt;/code&gt;, then a size" is worse. It would read "Gouda 48 de 400 g" as 48 packs of 400 g, or "Vin 2020 bouteilles de 75 cl" as 2020 bottles.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I match instead
&lt;/h2&gt;

&lt;p&gt;I only accept this form when a known container word sits between the count and the size. The joiners are the usual ones on those shops: &lt;code&gt;à&lt;/code&gt;, &lt;code&gt;de&lt;/code&gt;, &lt;code&gt;da&lt;/code&gt;, &lt;code&gt;of&lt;/code&gt;, &lt;code&gt;po&lt;/code&gt;, &lt;code&gt;x&lt;/code&gt;, and a few more.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;CONTAINER_OF&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'(?:becher|beutel|dosen|flaschen|'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s1"&gt;'pots|bouteilles|canettes|sachets|'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s1"&gt;'vasetti|bottiglie|lattine|bustine|'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s1"&gt;'unidades|botellas|latas|'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s1"&gt;'zakjes|flessen|'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s1"&gt;'bottles|cans|bags|'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s1"&gt;'kubeczki|butelki|'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s1"&gt;'flaskor|burkar|flasker)'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;MULTI_OF&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;RegExp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s1"&gt;'(?&amp;lt;![\\d.,])(\\d{1,3})\\s*'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;CONTAINER_OF&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="s1"&gt;'(?![\\p{L}])\\.?\\s*(?:(?:à|á|a|je|zu je|zu|de|da|di|van|of|po)(?![\\p{L}])|[x×*])\\s*'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="no"&gt;NUM&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;'\\s*'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;UNIT&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;'(?![\\p{L}])'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'iu'&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The list of container words is longer in the repo. The negative lookarounds stop a word like "portionen" being eaten as "portion" plus a leftover letter, and they stop a year or a brand name from becoming a count.&lt;/p&gt;

&lt;p&gt;When that pattern matches, the pack size is &lt;code&gt;count * each&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;MULTI_OF&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;UNITS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;each&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sizeNum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;each&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;each&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;unit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;each&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;each&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;parseSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Joghurt 4 Becher à 125 g'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// { amount: 500, unit: 'g', count: 4, each: 125 }&lt;/span&gt;

&lt;span class="nf"&gt;parseSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Acqua 6 bottiglie da 1,5 l'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// { amount: 9000, unit: 'ml', count: 6, each: 1500 }&lt;/span&gt;

&lt;span class="nf"&gt;unitPrice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.99&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;parseSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Joghurt 4 Becher à 125 g'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// '3.98'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the cases that must stay as a single size still do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;parseSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Gouda 48 de 400 g'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;  &lt;span class="c1"&gt;// 400, not 19200&lt;/span&gt;
&lt;span class="nf"&gt;parseSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Vin 2020 bouteilles de 75 cl'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;  &lt;span class="c1"&gt;// 750&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shipped in ShrinkWatch EU 0.3.13. If you shop on Lidl, Carrefour or similar sites and want the unit price to use the whole pack, you can install it from &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/shrinkwatch-eu/" rel="noopener noreferrer"&gt;Firefox Add-ons&lt;/a&gt; or get the source at &lt;a href="https://github.com/emirmrkaljevic/shrinkwatch-eu" rel="noopener noreferrer"&gt;github.com/emirmrkaljevic/shrinkwatch-eu&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I used an AI assistant to help draft this article.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>regex</category>
      <category>firefox</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
