<?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: hipangwork</title>
    <description>The latest articles on DEV Community by hipangwork (@hipangwork).</description>
    <link>https://dev.to/hipangwork</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%2F4260831%2Fc6b27a2f-f490-4ee9-a001-088f7ba2c9c4.png</url>
      <title>DEV Community: hipangwork</title>
      <link>https://dev.to/hipangwork</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hipangwork"/>
    <language>en</language>
    <item>
      <title>How to serve paid EPUB downloads from a private bucket without leaking the catalog</title>
      <dc:creator>hipangwork</dc:creator>
      <pubDate>Mon, 23 Nov 2026 15:34:21 +0000</pubDate>
      <link>https://dev.to/hipangwork/how-to-serve-paid-epub-downloads-from-a-private-bucket-without-leaking-the-catalog-2d53</link>
      <guid>https://dev.to/hipangwork/how-to-serve-paid-epub-downloads-from-a-private-bucket-without-leaking-the-catalog-2d53</guid>
      <description>&lt;p&gt;I sell annotated EPUBs and audiobooks out of an object bucket. The first version leaked&lt;br&gt;
the entire catalog's first chapters, and the fix was not a better password.&lt;/p&gt;
&lt;h2&gt;
  
  
  The failure I found first
&lt;/h2&gt;

&lt;p&gt;The preview package — first chapter plus a short audio sample — was in the public bucket,&lt;br&gt;
unsigned. &lt;code&gt;/books/&amp;lt;slug&amp;gt;/preview/ch-001.json&lt;/code&gt; returned 200 to anyone. Twenty-three books&lt;br&gt;
meant one &lt;code&gt;for&lt;/code&gt; loop, twenty-three requests, and every free chapter in the catalog, fetched&lt;br&gt;
in under a second.&lt;/p&gt;

&lt;p&gt;The rate limiting I had written never ran, because the request never reached the app.&lt;/p&gt;

&lt;p&gt;That is the trap with static hosting on object storage: an object marked public is public&lt;br&gt;
for everyone, at machine speed, forever. Any protection you build above it is decoration.&lt;/p&gt;

&lt;p&gt;The rule that came out of it: &lt;strong&gt;the public bucket holds only what you would put on a&lt;br&gt;
billboard&lt;/strong&gt; — covers, the catalog index. Anything a reader has to be inside the app to read&lt;br&gt;
goes in a private bucket and is served through the app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public/books/&amp;lt;slug&amp;gt;/cover.jpg
private/books/&amp;lt;slug&amp;gt;/preview/manifest.json
private/books/&amp;lt;slug&amp;gt;/preview/ch-001.json
private/books/&amp;lt;slug&amp;gt;/&amp;lt;edition&amp;gt;/chapters/ch-001.json …
private/books/&amp;lt;slug&amp;gt;/&amp;lt;edition&amp;gt;/download/&amp;lt;slug&amp;gt;.epub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Content-addressed editions, so paid links never 404
&lt;/h2&gt;

&lt;p&gt;The paid download path contains an &lt;code&gt;edition&lt;/code&gt; segment: &lt;code&gt;YYYYMMDD-&amp;lt;hash6&amp;gt;&lt;/code&gt;. If you rebuild the&lt;br&gt;
book, the hash changes and you get a new prefix — and the old prefix is &lt;strong&gt;not deleted&lt;/strong&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;def&lt;/span&gt; &lt;span class="nf"&gt;edition_hash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;digest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sha256&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;name&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;"book.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"guide.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"source.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;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;os&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="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"_src"&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="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"rb"&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;fh&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fh&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&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="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&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="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"_src"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"epub"&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="s2"&gt;"rb"&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;fh&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fh&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&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;track&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"audio"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"tracks"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&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;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;t&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"file"&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;digest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&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;"{track['file']}:{track['seconds']}"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&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;digest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hexdigest&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="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three decisions buried in those twelve lines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hash file contents, not mtimes.&lt;/strong&gt; A rebuild that reproduces identical bytes must not
produce a new edition, or every deploy quietly forks the storage tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Only hash what changes what a reader sees.&lt;/strong&gt; Not the build script, not the timestamp in
&lt;code&gt;manifest.json&lt;/code&gt;. Otherwise the hash is a random number.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never delete old prefixes.&lt;/strong&gt; Storage is cheap; a 403 on a book someone paid for is not.
The tradeoff is unbounded growth, which is fine at 23 books and a problem at 23,000 — at
that point you need a retention job that only prunes prefixes with no live orders.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The 8 MB cap on the EPUB read is a sanity check, not the primary signal: the EPUB is&lt;br&gt;
generated from the three JSON files, so if they are byte-identical the archive should be&lt;br&gt;
too. Reading the whole 30 MB file on every build is just slower for no extra information.&lt;/p&gt;

&lt;h2&gt;
  
  
  Manifest plus one JSON per chapter
&lt;/h2&gt;

&lt;p&gt;A 192-chapter book as a single payload is tens of megabytes on first paint, and most readers&lt;br&gt;
stop at chapter three.&lt;/p&gt;

&lt;p&gt;So the manifest carries metadata only — chapter titles, word counts, audio durations — and&lt;br&gt;
each chapter body is its own object.&lt;/p&gt;

&lt;p&gt;The cost is N+1 requests while reading. The benefit, on a phone with mediocre signal, is a&lt;br&gt;
reader that opens in well under a second and a next-chapter prefetch that is one small&lt;br&gt;
request instead of a re-download. For linear reading, that trade is clearly right: you are&lt;br&gt;
exchanging a burst for a stream.&lt;/p&gt;

&lt;h2&gt;
  
  
  Signed URLs generated per request, never stored
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;DOWNLOAD_URL_TTL = 300&lt;/code&gt;. The download route verifies &lt;code&gt;orderId&lt;/code&gt; + token, asks the storage&lt;br&gt;
layer for a presigned URL, and 302s to it. Nothing about that URL goes into the database,&lt;br&gt;
so there is no table of live URLs to leak or to expire incorrectly.&lt;/p&gt;

&lt;p&gt;Two things worth knowing before you copy the number:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Five minutes is short enough that a URL pasted into a group chat is usually dead on
arrival, and long enough that a slow mobile connection still finishes. I tried 60 seconds;
it produced retries on exactly the users you least want to annoy.&lt;/li&gt;
&lt;li&gt;Presigned URLs end up in proxy and access logs, with the signature attached. If that
matters for your threat model, stream the bytes through the app instead of redirecting —
same authorization, at the cost of bandwidth and a longer-lived worker.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The guard has three tiers, and only two of them are worth calling security
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Tier 1 — HTML.&lt;/strong&gt; Completely open, &lt;code&gt;robots.txt&lt;/code&gt; allows everything, sitemap submitted. This&lt;br&gt;
is the SEO surface. You &lt;em&gt;want&lt;/em&gt; crawlers here, and the page renders its first-screen content&lt;br&gt;
server-side so they never need the JSON.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tier 2 — body JSON.&lt;/strong&gt; Manifest and chapter endpoints require browser-like requests and hit&lt;br&gt;
fixed-window limits: 30 preview chapters/hour, 60 preview manifests/hour, 200 catalog&lt;br&gt;
reads/hour, 400 paid chapters/hour.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tier 3 — paid content.&lt;/strong&gt; &lt;code&gt;orderId&lt;/code&gt; + token &lt;em&gt;plus&lt;/em&gt; its own chapter budget, so one purchase&lt;br&gt;
cannot be turned into a mirror crawler.&lt;/p&gt;

&lt;p&gt;The UA list denies &lt;code&gt;python-requests&lt;/code&gt;, &lt;code&gt;curl/&lt;/code&gt;, &lt;code&gt;httpx&lt;/code&gt;, &lt;code&gt;scrapy&lt;/code&gt;, &lt;code&gt;go-http-client&lt;/code&gt;,&lt;br&gt;
&lt;code&gt;node-fetch&lt;/code&gt; and friends — and deliberately does &lt;strong&gt;not&lt;/strong&gt; contain &lt;code&gt;bot&lt;/code&gt; or &lt;code&gt;spider&lt;/code&gt;. Those&lt;br&gt;
broad words catch Googlebot, which legitimately fetches your HTML, and they are bypassed by&lt;br&gt;
editing one header. What actually carries signal is requiring positive browser behaviour.&lt;/p&gt;

&lt;p&gt;And the honest part: &lt;strong&gt;this is a speed bump, not a wall.&lt;/strong&gt; A headless browser with a real UA&lt;br&gt;
and real headers walks straight through it. The defence that holds is per-order entitlement&lt;br&gt;
plus noticing how fast chapters are consumed from a single order. UA filtering buys you two&lt;br&gt;
things only: the laziest scraper goes away, and your logs tell you who is scraping.&lt;/p&gt;

&lt;p&gt;Why fixed-window instead of a token bucket: the project already had a DB-backed&lt;br&gt;
&lt;code&gt;check_rate_limit&lt;/code&gt; used by other routes. It works across processes with no Redis. Preview&lt;br&gt;
volume is tiny, so sub-second precision buys nothing. Reusing it beat adding an in-memory&lt;br&gt;
limiter that silently resets whenever the worker restarts.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 300-second cache that made "price changes are instant" a lie
&lt;/h2&gt;

&lt;p&gt;Live price is computed per request: list price × discount rate. But the catalog is cached for&lt;br&gt;
300 seconds. Change a discount in admin and the storefront serves the old price for up to five&lt;br&gt;
minutes — including in the JSON the front-end reads.&lt;/p&gt;

&lt;p&gt;That is a textbook read-through cache without an invalidation hook. It survived testing&lt;br&gt;
because during the build phase I was the only writer and a full rebuild always ran alongside a&lt;br&gt;
restart. The second writer is always the admin panel, and it arrived months later.&lt;/p&gt;

&lt;p&gt;If I were starting again, the invalidation call would be written in the same commit as the&lt;br&gt;
cache.&lt;/p&gt;

&lt;h2&gt;
  
  
  Six things I would tell someone starting today
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Put zero valuable objects in a public bucket. Not even chapter one.&lt;/li&gt;
&lt;li&gt;Content-address your editions and never delete an old prefix.&lt;/li&gt;
&lt;li&gt;One JSON object per chapter; metadata in the manifest.&lt;/li&gt;
&lt;li&gt;Signed URLs with a short TTL, generated per request, never persisted.&lt;/li&gt;
&lt;li&gt;Treat UA filtering as logging with a side effect, not as access control.&lt;/li&gt;
&lt;li&gt;Write the cache invalidation hook in the same commit as the cache.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The store this comes from is at &lt;a href="https://books.hipangwork.online/books/" rel="noopener noreferrer"&gt;books.hipangwork.online&lt;/a&gt; —&lt;br&gt;
23 public-domain Chinese classics in English translation, annotated, a few with narration.&lt;br&gt;
The build pipeline that turns JSON sources into EPUBs, audio manifests and a static catalog is&lt;br&gt;
a separate set of mistakes, and I will write that one up if it is useful.&lt;/p&gt;

</description>
      <category>python</category>
      <category>security</category>
      <category>epub</category>
      <category>s3</category>
    </item>
    <item>
      <title>Whisper on a CPU-only laptop: the five settings that decide whether it keeps up</title>
      <dc:creator>hipangwork</dc:creator>
      <pubDate>Mon, 23 Nov 2026 15:24:45 +0000</pubDate>
      <link>https://dev.to/hipangwork/whisper-on-a-cpu-only-laptop-the-five-settings-that-decide-whether-it-keeps-up-16dp</link>
      <guid>https://dev.to/hipangwork/whisper-on-a-cpu-only-laptop-the-five-settings-that-decide-whether-it-keeps-up-16dp</guid>
      <description>&lt;p&gt;Every "run Whisper locally" tutorial ends at &lt;code&gt;pip install&lt;/code&gt; and a sample clip. The&lt;br&gt;
interesting part starts when the clip is a 60-minute meeting and the machine is a&lt;br&gt;
laptop with no GPU.&lt;/p&gt;

&lt;p&gt;There is no single number for "how slow". What you can do is know which knobs matter&lt;br&gt;
and in what order to touch them.&lt;/p&gt;
&lt;h2&gt;
  
  
  1. Model size dominates everything else
&lt;/h2&gt;

&lt;p&gt;The published checkpoints differ by an order of magnitude in parameters:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Parameters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;tiny&lt;/td&gt;
&lt;td&gt;39M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;base&lt;/td&gt;
&lt;td&gt;74M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;small&lt;/td&gt;
&lt;td&gt;244M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;medium&lt;/td&gt;
&lt;td&gt;769M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;large&lt;/td&gt;
&lt;td&gt;1550M&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Compute per audio second scales roughly with parameter count, so moving from &lt;code&gt;small&lt;/code&gt;&lt;br&gt;
to &lt;code&gt;large&lt;/code&gt; is not a 20% regression — expect several times the time for the same audio.&lt;br&gt;
Most CPU-only setups should start at &lt;code&gt;small&lt;/code&gt;, and only step up if the transcript is&lt;br&gt;
actually being read by a human who cares about punctuation.&lt;/p&gt;

&lt;p&gt;Accuracy matters in a different way than you expect: on clean meeting audio, the jump&lt;br&gt;
from &lt;code&gt;small&lt;/code&gt; to &lt;code&gt;large&lt;/code&gt; is often smaller than the jump you get from a domain hotword&lt;br&gt;
list. Fix vocabulary before you buy compute.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Quantisation is the cheapest win
&lt;/h2&gt;

&lt;p&gt;Float32 weights are the default and the least efficient option on CPU. Int8 quantised&lt;br&gt;
runtimes reduce memory traffic, and memory bandwidth — not FLOPs — is usually the&lt;br&gt;
bottleneck on a laptop. In practice, quantisation is the first thing to try after&lt;br&gt;
picking a model size, with a small accuracy cost that is invisible in meeting notes.&lt;/p&gt;

&lt;p&gt;The caveat is implementation-dependent: not every binding exposes the quantised path,&lt;br&gt;
and some fall back to float silently. Verify by measuring, not by reading the README.&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Decoding strategy can cost you 5x
&lt;/h2&gt;

&lt;p&gt;Whisper encodes the audio once, then decodes tokens autoregressively. Beam search with&lt;br&gt;
beam width 5 runs five hypotheses through that decoder. The encoder is unaffected, but&lt;br&gt;
for long audio the decoder is where the time goes.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;beam_size=1&lt;/code&gt; (greedy) is the single biggest speedup available after quantisation, and&lt;br&gt;
it is the first thing I turn off when a machine cannot keep up. Quality drops most on&lt;br&gt;
noisy audio and ambiguous names — which is exactly where the hotword list helps.&lt;/p&gt;
&lt;h2&gt;
  
  
  4. Preprocessing: skip the silence
&lt;/h2&gt;

&lt;p&gt;Meetings are not speech. Silence, hold music, "can everyone mute", the five minutes&lt;br&gt;
where nobody talks while a screen is shared: in a typical recording that is a large&lt;br&gt;
fraction of the file.&lt;/p&gt;

&lt;p&gt;A voice-activity detector that splits audio into speech segments and drops the rest&lt;br&gt;
reduces the audio the model ever sees. It also improves quality, because Whisper&lt;br&gt;
hallucinates text during long silences — the famous "thanks for watching" appears&lt;br&gt;
because the model was trained on video subtitles and has nothing else to predict.&lt;/p&gt;

&lt;p&gt;Two rules when adding VAD:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep 200–300ms of padding on each side of a segment, or you clip word onsets.&lt;/li&gt;
&lt;li&gt;Merge segments shorter than ~0.3s; isolated clicks produce phantom words.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  5. Thread count: physical cores, not logical
&lt;/h2&gt;

&lt;p&gt;Set thread count to physical cores. Hyperthreaded siblings share the execution units&lt;br&gt;
that matter here, and oversubscribing makes it slower, not faster — plus it makes the&lt;br&gt;
whole laptop unusable while it runs.&lt;/p&gt;

&lt;p&gt;If you are running several files, process them sequentially with the full core count&lt;br&gt;
rather than in parallel with half each. The model is memory-bandwidth bound; parallel&lt;br&gt;
workers just fight over the same bandwidth.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to measure instead of guess
&lt;/h2&gt;

&lt;p&gt;Fix the audio, fix the parameters, and report &lt;strong&gt;RTF&lt;/strong&gt; (real-time factor): processing&lt;br&gt;
time divided by audio duration. RTF 0.3 means a 60-minute recording takes 18 minutes.&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;# same file, same model, one variable at a time&lt;/span&gt;
&lt;span class="k"&gt;time&lt;/span&gt; whisper meeting.wav --model small --beam_size 1 --threads 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anything else is anecdote. "It took 20 minutes" means nothing without the file length,&lt;br&gt;
model and thread count.&lt;/p&gt;

&lt;h2&gt;
  
  
  The order I would change things
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;VAD&lt;/strong&gt; — free accuracy and free speed, no model change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Greedy decoding&lt;/strong&gt; — large win, small quality cost on clean audio.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quantise&lt;/strong&gt; — large win, negligible quality cost in practice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smaller model&lt;/strong&gt; — last resort, because it is the one change that makes the
transcript visibly worse.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New hardware&lt;/strong&gt; — only after the four above.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The counterintuitive part: the biggest perceived improvement for users usually comes&lt;br&gt;
from step 1, not from a bigger model. People judge a transcript by whether it misses&lt;br&gt;
sentences, and silence-skipping is what stops it from inventing them.&lt;/p&gt;

&lt;p&gt;I build an offline meeting-minutes tool on this stack (no upload, no account). If you&lt;br&gt;
are doing the same and hit a wall on diarisation or hotwords, I would like to hear&lt;br&gt;
which trade-off you picked.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>tutorial</category>
      <category>speech</category>
      <category>windows</category>
    </item>
    <item>
      <title>How to generate a PPTX file in Python without PowerPoint or Office installed</title>
      <dc:creator>hipangwork</dc:creator>
      <pubDate>Mon, 23 Nov 2026 15:24:37 +0000</pubDate>
      <link>https://dev.to/hipangwork/how-to-generate-a-pptx-file-in-python-without-powerpoint-or-office-installed-51fa</link>
      <guid>https://dev.to/hipangwork/how-to-generate-a-pptx-file-in-python-without-powerpoint-or-office-installed-51fa</guid>
      <description>&lt;p&gt;You need slides, and the machine that generates them does not have Office. Three&lt;br&gt;
approaches work, and the differences only show up when someone opens the file in WPS&lt;br&gt;
or edits a text box.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why not just export images or PDF
&lt;/h2&gt;

&lt;p&gt;The most common shortcut is rendering slides to PNG and wrapping them in a deck. It&lt;br&gt;
looks fine in a screenshot and fails immediately in use: the recipient cannot edit a&lt;br&gt;
single word, and the first request in any real handoff is "can you change the title".&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;.pptx&lt;/code&gt; is a zip of XML parts. Anything that produces a real one keeps the deck&lt;br&gt;
editable, and that is the only property worth optimising for first.&lt;/p&gt;
&lt;h2&gt;
  
  
  Approach 1: python-pptx (start here)
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pptx&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Presentation&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pptx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;util&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Inches&lt;/span&gt;

&lt;span class="n"&gt;prs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Presentation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                 &lt;span class="c1"&gt;# default template is 4:3 — see pitfalls&lt;/span&gt;
&lt;span class="n"&gt;prs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slide_width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Inches&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;13.333&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;     &lt;span class="c1"&gt;# 16:9&lt;/span&gt;
&lt;span class="n"&gt;prs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slide_height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Inches&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;7.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;slide&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;prs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slides&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_slide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slide_layouts&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="c1"&gt;# Title and Content&lt;/span&gt;
&lt;span class="n"&gt;slide&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shapes&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="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Q3 review"&lt;/span&gt;
&lt;span class="n"&gt;frame&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;slide&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;placeholders&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="n"&gt;text_frame&lt;/span&gt;
&lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Revenue up 12%"&lt;/span&gt;
&lt;span class="n"&gt;bullet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_paragraph&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;bullet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Churn down to 1.8%"&lt;/span&gt;
&lt;span class="n"&gt;bullet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;level&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;prs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"out.pptx"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That is a valid, editable deck. &lt;code&gt;python-pptx&lt;/code&gt; handles the relationship graph, content&lt;br&gt;
types and layout inheritance for you, and it is the right answer for 90% of cases —&lt;br&gt;
including charts, tables and images.&lt;/p&gt;

&lt;p&gt;The reason to keep looking is styling: you inherit whatever the template gives you,&lt;br&gt;
and fine-grained control means dropping into the XML anyway.&lt;/p&gt;
&lt;h2&gt;
  
  
  Approach 2: template substitution (best for branded decks)
&lt;/h2&gt;

&lt;p&gt;If the deck must match a company template, do not rebuild it — open it and replace text.&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;from&lt;/span&gt; &lt;span class="n"&gt;pptx&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Presentation&lt;/span&gt;

&lt;span class="n"&gt;prs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Presentation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"brand-template.pptx"&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;slide&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;prs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;slides&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;shape&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;slide&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shapes&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;shape&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;has_text_frame&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="s2"&gt;"{{TITLE}}"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text_frame&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="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text_frame&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text_frame&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="nf"&gt;replace&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;title&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;prs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"out.pptx"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps fonts, colours, master slides and footers exactly as designed, and it is&lt;br&gt;
the approach I would pick for anything customer-facing. The cost is that every layout&lt;br&gt;
you need has to exist in the template first.&lt;/p&gt;
&lt;h2&gt;
  
  
  Approach 3: raw OOXML
&lt;/h2&gt;

&lt;p&gt;Writing the zip yourself is worth it when you need deterministic output (no library&lt;br&gt;
version drift), or you are already generating layout geometry from a data model.&lt;/p&gt;

&lt;p&gt;A minimal deck that PowerPoint will open needs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Content_Types].xml
_rels/.rels
ppt/presentation.xml
ppt/_rels/presentation.xml.rels
ppt/slideMasters/slideMaster1.xml  (+ .rels)
ppt/slideLayouts/slideLayout1.xml  (+ .rels)
ppt/slides/slide1.xml              (+ .rels)
ppt/theme/theme1.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Miss the master or the theme and you get a repair prompt, not an error message. That&lt;br&gt;
is the whole difficulty of this route: failures are silent until a human opens the file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Situation&lt;/th&gt;
&lt;th&gt;Use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;One-off reports, charts, tables&lt;/td&gt;
&lt;td&gt;python-pptx&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Must match a corporate template&lt;/td&gt;
&lt;td&gt;template substitution&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Thousands of decks, stable output required&lt;/td&gt;
&lt;td&gt;raw OOXML&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Need pixel-perfect typography control&lt;/td&gt;
&lt;td&gt;raw OOXML, or accept the template's&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Six things that actually break
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The default template is 4:3.&lt;/strong&gt; &lt;code&gt;Presentation()&lt;/code&gt; gives you 10x7.5 inches. Set both
&lt;code&gt;slide_width&lt;/code&gt; and &lt;code&gt;slide_height&lt;/code&gt; before adding slides.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;slide.placeholders[1]&lt;/code&gt; is the placeholder &lt;code&gt;idx&lt;/code&gt;, not its position&lt;/strong&gt; in the shapes
list. Templates reuse &lt;code&gt;idx&lt;/code&gt; across layouts, so hard-coded indices break when the
layout changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Theme colours are references, not values.&lt;/strong&gt; A slide stores &lt;code&gt;schemeClr val="accent1"&lt;/code&gt;,
not &lt;code&gt;#2F5597&lt;/code&gt;. Changing a theme means changing the palette, not rewriting every shape.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Setting &lt;code&gt;font.name&lt;/code&gt; does not touch CJK text.&lt;/strong&gt; That writes &lt;code&gt;&amp;lt;a:latin&amp;gt;&lt;/code&gt;. Chinese and
Japanese need &lt;code&gt;&amp;lt;a:ea&amp;gt;&lt;/code&gt; as well:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;   &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;lxml&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;etree&lt;/span&gt;
   &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pptx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;oxml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ns&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;qn&lt;/span&gt;

   &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;set_east_asian_font&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;typeface&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
       &lt;span class="n"&gt;rPr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;font&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_rPr&lt;/span&gt;
       &lt;span class="n"&gt;ea&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rPr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;qn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"a:ea"&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="n"&gt;ea&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
           &lt;span class="n"&gt;ea&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;etree&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SubElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rPr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;qn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"a:ea"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
       &lt;span class="n"&gt;ea&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"typeface"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;typeface&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Images must be embedded and registered.&lt;/strong&gt; &lt;code&gt;add_picture()&lt;/code&gt; does both; if you write
XML by hand, the image goes into &lt;code&gt;ppt/media/&lt;/code&gt; &lt;em&gt;and&lt;/em&gt; needs an entry in the slide's
&lt;code&gt;.rels&lt;/code&gt; plus a matching content type. Copying the file in is not enough.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test in the three renderers people actually use.&lt;/strong&gt; PowerPoint, WPS Office and
LibreOffice disagree about spacing and font fallback. A deck that looks right in one
can overflow in another — check the longest line you generate, not the average one.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The part I would steal
&lt;/h2&gt;

&lt;p&gt;Generate the outline as structured data first, and treat slide rendering as a pure&lt;br&gt;
function of that data. Text edits then cost milliseconds, while regeneration costs&lt;br&gt;
seconds and can come back different in ways you did not ask for.&lt;/p&gt;

&lt;p&gt;I build offline Windows tools, including one that does exactly this for decks — the&lt;br&gt;
outline stays editable, the renderer never surprises you. Happy to compare notes on&lt;br&gt;
OOXML layout inheritance if you have fought it too.&lt;/p&gt;

</description>
      <category>python</category>
      <category>tutorial</category>
      <category>ooxml</category>
      <category>pptx</category>
    </item>
    <item>
      <title>Running speech-to-text on the laptop: what actually breaks</title>
      <dc:creator>hipangwork</dc:creator>
      <pubDate>Mon, 23 Nov 2026 14:58:22 +0000</pubDate>
      <link>https://dev.to/hipangwork/running-speech-to-text-on-the-laptop-what-actually-breaks-fhh</link>
      <guid>https://dev.to/hipangwork/running-speech-to-text-on-the-laptop-what-actually-breaks-fhh</guid>
      <description>&lt;p&gt;Most meeting-notes tools start with an upload. You record, the file goes to&lt;br&gt;
someone's bucket, and a few seconds later a transcript comes back. For a lot of&lt;br&gt;
teams that is fine. For anyone under an NDA it is the end of the conversation:&lt;br&gt;
legal says no, and you never get to compare summary quality.&lt;/p&gt;

&lt;p&gt;So I built the other version — everything on the machine that recorded the audio — and&lt;br&gt;
this post is about the three parts that were harder than I expected.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Speaker separation without a cloud model
&lt;/h2&gt;

&lt;p&gt;Cloud services do diarization on a GPU cluster with generous memory. On a laptop you have&lt;br&gt;
one CPU, a few hundred MB of RAM for the model, and a hard real-time budget: if the&lt;br&gt;
transcript falls behind the speaker, the tool is useless.&lt;/p&gt;

&lt;p&gt;The approach that worked was voiceprint clustering on rolling windows rather than&lt;br&gt;
end-to-end neural diarization. It is less accurate on overlapping speech, and I will say&lt;br&gt;
that plainly: two people talking at once will sometimes collapse into one speaker. But it&lt;br&gt;
runs in real time on a four-core laptop, which the accurate version does not.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Hotwords are not a nice-to-have
&lt;/h2&gt;

&lt;p&gt;Generic ASR gets the sentence right and the proper nouns wrong. A meeting about&lt;br&gt;
"Q3 migration to Kafka" comes back as "Q3 migration to coffee". Once project names are&lt;br&gt;
wrong, the summary is wrong, and the summary is the only part anyone reads.&lt;/p&gt;

&lt;p&gt;So the model takes a per-project hotword list, and the decoder biases toward it. This is&lt;br&gt;
a small feature that changed how usable the output was more than any model upgrade.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The offline constraint changes the summary step
&lt;/h2&gt;

&lt;p&gt;The transcript is only half the product. The other half is turning it into minutes, and&lt;br&gt;
that means a language model. Running a summarizer locally means a small model, which&lt;br&gt;
means you cannot ask it to "write good minutes" and expect a good result.&lt;/p&gt;

&lt;p&gt;The fix was to stop asking for prose and start asking for structure: eight templates&lt;br&gt;
(standup, decision log, client call, retro...) where each one defines the sections it&lt;br&gt;
wants. The model fills fields instead of writing essays. Small models are bad at essays&lt;br&gt;
and surprisingly decent at filling fields.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this costs you
&lt;/h2&gt;

&lt;p&gt;Being local has a price, and pretending otherwise would be dishonest:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It uses your CPU while it runs. On an older laptop, a one-hour recording is not instant.&lt;/li&gt;
&lt;li&gt;There is no shared workspace. Handing minutes to a colleague means sending a file.&lt;/li&gt;
&lt;li&gt;No mobile app, no browser tab, no "join the meeting for me".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your team lives in a shared cloud workspace, a cloud tool is the right answer. The&lt;br&gt;
local version is for the case where the recording cannot leave the machine in the first&lt;br&gt;
place.&lt;/p&gt;

&lt;h2&gt;
  
  
  Numbers, since claims are cheap
&lt;/h2&gt;

&lt;p&gt;Installer is 30.5MB. It runs on Windows 10/11 with no account and no network after&lt;br&gt;
install. The site publishes SHA256 checksums because the installer is not code-signed —&lt;br&gt;
SmartScreen will warn you, and you should verify rather than trust.&lt;/p&gt;

&lt;p&gt;There is a longer write-up and the download here, if you want to try it:&lt;br&gt;
&lt;a href="https://tools.hipangwork.online/tool/783eb85403" rel="noopener noreferrer"&gt;https://tools.hipangwork.online/tool/783eb85403&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are building something similar, the part I would steal is the template idea:&lt;br&gt;
constrain the model's output shape before you tune its size.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I build offline Windows tools; this post is about the engineering, not a launch. Happy to&lt;br&gt;
answer questions about the diarization trade-off in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>privacy</category>
      <category>ai</category>
      <category>productivity</category>
      <category>windows</category>
    </item>
    <item>
      <title>Generating PPTX on a laptop: outline first, slides second</title>
      <dc:creator>hipangwork</dc:creator>
      <pubDate>Mon, 23 Nov 2026 14:58:20 +0000</pubDate>
      <link>https://dev.to/hipangwork/generating-pptx-on-a-laptop-outline-first-slides-second-26g4</link>
      <guid>https://dev.to/hipangwork/generating-pptx-on-a-laptop-outline-first-slides-second-26g4</guid>
      <description>&lt;p&gt;Every "text to slides" tool demos the same way: paste a paragraph, wait, and a&lt;br&gt;
polished deck appears. The demo is convincing. The second use is where it falls apart —&lt;br&gt;
the structure is wrong, and because the tool went straight from text to styled slides,&lt;br&gt;
fixing the structure means regenerating the whole thing and hoping for a better roll.&lt;/p&gt;

&lt;p&gt;I built a local version with one deliberate difference: the outline is an editable&lt;br&gt;
artifact, and slides are rendered only after you approve it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why outline-first is not just UX polish
&lt;/h2&gt;

&lt;p&gt;A deck has two independent failure modes: wrong structure and wrong styling. If a tool&lt;br&gt;
collapses both into one generation step, you cannot fix one without re-rolling the other.&lt;br&gt;
Separating them turns a lottery into an edit:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Paste source material, set a page count.&lt;/li&gt;
&lt;li&gt;The tool drafts a structured outline (title + bullets per slide).&lt;/li&gt;
&lt;li&gt;You edit the outline — reorder, cut, rewrite. This is plain text editing, fast.&lt;/li&gt;
&lt;li&gt;Pick a colour theme, render.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The important part is step 3 being cheap. Text editing costs seconds; regeneration costs&lt;br&gt;
minutes and may come back different in ways you did not ask for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rendering PPTX without PowerPoint
&lt;/h2&gt;

&lt;p&gt;The output has to be a real &lt;code&gt;.pptx&lt;/code&gt; — people will open it in PowerPoint, WPS or LibreOffice&lt;br&gt;
and edit it. That rules out exporting images or a PDF-like format.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;.pptx&lt;/code&gt; is an OOXML zip: slide XML parts, a layout tree, theme colours, and a&lt;br&gt;
relationship graph. Writing it directly means owning the messy parts — placeholder indices,&lt;br&gt;
master/layout inheritance, and the fact that a theme's accent colours are referenced by&lt;br&gt;
index rather than value, so swapping a theme means rewriting references rather than colours.&lt;/p&gt;

&lt;p&gt;The payoff is a file that behaves like a normal deck: 16:9, editable text, real theme&lt;br&gt;
colours. Anything less gets noticed in the first minute of a client meeting.&lt;/p&gt;

&lt;h2&gt;
  
  
  The offline trade-off, stated honestly
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It uses local CPU, so a long document is not instant.&lt;/li&gt;
&lt;li&gt;It has no web collaboration; the deck is a file you send.&lt;/li&gt;
&lt;li&gt;Small local models are weaker at narrative than large cloud models. The template and
outline structure exist partly to compensate.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I would tell someone building this
&lt;/h2&gt;

&lt;p&gt;Do not start with the renderer. Start with the outline schema, because that is the contract&lt;br&gt;
between the model and the file format, and it is the part you will change most often.&lt;br&gt;
Getting the renderer right is a week of OOXML pain; getting the outline schema right is&lt;br&gt;
what decides whether the tool is usable the second time.&lt;/p&gt;

&lt;p&gt;Details and download (Windows, 58.4MB, no account): &lt;br&gt;
&lt;a href="https://tools.hipangwork.online/tool/a5195a959a" rel="noopener noreferrer"&gt;https://tools.hipangwork.online/tool/a5195a959a&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I build offline Windows tools. If you have fought OOXML layout inheritance, I would like&lt;br&gt;
to hear how you handled theme colour indices.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>ai</category>
      <category>windows</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
