Full Width [alt+shift+f] Shortcuts [alt+shift+k]
Sign Up [alt+shift+s] Log In [alt+shift+l]
33

Thoughts on Zettelkasten and the slip box

from Jibran’s Perspective [alt+shift+b] in programming

I had a bunch of thoughts yesterday about the Zettelkasten method and how I could use it effectively to manage my knowledge base. I started the day by dumping my thoughts into Logseq. Here they are. These are open questions for now. I plan to investigate this further and try out different iterations to see what works for me. I’ve been in a place before where I used Roam to gather a small number of notes (> 100) but then found all of that to be an unmanageable mess. Issues that I see with this setup With notes spread all over the place how do I find anything to link to? I can’t go through 200 notes every time I add a new one. All notes are in the same “directory”. Because there is no hierarchy, my notes about productivity are in the same place as my notes about data structures & algorithms. This seems unsustainable. There is 1 benefit I see to this. With everything being in the same place, I can find unexpected connections. Unfortunately, that doesn’t work for me because I don’t go through all my existing notes every time I add a new one. I am interested in many things; productivity, parentings, Islam, algorithms, data structures, system design, programming languages. Having everything in one place seems to add to the mess. As I understand, Niklas Luhmann researched 1 topic extensively - social science. It would make sense for him to keep all his notes in 1 place. The reason I’ve heard repeated for not having a hierarchy: It promotes unexpected connections b/w notes A note isn’t tied to a single category. It can live in multiple places Is that a good enough reason to let go of the organization benefits of a hierarchical structure though? It’s much easier to break down browsing notes to find connections if you can “save your place” in your notes. I can look through the notes in 5 folders today, and go through the 5 others later. Notes about the same thing fit differently in different categories. I can take 1 idea and have it fit differently in my notes...
27th Jul 2022

Stay updated

Get a weekly newsletter with the top 5 articles worth reading every week.

More from Jibran’s Perspective

Project 2: Gift cards to Pakistan

I’ve completed a freelance project I was working on for a few months, and have started saying no to new opportunities. It’s time to work on one of my own ideas again. This is part of my plan to start failing more. I’ve decided to build a business sending gift cards to Pakistan - and eventually other countries in that corner of the world. Why? A few years ago I had sent a gift card to a colleague in the UK. I found a number of very good options. They all had websites that inspired confidence, and used robust payment methods (Stripe in my example) that I could trust with my credit card. I recently had to send a gift card to a colleague in Pakistan. I was confident that I would find a bunch of great options; instead I only found one that I could think of trusting with my money. I ended up using their services and the card was delivered, but there were a number of problems I saw: No trust building around card payments. There was no clear mention of which provider they used. I did a bank transfer instead of using a CC. This meant my payment was manually verified and the card was only sent after a few hours. There was no confirmation email about my order. I was worried enough to call their helpline to confirm that my order had gone through. Once they had sent the card (which I also had to confirm via phone), I only got a confirmation email the next day. To get an invoice to expense this, I had to send them an email. I’m still waiting on an invoice. There were multiple colleagues who chipped in on this gift card. I had to collect the money from them and then pay for the card myself. In my previous experience of sending a gift card to the UK, I was able to include my colleagues in the process. They were able to add their contributions directly to the gift card I selected and a card of the total amount was sent to the recipient. Finally, there was no option for the receiver to choose which gift card they wanted. Instead I had to choose for them. There is a “Universal Gift Card” they claim works at all merchants and is the one I got, but redeeming that would be slightly more complicated. Interestingly, my colleague didn’t open the email they received with the gift card because they thought it was a spam/scam/malicious email. Only after I asked if they had received the card did they end up opening it. I know a better user experience exists. I want to bring the same to Pakistan and solve my own problem at the same time. Is there a market for this? I believe so, because: It’s a problem I’ve just faced. I’ve seen my wife having to deal with low-trust companies sending gifts to Pakistan. Gift cards are different, but eventually I could also add the option to send physical gifts to the recipient. I’ve seen my employer deal with this. Recently a baby gift basket arrived 2 months after the baby was born. 🤯 This is a recurring problem. People & companies need to send gift cards on birthdays, weddings, etc. With more companies starting to hire remotely in Pakistan, this could be a valuable service for businesses to subscribe to. Validation? I haven’t found an easy way to validate this idea. There is no community of “people sending gift cards to Pakistan” that I can tap into. That isn’t a cohort I can find in one place. I could make a list of B2B customers; companies that hire remotely in Pakistan. However, I want to start with individual customers - because I’m starting from a place of solving my own problem. It should be possible to pivot to B2B if I don’t find any interest from individual customers. Validation then involves me starting with a blog - suggesting gift cards to send to Pakistan. I’ll use SEO to bring in traffic. If I see enough visitors, I could start building a business. This also means that if/when the actual product launches, I’ll have a distribution channel already working. What if I’m wrong? There’s a very strong possibility that I’m wrong about this idea. That I’ll spend a bunch of time for it to get nowhere, or that I have picked a problem that isn’t very valuable to solve. This is my unique brand of fear of failure. I used to think I didn’t fear failing, because I had already failed many times. Instead, my fear of failure manifests as a fear of picking the wrong thing and wasting time on it. The way I am dealing with this is to realize that if I don’t pick anything - which I have frequently done in the past - I have an exactly 0% chance of succeeding. Just trying something makes that probability > 0%. You miss 100% of the shots you don’t take. Another thing that’s helping me is to time box this idea. I will spend 6 weeks on building the blog and populating it with as much useful content as possible. After that I can spend an hour or two every week to add a few more pieces of content. I can start researching and working on a different idea after the 6 week period and wait for the SEO to have an impact before making a decision to continue or abandon this.

10th Nov 2024 • 86 votes
Failure 1: Django + NextJS Boilerplate

I have failed, and that is exactly what I had hoped for a few months ago in this blog post. This is a good failure. It has taught me things, lessons I can use in the future to avoid failing this way again. But first a bit of context. What did I fail at? In February of 2024 I decide to try my hands on my first “Indie Hacker” hustle, something that would make me money on the internet without having to trade my time for it. A product instead of consultancy services that I usually provide. I had seen a number of people on Twitter (X) rave about how well their bootstrap templates were doing; and I had just gotten out of a consultancy project where I needed to connect a Next.js frontend to a Django backend. I thought it was the perfect project to start my indie hacking journey. I put up a launch post and started working, updating a build log as I went along. I gave myself until 28th March 2024 to finish it. That of course did not happen. Let’s talk about why I failed and what I learned. Episode 1: The one where I don’t understand the meaning of MVP My initial plan was to build a Django+Next.js boilerplate template the provided all of these: the base template that provided a Django backend & Next.js frontend working authentication b/w the backend & frontend Dockerfile that would create the backend & frontend containers for deployment Terraform scripts to setup an infrastructure on AWS Celery + Redis for background task processing TailwindCSS for the frontend (comes mostly for free with Next.js) social auth This looks like something achievable in a week or two of work - but only if you’re working full time on this. I failed to consider that I have a day job and a life. I was barely able to tick of the first two of these deliverables by the time my 6 week deadline came up. As a good friend told me later, I should have focused on the minimum amount of value I could deliver. Just having the first two things on my list be done would have been enough. I couldn’t charge the $20 I had planned for, but I could have charged $1-$5 for just that. And if no one was interested in spending the cost of a coffee on the MVP of the template, that would have been a good signal that this wasn’t going anywhere in it’s current shape. Instead, by focusing on building something much bigger, I robbed myself of the ability to validate the idea quickly. I spent all my available time coding the template instead of trying to talk to potential customers about it. Lesson 1: Scope down aggressively. Episode 2: Where I jumped on the hype-wagon I settled on building a boilerplate template because that’s what I had seen a lot of people on Twitter/X doing lately; I’m chalking this down to recency bias. I had no personal interest in a boilerplate template. It’s also not a product that I would personally use. I have so far made one project that uses this tech stack. Most of my other projects are Django, and Ruby on Rails. The most successful boilerplate templates I come across are from people who made a bunch of projects in 1 tech stack then realized they needed to do the same thing over-and-over again; which they then packaged into a template they could use. Selling to others was a bonus at first I guess. I was very enthusiastic about the project at the start, but as time went on I had to force myself to work on it. My lack of interest in this type of project was a big factor. Another factor was there being no way to see the fruits of my labor. I am currently working on an analytics dashboard for another client (a RoR project) and every time I build a feature, I love to play around with it in my free time. I test how it works, make sure the UX is a good one, and just play around and admire the app I’ve made. Without me using my template to build new projects, I lacked that feedback loop. Without the loop, I quickly lost interest. Lesson 2: Build something I can use myself. This isn’t a job I’m getting paid for, so the only motivation I have initially until it starts generating money is to build something interesting for myself. Episode 3: Where I had nothing for potential customers to play around with This is related to the 1st lesson. Because I didn’t have a path to quickly get something out there, there was no way for me to get my “product” into the hands of people who could test and provide feedback. I think the problem with a boilerplate template style of product is that you can’t give people a half-backed thing and ask them to test it. Unlike other SaaS apps, there’s no mid-way version of a template. Customers have to “buy-in” to use your template with any project they are starting. With SaaS, users can sign up and test, and then leave if they don’t like it. There’s no easy way of testing with a template. Lesson 3: Build something that can be tested by potential customers easily. For now, I’m going to stick with SaaS style web apps. Conclusion Moving forward: I’ll be working on web app products that users can sign up for and test very quickly. My next few experiments/products will be things that I can use myself as well. I’ll post what I’m going to work on next when I decide and have some time away from my job & freelance projects that are currently in progress.

15th Jun 2024 • 50 votes
Cookie Based Auth for Django and NextJS

If you’re just looking for implementation instructions, skip my ramblings and go straight to the code here. I’m currently working on my first project after deciding that I needed to fail more and practice finishing projects instead of abandoning them midway once they got “boring”. Anyways… This one is till in it’s interesting phase, so here’s a blog post with some things I learned yesterday while working on it. The project is a boilerplate template that should make it easy for devs. to start a new project with a Django backend and a Next.js frontend, something I had to struggle with recently. The problem The first thing I’m looking to solve is authentication. That was my biggest challenge when working on the contracting project that inspired this template. While there are a number of good posts around how to setup authentication b/w Django & Next.js, nothing “definitive” came up and I had to cobble together a weird mess of Django+DRF (Django Rest Framework) and Next.js+NextAuth, sharing a token from Django that was masquarading as a JWT token for Next.js. It wasn’t pretty and I knew I could do better. The options I considered 2 options for authenticating the Next.js frontend with the Django backend: Token based auth. On logging in, a user receives a token that is stored in local storage by the frontend and send with every request to the backend. Session/Cookie based auth. This is how authentication works in Django by default and is very easy to get started with - it basically comes for free out of the box when you start a new Django project. While token based auth. is what almost everyone suggests to use when using a Next.js frontend with any backend technology, I wanted to give session based auth. a try. I was curious what it would take to make it work - if it was even possible. tl;dr: It was possible to use cookie/session auth. b/w Django & Next.js - though with a few constraints which make it less appealing than the token based solution What follows are my notes on how to set it up, the problems I faced, and why for the template I’m going to go with token based auth. instead. Learning how CORS & Set-Cookie works It took me a few hours to get my head around how cross-origin requests and cookies work together, but the actual implementation was surprisingly straight forward. This “mini-quest” gave me a chance to learn a lot about how CORS and cookies work, and I’m happy with the time I spent on this. These are the resources which helped me the most (all are from MDN): Cross-Origin Resource Sharing Same-origin policy Using HTTP cookies Set-Cookie And finally, there was a surprise waiting for me! Browsers are almost universally making changes to restrict 3rd party or cross-domain cookies because of their privacy implications. Here’s a nice article from MDN about it: Saying goodbye to third-party cookies in 2024. This is the reason why; while this approach works, I won’t be using it in the template. More on that later. Implementation Implementing the session based auth. b/w Django & Next.js is pretty simple. Django configuration Install the django-cors-headers Python package. Add "corsheaders", to your INSTALLED_APPS. Add the "corsheaders.middleware.CorsMiddleware", middleware, right above the existing CommonMiddleware. Set CORS_ALLOWED_ORIGINS = ["http://localhost:3000"], replacing the URL with your frontend URL. Set CORS_ALLOW_CREDENTIALS = True Configure settings.py to allow cross-domain access for the session cookie. Set SESSION_COOKIE_SAMESITE = "None" Set SESSION_COOKIE_SECURE = True Next.js configuration No configuration is needed on the frontend. However, you do need to use the credentials: "include", option when using the fetch() API to access your backend. Here’s a minimal example. "use client"; import { BACKEND_URL } from "@/constants"; async function signIn() { const loginData = new FormData(); loginData.append("username", "admin"); loginData.append("password", "admin"); return await fetch(`${BACKEND_URL}/accounts/login/`, { method: "POST", body: loginData, credentials: "include", }); } async function whoAmI() { console.log( await fetch(`${BACKEND_URL}/accounts/me/`, { method: "GET", credentials: "include", }), ); } export default function Home() { return ( <main className="flex min-h-dvh w-full flex-col justify-around"> <h1 className="text-center">Home</h1> <button className="" onClick={signIn}> Sign In </button> <button onClick={whoAmI}>Who Am I</button> </main> ); } That’s it. That simple piece of code & configuration took me hours to find. Hopefully you can use this example to skip all that time spent trying to figure things out. Side quest log: Initially, I was not using the credentials: "include" option in the signIn() function above; thinking that I didn’t need to send any cookies with the login call, only the second API call to the /accounts/me endpoint. That mistake cost me about 2 hours of debugging time. If I had RTFM correctly the first time, I would have seen this: include: Tells browsers to include credentials in both same- and cross-origin requests, and always use any credentials sent back in responses. The credentials: "include" not only controls if cookies are sent, but also if they are saved when returned by the server. Why I won’t use this solution in the template Browsers are phasing out 3rd party cookies (Saying goodbye to third-party cookies in 2024) and adding features to work around that restriction where needed. The simplest way that doesn’t require much change is to use Cookies Having Independent Partitioned State (CHIPS). To enable CHIPS, you simply put a Partitioned flag on your Set-Cookie header, like so: Set-Cookie: session_id=1234; SameSite=None; Secure; Path=/; Partitioned; Unfortunately, there’s no straight forward way to do this in Django for now. There’s an open issue to resolve this, but looking at the comments, it won’t likely be solved anytime soon. Considering this, I opted to use the token based auth. method for my template. I’ll write a blog on that once I get it working over the next few days.

2nd Mar 2024 • 47 votes
Project 1: Django + NextJS Boilerplate

Links: Gumroad page Build Log My accidental new years resolution was to work on the 1 problem that has plagued me for my entire adult life; failure to commit and focus. I decided to work in 6 week “sprints” (inspired by Shape Up) and complete the projects I start - for some known definition of complete. This is the 1st project I have decided to work on. I’ll work on this from today (15th Feb 2024) to (28th Mar 2024). I’ll follow-up then with another post talking about how it went. The project The goal is to make & sell a Django + NextJS boilerplate template. What’s a boilerplate template? It’s the source code for a project that’s already setup with many things that are needed in a new project; for example: Stripe subscriptions functionality Background jobs CSS framework User/team management A great example is Saas Pegasus, which seems like an amazing boilerplate loved by many people. My boilerplate is going to be much simpler - and also much cheaper. SaaS Pegasus comes with so many features that it’s worth the $249 starting price. I’m aiming for $5-$10. Goals My goal is to sell this boilerplate to at least 10 people - and have them be happy using it. This means: talking to prospective customers and seeing if this can be useful to them. People will have the option of scheduling a 15 minute pre-purchase call with me for $5 to see if this would be useful to them. The payment is purely to make sure that I only spend time talking to people who are somewhat serious about purchasing. providing excellent after sales support. I’ll include a 60 minute setup call with me for any purchase. While a 60 minute call for a $10 sale isn’t scalable, it’s a great way for me to talk to customers at the start. having a no questions asked refund policy. My experiences with running an e-commerce store in the past tell me this is an amazing way to build trust. provide on-going support, updates, and fixes over email. build a mailing list of people interested in my work who I can email when I launch my future projects. The deliverable The boilerplate will allow developers to quickly start a project that uses Django for the backend and NextJS for the frontend. My recent experiences with another project in this tech stack required me to spend significant time on: figuring out how to setup authentication b/w Django & NextJS (this took the most time & effort) setting up Django Rest Framework so I could write APIs that would be used by the frontend writing Docker files that would build 2 containers - backend & frontend writing Terraform scripts to deploy those containers to AWS ECS writing config & scripts to run the project on Gitpod so it could be easily worked on by my team members My plan is to build a boilerplate that already has most those features built in, plus a few extras: Celery with Redis for background task processing Tailwind CSS for the frontend (in my project I used ChakraUI but Tailwind would be a better option for a boilerplate) If there’s demand for it, a stretch goal is to include social auth (sign-in with Google/Apple/etc) Once complete, I’ll put this on Gumroad and create a landing page there. From then on, it’s all about marketing it; that’s the part which I have no experience with and hope to learn the most from. The marketing plan This is the area where I lack any experience; so I’m not sure how I’m going to market this. Some ideas I have: build it in public on Twitter. I have a tiny Twitter following (312 followers) so not sure how useful this could be. But I have to try something. share it with people asking how to setup Django & NextJS on forums like Reddit, Stackoverflow, and others. maybe write a blog post on how to setup Django & NextJS and then link to the boilerplate from there. The blog post would provider all the steps necessary for the basic setup and the boilerplate would go beyond that with something that’s ready to use. The build log I’d also like to create a build log with this project. This will be a daily note of what I did for this project. I’ll keep it in my notes app Reflect and periodically put it here in this blog post. These daily notes might also serve as content for my build-in-public marketing strategy.

14th Feb 2024 • 50 votes
I have not failed enough

I was recently listening through the How to succeed at failing series on the Freakonomics podcast and started to think about how often I had failed in the past few years. The first answer was - not too much. I couldn’t think of too many instances of where I had “failed”. This was not a good thing. It was very much a sad thing that I couldn’t quickly think of many things I had failed at. Why is not failing bad? I realized I didn’t fail a lot because - I didn’t try a lot. I didn’t fail because I didn’t have good goals. Sure, I have a folder full of projects I thought of, researched, some that I even started working on; that I gave up on pretty soon after starting. But those don’t count as failures right? I was just playing around, not really aiming for anything. It was just a fun side project. That’s why I didn’t fail a lot, and that’s also why it’s not a good thing. I need to fail more Which means that I need to set goals and work towards them. Without goals to aim for, I keep spending my time in the same unproductive loop. Think of a shiny new project. Play around a bit, maybe learn a few things. Give up when things get hard or boring. Repeat While I do learn some things, I don’t really learn new things. Picking up another web backend framework when I’m very good at 1 already (Django if you’re looking to get something built 🙂) is very small incremental progress. I should be learning about running a business, marketing, sales, how to talk to people, cold calling, etc. Instead I’m playing around with NextJS/Remix because it’s easier to do and there’s very little chance of me failing at it. What I’m planning to do Any new project that I start, I will have an achievable goal for it. Something that can be called “done”. Achievable is different for everyone. Creating a small SaaS and have 5 people pay for it might be childs play for some, it’s my Everest for now. The plan is to aim for things just outside of my reach – to work towards those and grow in the process. Have a deadline. For now I’m starting with 6 week cycles of project work. In order meet deadlines, I need to have a clear picture of the goal. Goes back to the first thing on this list. Having a clear definition of “done” is important. But being able to cut scope to achieve some version of the goal is also important. - I’ve just finished reading Shape Up by Jason Fried and I like the Basecamp approach of deciding on an appetite (time commitment) to a project and cutting scope to meet that appetite. - That’s my plan moving forward. Each project I work on will be “shapped” into an achievable outcome and will have an allocated appetite - when I want to launch it or decide to abandon it. Continuing it for the next 6 week cycle will be another option but should be done sparingly. This approach of timeboxing projects and having an achievable goal is also discussed by Zack Freedman in this video Here’s what’s preventing you from finishing projects. See it when you get the chance. This wasn’t supposed to be a new years resolution I started thinking about this over 2 months ago and have been planning to write a post on it. Today seemed like a good day for it. So I guess this is my new year’s resolution. Fail more, fail better.

30th Dec 2023 • 35 votes

More in programming

My Favourite Black Friday Deals

For many course creators, the Black Friday holiday period is when we offer the biggest discounts of the year, which means it’s a great time to pick up some of the web development courses you’ve had your eye on! This post is a quick round-up of my top 10 picks.

12 hours ago • 1 votes
A Better UTF-8 Automaton

Without wasting your time, here it is: Any edge not shown goes to an error state. If you can start in ACC, follow the edges for each byte in your input and end up back in ACC, your string is valid UTF-8. Some C code implementing the above DFA is as follows. It highlights some of the neat features that our new automaton supports, namely quick branchless transitions as a shift-DFA, trivial parallel evaluation, and instant error recovery. #include <stddef.h> #include <stdint.h> enum { DFA_ACCEPT = 2, DFA_SYNC = 16 }; static const uint32_t DFA[256] = { [0x00 ... 0x7f] = 0xcae2bb8a, [0x80 ... 0x8f] = 0xaef05f22, [0x90 ... 0x9f] = 0xbff05f22, [0xa0 ... 0xbf] = 0xbf905f22, [0xc0 ... 0xc1] = 0xc6318cbb, [0xc2 ... 0xdf] = 0xcb8dc637, [0xe0] = 0xc6565dd9, [0xe1 ... 0xec] = 0xc8c7771d, [0xed] = 0xc63318cc, [0xee ... 0xef] = 0xc8c7771d, [0xf0] = 0xcbbaeeeb, [0xf1 ... 0xf3] = 0xc8c97725, [0xf4] = 0xc6546551, [0xf5 ... 0xff] = 0xc6318cbb, }; uint32_t step(uint32_t s, uint8_t b) { return DFA[b] >> (s & 31); } int is_error(uint32_t s) { return !((0x4459a285 >> (s & 31)) & 1); } int partial(uint32_t s) { return (0x92283845 >> ((s + 12) & 31)) & 3; } size_t utf8_valid_up_to(const uint8_t *buf, size_t len) { uint32_t s = DFA_ACCEPT, t; size_t i = 0; for (; i + 32 <= len; i += 32) { uint32_t s1 = s, s2 = DFA_SYNC; for (int j = 0; j < 18; j++) { s1 = step(s1, buf[i + j]); s2 = step(s2, buf[i + j + 14]); } if (is_error(s1) | is_error(s2)) break; s = s2; } for (; i < len && !is_error(t = step(s, buf[i])); i++) s = t; return i - partial(s); } Note that a proper UTF-8 validation routine should at the very least have hot paths for ASCII, this is just an example. And while the above definitely doesn’t beat simdutf, it runs only ~2.5x slower on my Apple M5 laptop when validating Chinese, which isn’t bad for ~30 lines of scalar code. Compared to Björn Höhrmann’s minimal C UTF-8 validator, the above runs 9 times faster in the same benchmark. State machine Our state machine isn’t minimal, but that’s on purpose. It has three nice properties: Like Per Vognsen’s shift-DFA, this state machine can be encoded so each transition is a byte lookup into an array of magic constants followed by a bit shift. Their original implementation packed the constants as uint64_ts, this one fits them in uint32_ts through the use of a SAT solver and overlapping the constants, reducing the lookup table from 2 → 1 KiB. Because we do not merge states which have consumed a different number of bytes of a partial codepoint, error recovery is trivial. In case of an error we can directly read off from the state machine how many bytes we consumed, go back that much, and insert a replacement character if desired. An extra SYNC state is added to the state machine, which absorbs continuation bytes. This makes it super easy to do parallel validation, allowing the shift-DFA to run almost twice as fast as previous shift-DFA UTF-8 validators due to instruction-level parallelism. The trick is to overlap the end of one chunk of bytes with the start of the next chunk by 4 bytes (since no valid codepoint can be > 4 bytes). The first parallel run will validate the overlap, and the second can synchronize on it. If there was an error in these four bytes the second DFA’s state will be nonsense, but the first will catch the error safely. Shift-DFA I would highly recommend reading Per Vognsen’s original shift-DFA exposition, but in short, if you have a finite automaton with a limited number of states and symbols, you can store a transition table. It seems natural to store per state what transition to take for each symbol: $$(\mathrm{State} \times \mathrm{Symbol}) \to \mathrm{State},$$ but if you have a very small number of states it is actually more efficient to store for each symbol how each state transitions: $$\mathrm{Symbol} \to (\mathrm{State} \to \mathrm{State}).$$ This is for two reasons: The memory lookups can all be done in parallel, off the critical dependency chain, as each lookup only depends on its symbol, not the previous state. All the information needed for a $\mathrm{State} \to \mathrm{State}$ function can be stored in one register (naive encoding is $n \cdot \lceil \log_2 n \rceil$ bits for $n$ states). If you choose your state indices cleverly, doing a state transition can even be a single operation after the lookup, e.g. for at most 32 states: state = table[symbol] >> (state % 32) On most hardware shift counts automatically wrap around, making the mod free, as long as it’s 32 or 64. I’m not clever enough, so a SAT solver was used to pack the shift-DFA transition table into uint32_t magic constants. It is somewhat surprising this fit at all, since we have thirteen states, meaning we need 4 bits to encode a transition target, and ${13 \times 4 = 52}$ bits to store it naively. Worse still, since we want to target uint32_t magic constants, our natural modulo is 32, meaning five bits define a state. Luckily we can overlap the bits of neighboring states, if the start of one matches the end of another. To make it fit I still had to be a bit creative: there isn’t a single error state. Instead, we have 32 possible states, of which 12 are valid and 20 are invalid. The only requirement on the invalid states is that they remain invalid on every transition. Luckily checking if a state is valid can still be done with just one shift into a bit vector. What follows is the Z3 code to find our magic DFA constants, it runs in ~15 minutes on my machine. from z3 import * STATES = 'ACC SYNC 1/2 1/3 2/3 1/4 2/4 3/4 E0 ED F0 F4'.split() CONT = {'SYNC': 'SYNC', '1/2': 'ACC', '1/3': '2/3', '2/3': 'ACC', '1/4': '2/4', '2/4': '3/4', '3/4': 'ACC'} CLASSES = { '00-7f': {'ACC': 'ACC', 'SYNC': 'ACC'}, '80-8f': {**CONT, 'ED': '2/3', 'F4': '2/4'}, '90-9f': {**CONT, 'ED': '2/3', 'F0': '2/4'}, 'a0-bf': {**CONT, 'E0': '2/3', 'F0': '2/4'}, 'c0-c1 f5-ff': {}, 'c2-df': {'ACC': '1/2', 'SYNC': '1/2'}, 'e0': {'ACC': 'E0', 'SYNC': 'E0'}, 'e1-ec ee-ef': {'ACC': '1/3', 'SYNC': '1/3'}, 'ed': {'ACC': 'ED', 'SYNC': 'ED'}, 'f0': {'ACC': 'F0', 'SYNC': 'F0'}, 'f1-f3': {'ACC': '1/4', 'SYNC': '1/4'}, 'f4': {'ACC': 'F4', 'SYNC': 'F4'}, } # The offset of valid state s, and the word of class c. off = {s: BitVec(s, 32) for s in STATES} word = {c: BitVec(c, 32) for c in CLASSES} valid = lambda x: Or([x == o for o in off.values()]) # Each state has a unique offset below 32. solver = Solver() solver.add(*[ULT(o, 32) for o in off.values()]) solver.add(Distinct(*off.values())) for c, trans in CLASSES.items(): step = lambda o: LShR(word[c], o) & 31 # State s should go to its target state or error. for s in STATES: if s in trans: solver.add(step(off[s]) == off[trans[s]]) else: solver.add(Not(valid(step(off[s])))) # Error states only transition to error states. for e in range(32): e = BitVecVal(e, 32) solver.add(Or(valid(e), Not(valid(step(e))))) solver.check() model = solver.model() for s in STATES: print(s, model[off[s]]) for c in CLASSES: print(c, f'{model[word[c]].as_long():08x}') Acknowledgements I’d like to thank Thom Chiovoloni for their discussions and their earlier work on packing the lookup tables using Z3, and Max Hollmann for bringing shift-DFA UTF-8 validation to my attention at RustWeek 2026 and exchanging further thoughts.

yesterday • 1 votes
How an accessibility designer adds keyboard shortcuts to a web app

This is another window into the sometimes unglamorous-yet-vital tasks that being an accessibility designer demands. Keyboard shortcuts occupy a strange area for web design. Most websites don’t have them, and that’s totally fine. However, it makes more sense for web apps to utilize them. Web apps utilize keyboard shortcuts for speedier navigation and operation, for people who want or need to spend extended periods of time using the service. It’s the same as non-web apps. That said, there’s a lot of nuance when it comes to adding a keyboard shortcut. It feels a lot like something akin to the Swiss Cheese model, delicately threading a needle through multiple, complicated pieces of fabric. The support table placed later on in this post is the result of research I conducted at work as a result of acknowledging said nuance. The task itself was to figure out how to get better support for Home, End, Page Up, and Page Down behavior for a new feature. A considered experience The “designer” part of “accessibility designer” is ensuring that the keyboard shortcuts you help create feel natural and intuitive to operate for all involved. More importantly, the “accessibility” part is ensuring the widest possible range of people—with unknown devices, circumstances, and preferences—aren’t negatively affected by your choices. Consider people who: Use a keyboard intermittently, Who use it as much as possible by choice, and Use one all of the time by virtue of circumstance. Then know that there are multiple, overlapping layers of keyboard shortcuts present on every device, including ones for: The operating system, Apps installed on the operating system, The browser, Extensions installed on the browser, Assistive technology, and Plugins installed on the assistive technology. Also note that the keyboard shortcuts themselves can be adjusted by someone on all of these levels to suit their own needs, via official and unofficially-supported means. You need to navigate this tangled mess to find a combination of keys that: Are not claimed at all, or more realistically Won’t drastically affect someone’s experience in a negative way if overridden in a limited specific and context. You’ll also need to navigate the tangled mess that is politics. The organizations that produce web apps are made out of people, and people have opinions. This includes notions around: How things should operate, even at the expense of excluding some unknown number of people. Instituting features that have no direct connection to profitability. Remembering that doing accessibility work means advocating for concerns in an industry that has systematically deprioritized it as a practice can help out some in terms of approach to all of this. The world does not revolve around your web app You also need to internalize that your web app is not the center of the universe. It is part of a larger suite of interactions someone is doing on their device to get what they need. The best possible outcome for introducing a keyboard shortcut that overrides someone’s existing expectations is mild annoyance. A range of negative outcomes follows, probably the most notable being reputational damage. The worst—and unfortunately oftentimes quiet—outcome is that you break assistive technology functionality for someone. This is why WCAG Success Criterion 2.1.4: Character Key Shortcuts exists. It’s also why mature web apps like GitHub have this type of preference toggle: To the extent of my knowledge, Firefox is the only browser that lets you natively override a keyboard shortcut override, via some buried, legacy menus. This lends further ammo to my belief that browsers are a failure of imagination—the end result of misaligned business priorities. Some may also point out here that screen readers have passthrough key capability. It is a fallacy to assume everyone has perfect working knowledge of the full capabilities of their software and hardware. For people that do know about passthrough key support, it is annoying, tedious, and sometimes even painful to have to use them for frequently-used commands. To say it more plainly: Advocating for the creation of a keyboard preference support area on your web app will be a painful undertaking. This is due to a contemporary business culture that largely views user experience to be an inconvenient friction that gets in the way of metrics-obsessed rent-seeking. The map is not the territory In reviewing the support table, the lack of OS, browser, or screen reader keyboard shortcuts for an Alt/Command + End keypress might make it seem like a good candidate to use for my task. However, Alt/Command + Home opens the browser start page, moves current page back one history event for every major browser on Windows. People who use a modifier key with End will likely expect the same modifier key applied to Home to operate in a similar fashion. For example, if some combination of modifier keys plus Page Down scrolls down 75% of the height of the page, one would assume that the same combination plus Page Up scrolls upward 75% instead. As my research shows, this is true until it isn’t. Decisions and ramifications After figuring out what keypresses do what comes the responsibility of figuring out if this behavior is something you want to intentionally suppress. To me, opening the browser start page and moving the current page back one history event is a weird, awkward, and surprising behavior. However, given the scope and scale of the audience GitHub serves, it is statistically almost certain at least one person loves the feature and uses it every day. I need to weigh that consideration against the context of the task I am helping out with at work. The new feature involves data entry, so a navigation event introduces the chance of accidental data loss—not ideal! I say responsibility because there’s also an incredible amount of weight when you factor in how assistive technology operates. Suppressing the home page-summoning behavior might be annoying, but there are workarounds. Suppressing keys that people who use screen readers rely on to navigate and take action on things locks them out. For example, don’t use h to open a help dialog. Both NVDA and JAWS use the h key to navigate by heading, and this is the far most popular way that people use screen readers to navigate. Another way to contextualize it: Overwriting h keypresses would be the equivalent of preventing you from scrolling down via mouse, trackpad, or screen swipe. More learnings The table is a beast, but it reveals all sorts of interesting things. A few that stand out to me are: Screen readers don’t have parity in function across different versions, unless they do. Browsers have consistent behavior across different operating systems, until they don’t. All browsers can have the same behavior, save for one—I’m pointing my finger at you, Safari. Two browsers may share the same underlying rendering engine, yet have completely different behaviors. Another map-is-not-the-territory consideration is large areas of seeming cross-operating system support may not work as expected in the actual. Command is frequently used on macOS as a modifier key, so a lack of existing behavior for it and its Windows equivalent may seem tempting. However, Alt, otherwise known the Windows key, opens the Start Menu. Although this would have cross-operating system parity, it would not be a great experience for people who use Windows. Availability bias As people who predominately use macOS or Linux to build web experiences, we oftentimes tend to forget other operating systems exist. This can have even more subtle consequences, in that Mac laptops don’t have Home, End, Page Up, and Page Down keys. This fact can conspire to make people forget that these keys exist and are used, to say nothing of other biases such as non-English keyboard layouts. Source: MediaRange Keyboard USB Qwertz German Black, W128289008 (Black). And speaking of things we assume based on the devices we use, another learning well-worth pointing out is the divergence between VoiceOver and JAWS or NVDA. VoiceOver is exclusive to macOS, while JAWS and NVDA are exclusive to Windows. This is important to note in that JAWS and NVDA are far, far more popular than macOS VoiceOver. Broadly-speaking, VoiceOver has a different interaction paradigm when compared to other popular screen readers. Without proper education about the space, this may lead to false understandings of how things operate in the actual for a lot of people. The support table Skip support table. Results for Home. Results for End. Results for Page Up. Results for Page Down. Keyboard combo Operating system Browser Screen reader Existing behavior? Scope Function Home Shift + Home Windows Chrome None No N/A JAWS No N/A NVDA No N/A Edge None No N/A JAWS No N/A NVDA No N/A Firefox None Yes Browser Selects all text on line of text before last known cursor position JAWS No N/A NVDA No N/A macOS Chrome None No N/A VoiceOver No N/A Edge None No N/A VoiceOver No N/A Firefox None No N/A VoiceOver No N/A Safari None No N/A VoiceOver No N/A Control + Home Windows Chrome None Yes Browser Scrolls to top of page JAWS Yes Browser Scrolls to top of page NVDA Yes Browser Scrolls to top of page Edge None Yes Browser Scrolls to top of page JAWS Yes Browser Scrolls to top of page NVDA Yes Browser Scrolls to top of page Firefox None Yes Browser JAWS Yes Screen Reader Places focus on first focusable element on the page NVDA Yes Screen Reader Places focus on first focusable element on the page macOS Chrome None No N/A VoiceOver No N/A Edge None No N/A VoiceOver No N/A Firefox None Yes Browser Scrolls to top of page VoiceOver Yes Browser Scrolls to top of page Safari None No N/A VoiceOver No N/A Option + Home Windows Chrome None Yes Operating System Minimizes all open windows and apps that don’t currently have focus JAWS Yes Operating System Minimizes all open windows and apps that don’t currently have focus NVDA Yes Operating System Minimizes all open windows and apps that don’t currently have focus Edge None Yes Operating System Minimizes all open windows and apps that don’t currently have focus JAWS Yes Operating System Minimizes all open windows and apps that don’t currently have focus NVDA Yes Operating System Minimizes all open windows and apps that don’t currently have focus Firefox None Yes Operating System Minimizes all open windows and apps that don’t currently have focus JAWS Yes Operating System Minimizes all open windows and apps that don’t currently have focus NVDA Yes Operating System Minimizes all open windows and apps that don’t currently have focus macOS Chrome None No N/A VoiceOver No N/A Edge None No N/A VoiceOver Yes Screen Reader Focuses an arbitrary focusable element before the currently focused item in the DOM, relatively close proximity to the currently focused item Firefox None Yes Browser Opens the browser start page, moves current page back one history event VoiceOver Yes Screen Reader Moves focus to the first focusable element in the DOM, then opens the browser start page and moves current page back one history event Safari None No N/A VoiceOver No N/A Alt / Command + Home Windows Chrome None Yes Browser Opens the browser start page, moves current page back one history event JAWS Yes Browser Opens the browser start page, moves current page back one history event NVDA Yes Browser Opens the browser start page, moves current page back one history event Edge None Yes Browser Opens the browser start page, moves current page back one history event JAWS Yes Browser Opens the browser start page, moves current page back one history event NVDA Yes Browser Opens the browser start page, moves current page back one history event Firefox None Yes Browser Opens the browser start page, moves current page back one history event JAWS Yes Browser Opens the browser start page, moves current page back one history event NVDA Yes Browser Opens the browser start page, moves current page back one history event macOS Chrome None No N/A VoiceOver No N/A Edge None No N/A VoiceOver No N/A Firefox None No N/A VoiceOver No N/A Safari None Yes Browser Opens the browser start page, moves current page back one history event VoiceOver Yes Browser Opens the browser start page, moves current page back one history event End Shift + End Windows Chrome None No N/A JAWS Yes Screen Reader Re-reads content the virtual cursor is placed on NVDA Yes Screen Reader Selects next line Edge None No N/A JAWS Yes Screen Reader Re-reads content the virtual cursor is placed on NVDA Yes Screen Reader Selects next line Firefox None No N/A JAWS Yes Screen Reader Re-reads content the virtual cursor is placed on NVDA Yes Screen Reader Selects next line macOS Chrome None No N/A VoiceOver No N/A Edge None No N/A VoiceOver No N/A Firefox None No N/A VoiceOver No N/A Safari None No N/A VoiceOver No N/A Control + End Windows Chrome None Yes Browser Scrolls to bottom of page JAWS Yes Screen Reader Places virtual cursor on the last node in the DOM NVDA Yes Screen Reader Places virtual cursor on last landmark in the DOM Edge None No N/A JAWS Yes Screen Reader Places virtual cursor on the last node in the DOM NVDA Yes Screen Reader Places virtual cursor on last landmark Firefox None Yes Browser Scrolls to end of page JAWS Yes Screen Reader Places virtual cursor on the last node in the DOM NVDA Yes Screen Reader Re-reads currently focused DOM node macOS Chrome None No N/A VoiceOver No N/A Edge None No N/A VoiceOver Yes Screen Reader Moves focus to the end of the next content section in the DOM Firefox None No N/A VoiceOver Yes Screen Reader Moves focus to the end of the next content section in the DOM Safari None No N/A VoiceOver No N/A Option + End Windows Chrome None No N/A JAWS No N/A NVDA No N/A Edge None No N/A JAWS No N/A NVDA No N/A Firefox None No N/A JAWS No N/A NVDA No N/A macOS Chrome None No N/A VoiceOver No N/A Edge None No N/A VoiceOver Yes Screen Reader Moves focus to the end of the next content section in the DOM Firefox None No N/A VoiceOver Yes Screen Reader Moves focus to the end of the next content section in the DOM Safari None No N/A VoiceOver No N/A Alt / Command + End Windows Chrome None No N/A JAWS No N/A NVDA No N/A Edge None No N/A JAWS No N/A NVDA No N/A Firefox None No N/A JAWS No N/A NVDA No N/A macOS Chrome None No N/A VoiceOver No N/A Edge None No N/A VoiceOver No N/A Firefox None No N/A VoiceOver No N/A Safari None No N/A VoiceOver No N/A Page Up Shift + Page Up Windows Chrome None No N/A JAWS Yes Screen Reader Selects all text in a range above and below the current position of the virtual cursor NVDA Yes Screen Reader Reads the DOM past the current position of the virutal cursor Edge None No N/A JAWS Yes Screen Reader Selects a section of text below the current position of the virtual cursor NVDA Yes Screen Reader Reads the DOM past the current position of the virutal cursor Firefox None Yes Browser Scrolls down one page section and selects all text in range of the scroll distance JAWS Yes Screen Reader Reads a small portion of the DOM past the current position of the virtual cursor NVDA Yes Screen Reader Reads the DOM past the current position of the virutal cursor macOS Chrome None No N/A VoiceOver No N/A Edge None No N/A VoiceOver No N/A Firefox None No N/A VoiceOver No N/A Safari None No N/A VoiceOver No N/A Control + Page Up Windows Chrome None Yes Browser Opens previous browser tab JAWS Yes Browser Opens previous browser tab NVDA Yes Browser Opens previous browser tab Edge None Yes Browser Opens previous browser tab JAWS Yes Browser Opens previous browser tab NVDA Yes Browser Opens previous browser tab Firefox None Yes Browser Opens previous browser tab JAWS Yes Browser Opens previous browser tab NVDA Yes Browser Opens previous browser tab macOS Chrome None Yes Browser Opens previous browser tab VoiceOver Yes Browser Opens previous browser tab Edge None Yes Browser Opens previous browser tab VoiceOver Yes Browser Opens previous browser tab Firefox None Yes Browser Opens previous browser tab VoiceOver Yes Browser Opens previous browser tab Safari None No N/A VoiceOver No N/A Option + Page Up Windows Chrome None No N/A JAWS No N/A NVDA No N/A Edge None No N/A JAWS No N/A NVDA No N/A Firefox None No N/A JAWS No N/A NVDA No N/A macOS Chrome None No N/A VoiceOver No N/A Edge None No N/A VoiceOver No N/A Firefox None No N/A VoiceOver No N/A Safari None No N/A VoiceOver No N/A Alt / Command + Page Up Windows Chrome None No N/A JAWS No N/A NVDA No N/A Edge None No N/A JAWS No N/A NVDA No N/A Firefox None No N/A JAWS No N/A NVDA No N/A macOS Chrome None No N/A VoiceOver No N/A Edge None No N/A VoiceOver No N/A Firefox None No N/A VoiceOver No N/A Safari None No N/A VoiceOver No N/A Page Down Shift + Page Down Windows Chrome None No N/A JAWS Yes Screen Reader Selects all text in range above and below the current position of the virtual cursor NVDA Yes Screen Reader Reads the DOM past the current position of the virutal cursor Edge None No N/A JAWS Yes Screen Reader Selects a section of text below the current position of the virtual cursor NVDA Yes Screen Reader Reads the DOM past the current position of the virtual cursor Firefox None Yes Browser Scrolls down one page section and selects all text in range of the scroll distance JAWS Yes Screen Reader Reads a small portion of the DOM past the current position of the virtual cursor NVDA Yes Screen Reader Reads the DOM past the current position of the virutal cursor macOS Chrome None N/A VoiceOver No N/A Edge None No N/A VoiceOver No N/A Firefox None No N/A VoiceOver No N/A Safari None No N/A VoiceOver No N/A Control + Page Down Windows Chrome None Yes Browser Opens next browser tab JAWS Yes Browser Opens next browser tab NVDA Yes Browser Opens next browser tab Edge None Yes Browser Opens next browser tab JAWS Yes Browser Opens next browser tab NVDA Yes Browser Opens next browser tab Firefox None Yes Browser Opens next browser tab JAWS Yes Browser Opens next browser tab NVDA Yes Browser Opens next browser tab macOS Chrome None Yes Browser Opens next browser tab VoiceOver Yes Browser Opens next browser tab Edge None Yes Browser Opens next browser tab VoiceOver Yes Browser Opens next browser tab Firefox None Yes Browser Opens next browser tab VoiceOver Yes Browser Opens next browser tab Safari None No N/A VoiceOver No N/A Option + Page Down Windows Chrome None No N/A JAWS No N/A NVDA No N/A Edge None No N/A JAWS No N/A NVDA No N/A Firefox None No N/A JAWS No N/A NVDA No N/A macOS Chrome None N/A VoiceOver No N/A Edge None No N/A VoiceOver No N/A Firefox None No N/A VoiceOver No N/A Safari None No N/A VoiceOver No N/A Alt / Command + Page Down Windows Chrome None No N/A JAWS No N/A NVDA No N/A Edge None No N/A JAWS No N/A NVDA No N/A Firefox None No N/A JAWS No N/A NVDA No N/A macOS Chrome None No N/A VoiceOver No N/A Edge None No N/A VoiceOver No N/A Firefox None No N/A VoiceOver No N/A Safari None No N/A VoiceOver No N/A Testing notes Evaluation was conducted the week of January 19th, 2026. Following is what I used to in my research: Keyboards 2021 MacBook Pro. Logitech Slim Solar+ K980. Operating Systems and browsers Windows, version X. Chrome, version 144.0.7559.97. Edge, version 144.0.3719.92. Firefox, version 147.0.1. macOS, version 15.7.3 (fuck you, Liquid Glass). Chrome, version 144.0.7559.97. Edge, version 144.0.3719.92. Firefox, version 147.0.1. Safari, version 26.2 (20623.1.14.18.4). Assistive technology JAWS, version 2026.2512.50. NVDA, version 2025.3.2. VoiceOver, using macOS version 15.7.3. Also note I am not presenting the suggestions I recommended at my job because of how contextual this work is. These observations from a past effort. What wasn’t evaluated: I didn’t evaluate less-popular Chromium browsers. I didn’t evaluate popular browser extensions like Grammarly. I didn’t evaluate support on iOS or Android, but they do support keyboard input and people do use them. I also didn’t evaluate Linux or Orca. There are just too many possible permutations. Seriously. I am only one man with a full-time job and a dog with attachment issues, folks. Using an LLM: Using plaintext copies of screen reader manuals to use as LLM context still created hallucinations. It also doesn’t cover the app or operating system layers. The stakes are too high considering the human-facing impact, and it was likely net-less effort to manually test to get certainty with results. There might be a metaphor worth thinking through in that previous bullet point.

2 days ago • 3 votes
A design audit of an AI-built GitHub clone

slug: design-audit-ai-built-github-clone

3 days ago • 1 votes
the incredible lightness of not being

Good evening! Long time no type. I am feeling a lightness, a floating, and wanted to share it with you. In a , I confessed that once, adrift, unmoored from God, I threw away my bible and reached instead for a slim pamphlet, the United Nations Declaration of Human Rights. One needs a anchor betimes. It was a funny instinct but not capital-W Wrong. I joined the university chapter of Amnesty International; I wasn’t much on writing to political prisoners, but much more about opposing Wrong, that which was Not Right. Any port in a storm, I suppose. We would table in the university quad, hold posters at prominent intersections in town, and vigil all night outside the state prison on execution nights. I admired the chapter president, and somehow, eventually, in a way I still don’t understand, I became president.previous missive I didn’t do a great job. I’m not great at motivating people; that requires a combination of organization and follow-through, and though I’m good at steady participation (I’ll show up), I will do anything rather than send an e-mail on time. I think I became president by virtue of participating and then proceeded to do it poorly, leading the organization to a period of gentle decline. The nice thing about trying things at university is that there is a natural term limit; graduation bounds the damage any one person can do. — I don’t know what pulls me to this kind of rights-based organization. Though human rights are a useful rhetorical device, I no longer have the grasping faith that they are axiomatic, beyond reason themselves. But they seem to correlate with what I feel in my bones, that a christian who works for the “least of us” is more my comrade than the atheist that can’t be arsed. — Time passed. I changed countries, once, twice; new ports, new storms. One stays plugged in to home, though, and you can’t really unplug from the US. When Trump was elected in 2016 I knew it was going to get bad for immigrants, and I knew also that I couldn’t do anything about it. Anything there, anyway. But it was Not Right. I decided to reach out to a couple local associations that worked for immigrant rights; after all, I am an immigrant here in France, I have been through the system and I knew how to work it pretty well. I ended up joining the local chapter, riding shotgun in the weekly office-hours sessions that sometimes lasted until eleven at night.Ligue des droits de l’Homme I admired the chapter president and somehow, eventually, in a way I don’t understand, I became president. Dint of participation, I expect. Groups like this are funny: there is no graduation, just incapacity, death, and attrition. Around 2018 or so, some lifers got in a spat, and almost tore the place apart. The chapter I inherited in late 2020 was a husk of what it was. I kept the lights on, and I’m still there at the weekly office hours, three weeks out of four. But happily, like university, statutory term limits mitigate the effect that any one person can have, and I am delighted, elated that as of tonight, I am free again, free from being responsible for sending emails to tell people what they already know, that the monthly meeting is the last Thursday in the month, that we need to figure out who will staff which office hours, free to be nagged by someone else instead of being the one to do the nagging. And so that’s the end of tonight’s short note: I’m free, wheee!!!

4 days ago • 3 votes
📚 BoredReading

You seem to be enjoying this.

Join free to unlock everything.

Create free account

Already have an account? Sign in