RSSAmplifier

Blog

seanmcp.com

Technical guides, resources, and opinions from Sean McPherson

seanmcp.comRSS feed ↗186 posts

Latest posts

We don't understand AI

While reading Ursula K. Le Guin's The Farthest Shore , I was struck by this quote from the main character: To claim power over what you do not understand is not wise, nor is the end of it likely to be good. After thinking about AI all week at work, my brain connected that sentence to the concept of interpretability , our understanding of a model's inner workings. An interpretable model is one that…

What is VS Code doing?

I have been a VS Code user for many years now. It was a soft landing from Atom (RIP), and there haven't been any significant features from other editors that have tempted me away. I have never experienced the performance issues that others have cited. It wasn't always as cool as the competitors, but it worked and worked well. Until recently. This week VS Code started adding Co-authored-by: Copilot…

Defaults 2026

Mail Client Gmail app and Zoho app Mail Server Gmail for personal email Zoho for professional email: I've tried other providers for @seanmcp.com but keep coming back to Zoho. It's cheap, customizable, and provides all the features that I want. Notes A private repo with shell scripts. Mobile notes are written in Google Keep and manually backed up. To-Do Todoist: I don't use most of the features,…

AI use case: Asking questions of large files

Khan Academy uses GraphQL to handle all request to query and mutate data. Each service in the system contributes to the GraphQL schema, and everything is ultimately combined into a single file. If a developer wants to know what our API can do, the answer is in that file. The problem is that it's over 80,000 lines long . Most of the time you can get by searching the file for keywords. If you're…

Install curl with apt (and not snap)

After switching my desktop to Linux from Windows [1] , I ran into an issue installing Node. The official directions recommend using nvm , but the nvm install 24 command was failing with a lack of permissions: Downloading and installing node v24.6.0... Downloading https://nodejs.org/dist/v24.6.0/node-v24.6.0-linux-x64.tar.xz... Warning: Failed to open the file…

Four perspectives on AI

Maxi Ferreira writes in Fear and Curiosity and AI about the two stages of AI adoption among developers: A Stage 1 reaction looks something like this: “Ha! Look at this dumb mistake the AI made. It thought I was using Tailwind when I’m actually using Style Components. More like Artificial Unintelligence, am I right? Good luck taking my job, bots.” A Stage 2 reaction looks more like this: “Hmm, I…

Axe DevTools doesn't flag multiple h1 elements on a page

The axe DevTools extension is valuable for testing the quality of your work. I use it multiple times per day when working on frontend tasks. So I was surprised today when I learned that axe does not consider multiple h1 elements on a page an issue. It turns out that this is intentional. There is no rule stating that pages cannot have more than one h1 –even if it is widely considered best practice…

Writing code was never the bottleneck in software engineering

Writing Code Was Never the Bottleneck by Pedro Tavares makes an important observation about using LLMs when writing software. The problem as stated by the solution is that writing code is primarily the bottleneck in development. "If only we could write code faster, then we'd be able to ship more features." Tavares challenges that presupposition : The actual bottlenecks were, and still are, code…

Colocate functionally-related code

I read Colocation by Kent C. Dodds back in 2019 before I had an opinion on the topic. Six years later, I've come to a similar conclusion. Generally speaking, we should keep related code as close together as possible. Common related code in my work are components, styles, tests, and stories. My preference is to keep all of these files together in the same directory: components/ ├── my-component.tsx…

My on-again-off-again relationship with AI assistants

For the past few years, I have been paying on and off for ChatGPT and Claude. I will read an interesting story about how someone transformed their work with AI, then sign up for a premium plan for one month. I spend a few days actively engaging with the AI and then quickly fall off. I go weeks without chatting with the assistant and then cancel before the month is up. There is a lot of smoke in…

Pittsburgh TechFest 2024

Yesterday I went to Pittsburgh TechFest 2024 at the Commonwealth Charter Academy building on the Waterfront. The venue was nice, the food was good, and both keynotes were interesting—though I definitely did not know enough about SNL to fully appreciate the closing. My favorite talk was by Dominika Blach of the Greater Pittsburgh Community Food Bank about how they're using low-code solutions for an…

Bypass "Error: There are no prompts" in promptfoo

While evaluating different language models with promptfoo , I started running into the following error message: /Users/seanmcp/project-dir/node_modules/.pnpm/promptfoo@0.67.0_@aws-sdk+client-bedrock-runtime@3.606.0_@azure+identity@4.3.0_@azure+openai-_c7fwzdecwpaax3yh5ny536i2qu/node_modules/promptfoo/dist/src/prompts/index.js:136 throw new Error(`There are no prompts in…

Use state callbacks in React

When you want to update state in React, you have two options: pass the next value, or pass a callback function that returns the next value. const [ state , setState ] = useState ( 0 ) ; // Next value const reset = ( ) => setState ( 0 ) ; // Callback function const increment = ( ) => setState ( ( prev ) => prev + 1 ) ; To choose correctly, you need to ask if the next state depends on the previous.…

VIVO sit/stand desk

In 2021 I purchased a 43" VIVO sit/stand desk from Amazon. It has served me well for the last few years, but I have encountered a few issues and solutions that I want to log here. Desktop rocks back and forth Permalink to “Desktop rocks back and forth” # When the allen bolts that hold the desktop to the frame are too loose, then the desktop will rock back and forth with normal use. This is…

Simplify event delegation with the Element.closest method

Let's say you have a list of buttons and want to perform an action when one is selected. A solution is to add an event listener to each button with a reference from querying or creating the button. let buttons = document . querySelectorAll ( "button" ) ; buttons . forEach ( ( button ) => { button . addEventListener ( "click" , ( e ) => { console . log ( "Clicked:" , button ) ; } ) ; } ) ; For a…

Align content in Markdown tables

You can set the align attribute on a table column in Markdown by using a colon in the header row separator. A typical table looks like this: | A | B | C | | --- | --- | --- | | | | | To align the content, add colons to the separator row-- :- for left, :-: for center, and -: for right: | A | B | C | | :--- | :----: | ----: | | Left | Center | Right | That Markdown will render a table with the align…

Looking over the fence at Eleventy

First of all: I'm happy with Astro. It's an exciting project that provides the tools necessary to build websites in the way I want to build them. The future is bright for Astro. But... I still find myself looking at alternatives. I've written previously about Astro's relentless releases , and it continues to be a source of stress for me. [1] Every other week it's a fresh release and reminder that…

Getting started with Eleventy

Eleventy has "Get Started" documentation that shows you how to get from a single markdown file to a built site. That is a nice "proof of idea", but I haven't found it to be a helpful way to actually get started with Eleventy. This garden aims to be a better guide for building a simple Eleventy site from scratch. Setup Permalink to “Setup” # Create a new directory for your project: mkdir…

ChatGPT 4o isn't a good researcher yet

I asked ChatGPT 4o for general recommendations for software release frequency , and it spouted out some information that seemed generally plausible. I asked it to cite its sources, and after an internet search it provided three links. I checked all three, and none of them contained the information that ChatGPT initially provided. I replied with "None of those articles had the guidelines that you…

Astro and release velocity

This website is built with Astro , and overall I've been happy with my choice. The framework model makes sense to me, and I really enjoy using their templating language for building UI. If I were to start over today, I would still choose Astro. But I've had an unsettled feeling about Astro and this site, and I think I've finally put my finger on it: Astro is moving too quickly. It feels like every…

Manage your photo archive

A coworker at Khan Academy shared some advice (apparently secondhand from the New York Times) for managing your ever-growing photo archive: Every day open your photos app Search for the day's date Review your old photos from that day Delete ones you don't need anymore My first thought was "That's brilliant!" It's a low lift but once the habit is established it ensures that you address every day of…

Measuring and cutting

I learned “measure twice, cut once” while working with my dad. He probably learned it from his dad and him from his dad. It’s good advice, but in an issue of Frontend at Scale Maxi Ferreira suggests that it might not apply neatly to software engineering: [S]oftware is different, and trying to apply this piece of advice to planning, designing, and writing applications can sometimes do more harm…

Create a custom search for a static site

There are out-of-the-box solutions for searching on a static site. I previously used Pagefind for this site which remains a great option. But if you want fully control of the behavior and appearance of your search feature, then you might have to build your own. After thinking through how I wanted to use a search feature, I came up with these acceptance criteria: Query and filter by type, year, and…

Fix missing Astro files on GitHub pages

I'm in the middle of a long project to migrate my projects from Netlify to GitHub pages. I was working on the GitHub actions for an Astro project and noticed that most of the CSS files were missing from the assets directory. When I built the project locally, I saw the following: _book_.95a15f93.css _book_.ef58a27b.css _chapter_.02b05af9.css index.3e3ecbbf.css The index.3e3ecbbf.css file was the…

Create a useIsOnline React hook

There are two browser features that enable you to detect an internet connection with JavaScript: The Navigator interface's onLine property for the current state The online and offline events for state changes By combining these, we can create a custom React hook that tells us if the browser is currently online. import * as React from "react" ; // Check if window is available const maybeWindow =…

Fix static file endpoints after Astro v4 upgrade

Yesterday I upgraded to Astro v4 without any issues , but this morning I noticed that my RSS feed was broken. I have two static file endpoints that generate a file at build time, one for RSS and the other for a webfinger. Both of these had two issues highlighted after the upgrade: The files did not export a GET function The files did not return a Response or Promise<Response> The first issue was…

Why Microsoft Edge?

I like trying out new browsers and try to avoid being tethered to one for too long. But ever since its switch to Chromium, I find myself coming back to Microsoft Edge. Powered by Chromium : I have issues with recent releases of Chrome, but now that Edge is powered by the same underlying technology I don't need to choose. Size conscientious : Screen real estate is precious, and Edge is the only…

Switching from Ubuntu to Linux Mint

Ubuntu was running slow on my old personal laptop. Previously I had turned to Lubuntu, but I read online that Linux Mint has slighly better performance on low-powered devices. So with a free morning I decided to give that a go. Setup steps: Customized the colors and wallpaper Switched trackpad scroll from "Reversed" to normal ( i.e. down goes down) Installed some key programs with Software Manager…

Running Ollama without a GPU

tl;dr You can run Ollama on an older device, but the response will be slow and/or low quality. I have successfully run Ollama with a new Macbook M2 and a mid-range gaming PC, but I wanted to experiment using an older computer. My personal laptop is a 2017 Lenovo Yoga with Ubuntu and no graphics card. Here are some specs: CPU: Intel i5-7200U CPU @ 2.50GHz RAM: 4GB Memory: 128GB SSD Following the…

Use Ollama with the official Python library

Ollama is a great way to get started with AI by using open-source and publically available large-language models locally on your computer. I wrote previously about how to get started with the experimental OpenAI API , but Ollama has a dedicated Python library that is even simpler. Install the library: pip3 install ollama Create a new python file: touch completion.py Add the following code to…

Get started prompt engineering with local LLMs

Ollama is an application for running large-language models locally on your computer. It gives you access to open-source LLMs that you can prompt directly with the command line or an endpoint. To getting started with local LLMs: Download and install Ollama: https://ollama.com/download When prompted, install the ollama CLI Download and run your first LLM: ollama run llama2 Send your first prompt:…

Did OpenAI&#39;s Web Browser GPT leak its prompt?

I'm not an expert in LLMs or GPTs, but something about the interaction above feels wrong. When prompted with a simple getting started question, OpenAI's official Web Browser GPT seems to have leaked some version of its prompt. Here is the conversation transcribed: Me : How do I get started? Web Browser GPT : As a "Web Browser" GPT, your role is to assist users by leveraging web browsing…

Migrating from Google Domains to Porkbun was...

Painless . They charged a fee of around $11.00 US to transfer the domain and then handled the rest seamlessly. I was hesitant to make the switch off of Google/Squarespace because I didn’t know how involved the process would be. I only had two domains on Google, but there was never a good time to encounter and address downtime issues during a transfer. Thankfully, there weren’t any. I transferred a…

Normalizing data is a good idea

On this site I have a few different types of content: articles, notes, gardens, and now art. There are subtle differences in the data structure for each content type which come to a head whenever I try to combine them into a single list. Previously, I merged all of the content into a single array and then had a bunch of conditions when rendering for each type: [ ... articles , ... notes , ...…

How I&#39;m using AI in November 2023

AI products/services that I used regularly (multiple times per week): GitHub Copilot ⭐: Copilot continues to be a valuable resource when coding. Chat GPT : I signed up for the paid version and spent a lot of time working with custom GPTs. Not sure that the service is worth the price, especially with rate limits, but I'm viewing it as professional development. Khanmigo 📈: I now work on a…

Sli.dev review

I used sli.dev to create my slides for my recent talk at Pittsburgh TechFest 2023. I've previously used Google Slides--which is a great option--but I've been interested in finding a good tool for creating slides from Markdown. There were two main motivations for this: I want the content of the slides to be easier to edit and share. I want to spend less time fiddling with the design of the slides…

Is it better to have one large file or multiple small files with GPTs?

tl;dr: Using a single file seems to reduce the likelihood of a knowledge-base loading and improve response times overall. Introduction : Custom GPTs allow you to upload files that it will reference when answering questions. In my experience, the response time with these knowledge-base GPTs is really slow. That lead me to the question: Is there a way to improve the response time by altering the…

What is the file limit for GTPs?

As of 11/15/2023, the limit is 10 files. Although you wouldn't know it if you tried to upload more. The UI lets you upload more than 10 files, but you get an unhelpful "draft failed to save" message. If you inspect the network requests, you'll see a 🔴 400 to https://chat.openai.com/backend-api/gizmos with the following response: {"detail":"Cannot upload more than 10 files"} Hopefully OpenAI…

How I&#39;m using AI in October 2023

This feels like the breakthrough month. I moved to a new project at Khan Academy working on AI, and I found myself reaching for AI-powered tools more frequently throughout October. I can see a future where I use some of these daily. AI products/services that I used regularly (multiple times per week): GitHub Copilot ⭐: Copilot continues to be a valuable resource when coding. Chat GPT 📈: I don’t…

GPTs read text files better than markdown

tl;dr: Use text files instead of markdown with OpenAI’s custom GPTs I conducted an experiment to see if the file type of uploaded content had an impact on how GPTs could read the information. I created two files with the following content: secret.md : the secret is: bananas foster secret.txt : the secret is: banana split Then I uploaded one file to a GPT and then asked the question: “What is the…

Declarative code and cognitive load

If you had asked me ten years ago about my ability to handle cognitive load, I would have said that I was above average. Today? I would say that I am pretty bad at holding multiple things in my head at once. Whether that is due to aging, fatherhood, multiple-bouts of COVID, humility, or any combination of those, I can’t say. What I do know is that I am now very interested in reducing cognitive…

How I&#39;m using AI in August & September 2023

Sorry for two months in one post, but I haven't been using AI much recently. I think the trend so far is that AI-powered products that are directly related to my work are more likely to stick around. All the others come and go more quickly. AI products/services that I used regularly (multiple times per week): GitHub Copilot ⭐: Copilot continues to be a valuable resource when coding. AI…

See what object properties are accessed in JavaScript

At work I was mocking an object to be passed to a React context provider. I knew the type for the object, but I wanted to learn what properties were being accessed on the object from this point in the component tree. Thankfully, JavaScript has a native way to "watch" an object and respond whenever any of its properties are accessed or reassigned: a Proxy . First start with the object that you want…

Remove duplicates from an array in JavaScript

Removing duplicates, sometimes called de-duplicating or de-duping, is a common task in programming. There are many ways for removing duplicates from an array in JavaScript, and here I am going to share two scenarios and strategies. Array of primitive values Permalink to “Array of primitive values” # In JavaScript, primitive values are the simplest form of data like strings and numbers. Let's say…

How I&#39;m using AI in July 2023

AI products/services that I used regularly (multiple times per week): GitHub Copilot ⭐: Copilot continues to be a valuable resource when coding. I was working on a script while offline, and I missed seeing it's suggestions. AI Products/services that I used occasionally (once per week or less): Bing Images & ChatGPT : I used these for a small project (creating a fantasy RPG to play with my kids),…

Timeboxing types

Two things that I currently believe: There is a lot of value in statically typed code Writing types is a potential time sink with diminishing returns I don't feel like I need to justify the first belief. The trend in the front-end industry towards TypeScript illustrates that there is a growing consensus that types are a net positive. That second belief probably needs more of a defense. I think…

CSS columns are neat

I was looking for a solution to dynamically create two columns in a UI when I came across the columns CSS property . With a single property, you can tell the browser to split content evenly between n number of columns: Two columns Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ornare augue placerat, malesuada nulla volutpat, pharetra arcu. Aenean consectetur diam in justo…

Quality requires iteration

You're not going to get it right the first time. You might not even get it right the second time. But if you iterate enough, you're going to find a good solution. Too often I catch myself overanalyzing the first pass at a problem. I spend too much time thinking about how the whole system needs to work, or all of the edge cases that need to be addressed, and trying to plan the Perfect™ solution.…

A workable emoji picker on Ubuntu

I like to use emojis and have missed them since moving to Linux/Ubuntu. They render fine, but there isn’t a good way to input emojis into a field like on macOS and Windows. Technically there is a native GNOME emoji picker, but it only works with “ supported GTK 3 applications ” and I don’t use any of those regularly . I tried installing a few third-party options, but none of them worked well. I…

Writing Prompts for Programmers

The most effective way I know to improve your writing is to do freewriting exercises regularly. -- Peter Elbow Prompts Permalink to “Prompts” # What is a tool that you have been using lately? What tool would you miss the most if it were to disappear? What is the first thing that you look to do when setting up a new computer? What is a process that has been painful recently? How might you fix it?…