<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <updated>2026-10-16T11:16:43Z</updated>
  <generator>https://njump.me</generator>

  <title>Nostr notes by Alex Chan (Unofficial)</title>
  <author>
    <name>Alex Chan (Unofficial)</name>
  </author>
  <link rel="self" type="application/atom+xml" href="https://njump.me/npub1zcvvdd0vj8nex732zyemhjhtaegg9kpjl2nln3qnvuelddu2t9pqmt5nqv.rss" />
  <link href="https://njump.me/npub1zcvvdd0vj8nex732zyemhjhtaegg9kpjl2nln3qnvuelddu2t9pqmt5nqv" />
  <id>https://njump.me/npub1zcvvdd0vj8nex732zyemhjhtaegg9kpjl2nln3qnvuelddu2t9pqmt5nqv</id>
  <icon>https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/1f58b.png</icon>
  <logo>https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/1f58b.png</logo>




  <entry>
    <id>https://njump.me/nevent1qqs8m8yumv8yn5wv7dkmrwtdk2dvy9fekg9002eu03zffasug3xjy7szyqtp3344ajg70ym69ggn8w72a0h9pqkcxta207wyzdnn8a4h3fv5yg454kc</id>
    
      <title type="html">Verifying my web archives with Playwright To protect against link ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqs8m8yumv8yn5wv7dkmrwtdk2dvy9fekg9002eu03zffasug3xjy7szyqtp3344ajg70ym69ggn8w72a0h9pqkcxta207wyzdnn8a4h3fv5yg454kc" />
    <content type="html">
      Verifying my web archives with Playwright&lt;br/&gt;&lt;br/&gt;To protect against link rot and disappearing content, I save local copies of web pages I like into my web archive.&lt;br/&gt;Ideally, this archive is completely self-contained.&lt;br/&gt;I want a local copy of each page’s HTML and all the assets it depends on (CSS, images, scripts, and so on).&lt;br/&gt;I don’t want my archived pages fetching resources from the original website, which could disappear at any time.&lt;br/&gt;Initially, I was verifying self-containedness by hand.&lt;br/&gt;I’d open each saved page in a web browser, and check the browser dev tools.&lt;br/&gt;I’d check the Console tab for errors and failed requests, and watch the Network tab for requests going out to the internet.&lt;br/&gt;That approach was tedious and error-prone, and I wanted something better.&lt;br/&gt;I now automate the process using Playwright, a testing framework that allows you to control web browsers.&lt;br/&gt;I open each page using Playwright, and check if it’s making external requests.&lt;br/&gt;Detecting external requests in Playwright&lt;br/&gt;When you open a page in Playwright, you can subscribe to request events which tell you when the page issues a request.&lt;br/&gt;In this Python snippet, we start Playwright, start a WebKit browser, and open a new page.&lt;br/&gt;We tell the page to append external requests to a list, and then load example.com.&lt;br/&gt;We see that example.com makes two requests on page load: one for &lt;a href=&#34;https://example.com&#34;&gt;https://example.com&lt;/a&gt;, and one for a JavaScript file.&lt;br/&gt;from contextlib import closing&lt;br/&gt;from playwright.sync_api import sync_playwright&lt;br/&gt;with (&lt;br/&gt;sync_playwright() as p,&lt;br/&gt;closing(p.webkit.launch()) as browser,&lt;br/&gt;closing(browser.new_page()) as page,&lt;br/&gt;):&lt;br/&gt;requests = []&lt;br/&gt;page.on(&amp;#34;request&amp;#34;, lambda msg: requests.append(msg))&lt;br/&gt;page.goto(&amp;#34;&lt;a href=&#34;https://example.com&amp;#34&#34;&gt;https://example.com&amp;#34&lt;/a&gt;;)&lt;br/&gt;print(&amp;#34;requests:&amp;#34;, requests)&lt;br/&gt;# requests: [&amp;lt;Request url=&amp;#39;&lt;a href=&#34;https://example.com/&amp;#39&#34;&gt;https://example.com/&amp;#39&lt;/a&gt;; method=&amp;#39;GET&amp;#39;&amp;gt;,&lt;br/&gt;# &amp;lt;Request url=&amp;#39;&lt;a href=&#34;https://example.com/s.js&amp;#39&#34;&gt;https://example.com/s.js&amp;#39&lt;/a&gt;; method=&amp;#39;GET&amp;#39;&amp;gt;]&lt;br/&gt;In a more complex scenario, we might use Playwright to interact with the page after loading – for example, clicking a button or filling in a form, and then we could see the requests triggered by each action.&lt;br/&gt;Once we have a list of requests made by the page, we can inspect the url property to check if any of them were fetching from an external website.&lt;br/&gt;I wrote a function is_external_request to carry out this check:&lt;br/&gt;from playwright.sync_api import Request&lt;br/&gt;import urllib.parse&lt;br/&gt;def is_external_request(req: Request, original_url: str) -&amp;gt; bool:&lt;br/&gt;&amp;#34;&amp;#34;&amp;#34;&lt;br/&gt;Check if a request has a different origin than the original URL.&lt;br/&gt;A request is considered internal if:&lt;br/&gt;- it matches the original URL exactly&lt;br/&gt;- it has the same scheme, host, and port as the original URL&lt;br/&gt;- it uses a `blob:` scheme (for example, in-memory media representations)&lt;br/&gt;&amp;#34;&amp;#34;&amp;#34;&lt;br/&gt;if req.url == original_url:&lt;br/&gt;return False&lt;br/&gt;# Compare the scheme/host of the request to that of the original URL.&lt;br/&gt;org_url = urllib.parse.urlsplit(original_url)&lt;br/&gt;req_url = urllib.parse.urlsplit(req.url)&lt;br/&gt;if org_url.scheme == req_url.scheme and org_url.netloc == req_url.netloc:&lt;br/&gt;return False&lt;br/&gt;# Ignore blob: URLs, which are in-memory representation of some data,&lt;br/&gt;# and not an external request.&lt;br/&gt;#&lt;br/&gt;# Playwright detects blob: URLs when loading media files; for example&lt;br/&gt;# using the &amp;lt;audio&amp;gt; or &amp;lt;video&amp;gt; tag.&lt;br/&gt;if req_url.scheme == &amp;#34;blob&amp;#34;:&lt;br/&gt;return False&lt;br/&gt;# Fail open: if we can&amp;#39;t decide if a request was internal or external,&lt;br/&gt;# assume it was external.&lt;br/&gt;return True&lt;br/&gt;assert_page_is_self_contained(ctx, url)&lt;br/&gt;I’ve wrapped these two steps in a function assert_page_is_self_contained(ctx, url), which is part of my chives utility library.&lt;br/&gt;The function takes a Playwright Browser (or BrowserContext) and a URL, then:&lt;br/&gt;Opens a new page in the browser&lt;br/&gt;Loads the URL in the page&lt;br/&gt;Checks what happened when the page completes loading&lt;br/&gt;It throws an exception if there are any:&lt;br/&gt;Uncaught page exceptions or errors&lt;br/&gt;Console warnings or errors&lt;br/&gt;Non-GET requests&lt;br/&gt;Requests targeting external resources&lt;br/&gt;The function tries to trigger important network requests that might be skipped on the initial page load.&lt;br/&gt;For example, it evaluates the body’s offsetHeight to force a synchronous reflow, which causes the browser to request any lazily loaded images or fonts that might otherwise be missed.&lt;br/&gt;Here’s an example which verifies a file example.html from the working directory:&lt;br/&gt;from chives.browser_fixtures import assert_page_is_self_contained, file_uri&lt;br/&gt;from contextlib import closing&lt;br/&gt;from playwright.sync_api import sync_playwright&lt;br/&gt;with (&lt;br/&gt;sync_playwright() as p,&lt;br/&gt;closing(p.webkit.launch()) as browser,&lt;br/&gt;):&lt;br/&gt;assert_page_is_self_contained(browser, url=file_uri(&amp;#34;example.html&amp;#34;))&lt;br/&gt;I originally passed a Page as the first argument, but changing the function to take a Browser or BrowserContext lets it manage its own pages.&lt;br/&gt;It gets a fresh page for every verification, and closes it when it’s done.&lt;br/&gt;(The first time I ran this, I created a new page for every verification, and never closed them – my computer ground to a crawl as my script opened hundreds of browser tabs.)&lt;br/&gt;If you create a new context, you can emulate different browser settings, like location, locale, and window size.&lt;br/&gt;Here’s an example where we use contexts to test the same page in light/dark mode:&lt;br/&gt;with (&lt;br/&gt;sync_playwright() as p,&lt;br/&gt;closing(p.webkit.launch()) as browser,&lt;br/&gt;):&lt;br/&gt;with closing(browser.new_context(color_scheme=&amp;#34;light&amp;#34;)) as light_ctx:&lt;br/&gt;assert_page_is_self_contained(light_ctx, url=file_uri(&amp;#34;example.html&amp;#34;))&lt;br/&gt;with closing(browser.new_context(color_scheme=&amp;#34;dark&amp;#34;)) as dark_ctx:&lt;br/&gt;assert_page_is_self_contained(dark_ctx, url=file_uri(&amp;#34;example.html&amp;#34;))&lt;br/&gt;In my web archive, I check every page in light/dark mode, and at 1×/2× pixel densities.&lt;br/&gt;It takes at least a second to run each verification, so I cache the results.&lt;br/&gt;As I save new pages, they’re added to a verification queue, and I’m warned of any missing assets.&lt;br/&gt;Unsurprisingly, the first run flagged many missing fonts and images, which I added to my local archive.&lt;br/&gt;Every saved page now passes cleanly.&lt;br/&gt;Browser is best-effort, but may still miss things&lt;br/&gt;Even with automated testing, it’s difficult to guarantee a completely self-contained archive.&lt;br/&gt;Different instances of a browser might load different assets, and a single page load might miss different variations:&lt;br/&gt;Responsive images – web pages can offer different sizes of an image, and the browser chooses a specific size based on the current window dimensions&lt;br/&gt;Appearance settings – a browser might load different fonts or images depending on light/dark mode&lt;br/&gt;Interaction-dependent assets – a web page might have assets that are only required on hover or user action&lt;br/&gt;You can mitigate some of this by testing with multiple contexts or adding post-load interactions, but every step makes the process take longer.&lt;br/&gt;Fortunately, most of the pages I save are simple, blog-style pages where I’ve stripped out the JavaScript.&lt;br/&gt;For my specific use case, initial load verification is more than good enough.&lt;br/&gt;Other uses for this code&lt;br/&gt;There are other projects where it could be useful to intercept and audit the requests made by a web page:&lt;br/&gt;Verifying your Content Security Policy (CSP).&lt;br/&gt;The CSP header restricts what resources can be loaded by a web page, and you could check that your configuration has the correct effect.&lt;br/&gt;Auditing login screens.&lt;br/&gt;You could check that sensitive pages don’t load any external scripts, which mitigates the risk of credential theft via a compromised third-party.&lt;br/&gt;Testing analytics and tracking.&lt;br/&gt;You could script user flows, like a shopping cart checkout, and confirm that tracking events fire correctly.&lt;br/&gt;I don’t do much front-end web development, but Playwright has become a key tool in my toolbox.&lt;br/&gt;I read a lot about people using AI agents and MCPs to interact with websites, but I prefer Playwright.&lt;br/&gt;It’s more fiddly and requires explicit instructions, but it’s constrained, deterministic, and I never have to worry about it doing something unexpected.&lt;br/&gt;[If the formatting of this post looks odd in your feed reader, visit the original article]&lt;br/&gt;&lt;br/&gt;&lt;a href=&#34;https://alexwlchan.net/2026/verifying-web-archives/&#34;&gt;https://alexwlchan.net/2026/verifying-web-archives/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#playwright #web #check #false #verifying&lt;br/&gt;&lt;br/&gt;#rss #feeds #linksharing #qwibbit
    </content>
    <updated>2026-11-02T04:02:40Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqstn3tjl7t5869kfhv8lvacv9h2m0tgyr8d33cgp3z2xj2xsa73ztczyqtp3344ajg70ym69ggn8w72a0h9pqkcxta207wyzdnn8a4h3fv5yyeu7u7</id>
    
      <title type="html">gobench: a tool for comparing Go benchmark runs across branches ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqstn3tjl7t5869kfhv8lvacv9h2m0tgyr8d33cgp3z2xj2xsa73ztczyqtp3344ajg70ym69ggn8w72a0h9pqkcxta207wyzdnn8a4h3fv5yyeu7u7" />
    <content type="html">
      gobench: a tool for comparing Go benchmark runs across branches&lt;br/&gt;&lt;br/&gt;I’ve recently joined a new team that’s focused on performance, stability, and scalability – a change from my previous projects, where traffic was low enough that performance was rarely a concern.&lt;br/&gt;This codebase has already gone through multiple rounds of optimisation, so there’s no low-hanging fruit left.&lt;br/&gt;Any proposed change is inherently complex, and it’s rarely obvious whether a tweak will actually speed things up or slow them down.&lt;br/&gt;To measure the impact of our work, we’re leaning on the benchmarking tools in Go’s standard library.&lt;br/&gt;On one of my recent pull requests, I wrote a benchmark, and I pasted the output from two before/after runs.&lt;br/&gt;Paul improved this with a short shell script that ran multiple samples, and compared the results with the benchstat command.&lt;br/&gt;$ for N in {1..6}; do for C in 613000c fc12d4c; do echo $N: $C; git checkout -q $C &amp;amp;&amp;amp; ./tool/go test -run=^X -bench=BenchmarkPostureAnalyzer ./control/posture/analysis/ | tee -a bench-$C.txt; done; done&lt;br/&gt;$ benchstat bench-fc12d4c.txt bench-613000c.txt&lt;br/&gt;benchstat does statistical analysis on the output from multiple go test -bench=... runs, which is more reliable and easier to read than the raw output.&lt;br/&gt;In particular, it puts all the data in a single table, and shows the percentage change against the baseline.&lt;br/&gt;I like this script, but it’s a little fiddly.&lt;br/&gt;I have to identify the two commits to compare, it leaves text files in my working directory, and it leaves my repo in a detached head state when it’s done.&lt;br/&gt;I wanted something more ergonomic.&lt;br/&gt;I’ve written a new tool gobench to give me a smoother experience.&lt;br/&gt;I check out my feature branch, run gobench with the arguments I’d pass to go test, and it prints the final analysis from benchstat.&lt;br/&gt;Under the hood, it creates a Git work tree for the base branch (leaving my working directory as-is), captures the benchmark output in memory (so there are no extra text files), and does an alternating sample of benchmarks.&lt;br/&gt;The alternating samples is a feature I really like from Paul’s original script.&lt;br/&gt;I run benchmarks on my laptop rather than a dedicated workstation, and the benchmarks could be sensitive to thermal throttling, background processes, or other things happening on my computer.&lt;br/&gt;Alternating between the two branches reduces the effect of this noise.&lt;br/&gt;Let’s look at an example.&lt;br/&gt;Suppose my main branch has a recursive implementation of Fibonacci numbers, while my feature branch has an iterative approach.&lt;br/&gt;Unsurprisingly, the iterative approach is faster, and gobench makes it easy to quantify the improvement.&lt;br/&gt;$ go run ./cmd/gobench ./example/fib/ -bench=BenchmarkFib&lt;br/&gt;Setting up temporary worktree for main (8f2351d)...&lt;br/&gt;Running 6 alternating samples...&lt;br/&gt;100% |█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| (12/12, 42 it/min)&lt;br/&gt;== Benchmark results ==&lt;br/&gt;goos: darwin&lt;br/&gt;goarch: arm64&lt;br/&gt;pkg: alexwlchan.net/projects/gotools/example/fib&lt;br/&gt;cpu: Apple M4 Pro&lt;br/&gt;│ main (8f2351d) │ faster-fib (0969b03) │&lt;br/&gt;│ sec/op │ sec/op vs base │&lt;br/&gt;Fib-12 14572.500n ± 6% 5.455n ± 2% -99.96% (p=0.002 n=6)&lt;br/&gt;My first version of gobench was an expansion of Paul’s script, but as I started adding features, it became clear that Bash was the wrong tool.&lt;br/&gt;I rewrote it as a Go tool that shells out to git, go test, and benchstat.&lt;br/&gt;If you’d like to try gobench yourself, the code is available in my gotools repository, or you can install it with:&lt;br/&gt;$ go install alexwlchan.net/projects/gotools/cmd/gobench@latest&lt;br/&gt;gobench has already saved me from shipping code that looked fast on paper but regressed in practice.&lt;br/&gt;As I keep working on performance-critical Go code, having low-friction benchmarks will make it easier to test my ideas early and often.&lt;br/&gt;[If the formatting of this post looks odd in your feed reader, visit the original article]&lt;br/&gt;&lt;br/&gt;&lt;a href=&#34;https://alexwlchan.net/2026/gobench/&#34;&gt;https://alexwlchan.net/2026/gobench/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#rss #feeds #linksharing #qwibbit
    </content>
    <updated>2026-11-02T02:50:59Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsr394czhsmpn5fjkkphuzdey73rzghvau9palyjmkpd7df77me6aqzyqtp3344ajg70ym69ggn8w72a0h9pqkcxta207wyzdnn8a4h3fv5y8c0duz</id>
    
      <title type="html">Positive alerts in Prometheus At work, we use Prometheus to ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsr394czhsmpn5fjkkphuzdey73rzghvau9palyjmkpd7df77me6aqzyqtp3344ajg70ym69ggn8w72a0h9pqkcxta207wyzdnn8a4h3fv5y8c0duz" />
    <content type="html">
      Positive alerts in Prometheus&lt;br/&gt;&lt;br/&gt;At work, we use Prometheus to monitor our services.&lt;br/&gt;Every few seconds, Prometheus scrapes a /metrics endpoint and records the data in a time series database.&lt;br/&gt;The metrics are then used to trigger alerts when services aren’t behaving correctly.&lt;br/&gt;Recently we had a flapping alert where an overloaded service was intermittently failing.&lt;br/&gt;We wanted to silence/adjust the alert until we could fix the service, to avoid alert fatigue, but it would be easy to forget to revert the adjustment once the service was fixed.&lt;br/&gt;We solved this using a “positive alert” that would tell us when the service was consistently passing the original alert – that is, when it was no longer flapping.&lt;br/&gt;Let’s walk through an example.&lt;br/&gt;One of our alerts checks that Prometheus can successfully scrape our services, which you can check with the automatically generated up time series.&lt;br/&gt;A successful scrape gets a 1, a failed scrape gets a 0.&lt;br/&gt;Here’s an alert that warns if more than 5% of scrapes fail within a half hour window:&lt;br/&gt;groups:&lt;br/&gt;- name: services&lt;br/&gt;rules:&lt;br/&gt;- alert: PrometheusTargetIntermittentlyDown&lt;br/&gt;expr: avg_over_time(up[30m]) &amp;lt; 0.95&lt;br/&gt;for: 1h&lt;br/&gt;labels:&lt;br/&gt;severity: warning&lt;br/&gt;annotations:&lt;br/&gt;summary: Prometheus is struggling to scrape metrics from this service.&lt;br/&gt;One of our services was struggling to serve the /metrics endpoint that Prometheus scrapes.&lt;br/&gt;When the service had a lot of work in its queue, the worker thread would starve the web server and the metrics request would fail.&lt;br/&gt;The scrape rate would dip below 95%, the alert would fire, then the service would empty its queue and the rate would recover, the alert would clear, and so we went round and round.&lt;br/&gt;Dozens of notifications which were nothing but noise.&lt;br/&gt;We use Alertmanager Silences when we want to pause an alert for a short period, but it wasn’t clear if or when we’d be able to fix this service.&lt;br/&gt;If the silence expired before the problem was fixed, the noise would return.&lt;br/&gt;If the problem was fixed before the silence expired, we could unknowingly regress the fix.&lt;br/&gt;Instead, we modified the alert to exclude the overloaded service, then added a “positive alert” to tell us if the service had more than 95% uptime for a fortnight:&lt;br/&gt;groups:&lt;br/&gt;- name: services&lt;br/&gt;rules:&lt;br/&gt;- alert: PrometheusTargetIntermittentlyDown&lt;br/&gt;expr: avg_over_time(up{instance!=&amp;#34;overloaded_service&amp;#34;}[30m]) &amp;lt; 0.95&lt;br/&gt;for: 1h&lt;br/&gt;labels:&lt;br/&gt;severity: warning&lt;br/&gt;annotations:&lt;br/&gt;summary: Prometheus is struggling to scrape metrics from this service.&lt;br/&gt;- alert: PrometheusTargetUpAvg&lt;br/&gt;expr: avg_over_time(up{instance=&amp;#34;overloaded_service&amp;#34;}[30m]) &amp;gt;= 0.95&lt;br/&gt;for: 14d&lt;br/&gt;labels:&lt;br/&gt;severity: info&lt;br/&gt;annotations:&lt;br/&gt;summary: This service is no longer overloaded; remove the exception.&lt;br/&gt;This worked exactly as intended.&lt;br/&gt;A few weeks ago, one of my colleagues made changes to improve the overloaded service, and Prometheus was able to crawl it consistently.&lt;br/&gt;The alert fired at the weekend as it ticked over a fortnight of continuous uptime, and we removed the exception.&lt;br/&gt;[If the formatting of this post looks odd in your feed reader, visit the original article]&lt;br/&gt;&lt;br/&gt;&lt;a href=&#34;https://alexwlchan.net/2026/positive-alerts/&#34;&gt;https://alexwlchan.net/2026/positive-alerts/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;#rss #feeds #linksharing #qwibbit
    </content>
    <updated>2026-10-27T02:41:14Z</updated>
  </entry>

  <entry>
    <id>https://njump.me/nevent1qqsq2uea0fpd4xf6c4cnwha8tc3y3recmzlsnu96xqv4xedun9zkc8szyqtp3344ajg70ym69ggn8w72a0h9pqkcxta207wyzdnn8a4h3fv5ykcp4qj</id>
    
      <title type="html">Organising my cross-stitch patterns I have a lot of digital ...</title>
    
    <link rel="alternate" href="https://njump.me/nevent1qqsq2uea0fpd4xf6c4cnwha8tc3y3recmzlsnu96xqv4xedun9zkc8szyqtp3344ajg70ym69ggn8w72a0h9pqkcxta207wyzdnn8a4h3fv5ykcp4qj" />
    <content type="html">
      Organising my cross-stitch patterns&lt;br/&gt;&lt;br/&gt;I have a lot of digital cross-stitch patterns and until recently they were a mess.&lt;br/&gt;My “collection” was a series of several hundred PDFs, disorganised and spread across my disk.&lt;br/&gt;Recently, I was looking for a pattern and it took me several minutes to find it.&lt;br/&gt;I had a brief moment of panic, thinking that I’d lost it, and the website this pattern came from is long since gone.&lt;br/&gt;Fortunately it did turn up, but it was clear I had to organise my pattern collection.&lt;br/&gt;Some people would use apps like Pattern Keeper or Flosshaven, but I just created another static website on my media drive.&lt;br/&gt;This is what it looks like:&lt;br/&gt;The patterns are arranged in a masonry layout with a preview thumbnail for each pattern, which is normally the first page of the PDF.&lt;br/&gt;If a pattern has multiple files – for example, different files for colour and black-and-white printing – there’s a list of links below the thumbnail.&lt;br/&gt;I can also add a source link to where I bought the pattern, if I want to find more patterns by the same author.&lt;br/&gt;Internally, it’s structured like my other static websites.&lt;br/&gt;The metadata for the patterns is stored in a JavaScript file, and then I have an HTML page which renders that metadata in this visual design.&lt;br/&gt;My pattern collection doesn’t change very often, so I’m adding new files by hand.&lt;br/&gt;There are no sorting or filtering options, because my collection is small enough that they’re unnecessary.&lt;br/&gt;I can scroll through the entire list in less than a minute and find whatever I need.&lt;br/&gt;I’d like to start making my own clothes soon, and I expect to copy this design to store clothing patterns.&lt;br/&gt;This collection now sits alongside my saved bookmarks, podcasts, TV shows, and more.&lt;br/&gt;I can keep all my patterns organised, and I won’t lose them in the depths of my hard drive.&lt;br/&gt;Technical tricks&lt;br/&gt;There are a couple of technical pieces I’m quite pleased with in this process:&lt;br/&gt;Masonry layout.&lt;br/&gt;I love the cascading grid style of a masonry layout, and I think they’re great when you have variable-sized content – like my pattern cards.&lt;br/&gt;I’ve been using them for over a decade; screenshots of my early web apps show my experiments with David Desandro’s Masonry.js library.&lt;br/&gt;Masonry layouts are now a native feature of CSS called “Grid Lanes”, which is simpler and more performant than the JavaScript approach.&lt;br/&gt;I’m excited to use these layouts in even more places.&lt;br/&gt;Thumbnails of PDFs.&lt;br/&gt;Most digital postage patterns are shipped as PDFs, and I’m creating the thumbnail images with my create_thumbnail tool.&lt;br/&gt;I had to extend my tool to support PDFs, which turned out to be straightforward with the pdf_oxide crate.&lt;br/&gt;I’d not come across Oxide before, but it’s a cross-language library for working with PDFs, and I can imagine using it in future.&lt;br/&gt;A coloured stripe for the palette.&lt;br/&gt;In the metadata for each project, I have the complete list of DMC thread colours and the pattern dimensions.&lt;br/&gt;I have a lookup table that converts DMC thread colours to hex codes, and then I’m able to create a linear gradient in CSS to render a coloured stripe of the pattern colours.&lt;br/&gt;Here’s an example from a pattern with four colours:&lt;br/&gt;border-bottom: 12px solid transparent;&lt;br/&gt;border-image: linear-gradient(&lt;br/&gt;to right,&lt;br/&gt;#7a451f 0%,&lt;br/&gt;#7a451f 25%,&lt;br/&gt;#985e33 25%,&lt;br/&gt;#985e33 50%,&lt;br/&gt;#e4bb8e 50%,&lt;br/&gt;#e4bb8e 75%,&lt;br/&gt;#361f0e 75%,&lt;br/&gt;#361f0e 100%&lt;br/&gt;) 1;&lt;br/&gt;Building the HTML, CSS, and JavaScript was very quick – I have notes on how I build my media sites, and I’ve done it plenty of times before.&lt;br/&gt;I threw together the initial prototype in less than 15 minutes.&lt;br/&gt;The longer part was finding all the PDFs scattered across my disk – but now that’s done, and I know exactly where to find my patterns.&lt;br/&gt;[If the formatting of this post looks odd in your feed reader, visit the original article]&lt;br/&gt;&lt;br/&gt;&lt;a href=&#34;https://alexwlchan.net/2026/cross-stitch-patterns/&#34;&gt;https://alexwlchan.net/2026/cross-stitch-patterns/&lt;/a&gt;&lt;br/&gt; &lt;img src=&#34;https://alexwlchan.net/images/2026/cross-stitch-patterns_1x.png&#34;&gt; 
    </content>
    <updated>2026-10-16T02:44:34Z</updated>
  </entry>

</feed>