💡 AWS CDK: Multi-Stage API Gateway APIs with Lambda Integration using Stage Variables

When building APIs using AWS API Gateway backed by AWS Lambda functions, there’s a common pattern for creating separate development and production environments. Multiple stages (e.g., dev and prod) are created for the API. The name of the Lambda function (or its alias) to call for serving requests is stored in a stage variable. While building an AWS CDK stack, I found implementing this pattern surprisingly difficult, and it took me quite a while to find a solution....

October 3, 2024 · 2 min · 407 words · Botond

💬 Quotes from Into the Wild by John Krakauer

The physical domain of the country had its counterpart in me. The trails I made led outward into the hills and swamps, but they led inward also. And from the study of things underfoot, and from reading and thinking, came a kind of exploration, myself and the land. In time the two became one in my mind. With the gathering force of an essential thing realizing itself out of early ground, I faced in myself a passionate and tenacious longing—to put away thought forever, and all the trouble it brings, all but the nearest desire, direct and searching....

September 30, 2024 · 4 min · 790 words · Botond

🔗 Links of the Week: e-ink and AI

Not AI Version 2 of my solar-powered, ePaper digital photo frame: This guy made an incredible solar-powered color epaper photo frame. It can only display white, black and red pixels so he implemented dithering. The result is really cool. Another color eink photo frame: This is more compact and uses a battery. Honestly I like the dithering; it gives an artistic quality to the images. Beepberry - a portable e-ink computer for hackers: This is one of those things I know would just collect dust after an initial honeymoon period but is still want it SO MUCH!...

May 21, 2023 · 2 min · 240 words · Botond

🔗 Links of the Week: A Windows Bug, Image Kernels, AWS, GitHub, and of course AI

Not AI How to lose your work using Undo Copy in Windows: Windows has a terrible surprise hidden in the context menu of Windows Explorer. Image Kernels Explained Visually: A technique used in image editors like Photoshop or Gimp and in computer vision is to apply image kernels (or convolution filters/matrices) to images to enhance or reducing certain features. This website allows you to try different kernels on an example image....

May 14, 2023 · 2 min · 301 words · Botond

🔗 Links of the Week: Programming, AI, AI, and even more AI

Not AI World Smallest Office Suite: Obviously impractical, but the way he implements the apps is very interesting. I found the best anagram in English: Perl veteran finds an interesting way to rank anagrams. AI Bing’s A.I. Chat: ‘I Want to Be Alive. 😈’: Microsoft’s new chatbot goes crazy after a journalist uses psychology to manipulate it. The article contains the full transcript and nothing else. It’s a fascinating read....

May 11, 2023 · 3 min · 441 words · Botond

👨‍💻 Micrograd.js

I have recently started working through Neural Networks: Zero to Hero, Andrej Karpathy’s excellent AI course. In the first video, he demonstrates how to build micrograd, a library that can be used to implement backpropagation, the algorithm used to train neural networks. As an exercise, I tried to reimplement it in JavaScript to check my understanding. I was able to do it mostly from memory which is a testament to Andrej’s qualities as a teacher....

May 4, 2023 · 4 min · 790 words · Botond

💡 TIL how to select N random lines from a file on the command line

I’ve just learned how to select N random lines from a file on the command line: shuf -n 10 file.txt This is amazing. I’ve been using Linux for years and I had no idea this was so easy.

May 1, 2023 · 1 min · 38 words · Botond

🔗 Links of the week: AI, GPT, Prompt Engineering

OpenAI API: If you want to call OpenAI’s models (e.g. ChatGPT) programmatically or build AI-based products. Neural Networks: Zero to Hero: If you want to understand how GPT works from the ground up (I’ve only watched the first two videos but they’ve been fantastic). A simple Python implementation of the ReAct pattern for LLMs: How a simple plugin system works. Prompt injection: What’s the worst that can happen?: The most serious vulnerability of GPT-based applications....

May 1, 2023 · 1 min · 149 words · Botond

🌀 Dealing with Nothing in C# - Option

It is a very common pattern to return null when something does not exist. Suppose we have a system where a UserRepository object can retrieve User objects from persistent storage - like a database. public class UserRepository { public User Get(string email) => context.Users.SingleOrDefault(u => u.Email == email); /* ... */ } This is also a very common source of bugs. Consumers of the UserRepository routinely forget to check whether the reference returned is null, causing the code to blow up at runtime unexpectedly....

December 15, 2016 · 9 min · 1844 words · Botond

🌀 Dealing with Nothing in C# - Nullable

In the previous installment of this series, we saw why the null value can be an annoying source of errors. But there are cases when you positively wish for a variable, that otherwise cannot be null, to be able to have a null value. Imagine, for example, a web site that stores the last time each user has logged in. public class User { public string NickName { get; set; } public string Email { get; set; } public string PasswordHash { get; set; } public DateTime LastLoginTime { get; set; } } If a user has just registered but they haven’t yet logged in, we want the LastLoginTime property to be somehow empty....

November 30, 2016 · 8 min · 1594 words · Botond