🔗 Elixir, Phoenix, and the OWASP Top 10

The OWASP Top 10 is a well known application security awareness document. When a developer working on internet-facing web applications decides to learn about security, OWASP is a frequently recommended source of information, with the Top 10 as the most famous project. The point o … | Continue reading


@yellowduck.be | 1 year ago

🐥 TIL: Unpacking a .pkg file on macOS

Sometimes, you have these .pkg installer files on macOS. Today, I needed to extract them to see what's inside. Here's how you can do it: 1xar -xf MyInstaller.pkg If there is a file called Payload in there, you need to unpack it again: 1cat Payload | gunzip -dc | cpio -i Inspira … | Continue reading


@yellowduck.be | 1 year ago

🔗 Modern SQLite

Short notes about handy SQLite features you might not have heard about. ⚠️ This post links to an external website. ⚠️ | Continue reading


@yellowduck.be | 1 year ago

🔗 How to uninstall Panda Security

You can uninstall the Panda Adaptive Defense or Endpoint Protection software manually from the operating system?s control panel, or remotely from the Computers area or from the Computer protection status and Licenses lists. ⚠️ This post links to an external website. ⚠️ | Continue reading


@yellowduck.be | 1 year ago

🔗 UUIDv7 in 31 languages

UUIDv7 is a 128-bit unique identifier like it's older siblings, such as the widely used UUIDv4. But unlike v4, UUIDv7 is time-sortable with 1 ms precision. By combining the timestamp and the random parts, UUIDv7 becomes an excellent choice for record identifiers in databases, inc … | Continue reading


@yellowduck.be | 1 year ago

🔗 Many yes/no attributes: table design study

I wanted to demonstrate the relationship between the logical model and a physical model. We're going to design a commonly seen use case: many yes/no attributes of a single anchor (in our case, Restaurant). Then we'll discuss how the physical tables would be designed. We'll see th … | Continue reading


@yellowduck.be | 1 year ago

🔗 Web apps have client and server state (plus realtime and LiveView)

Recent discussions around client-side and server-side frameworks have brought up some misconceptions about state handling in web applications. This article aims to address them with some examples, and go a bit more into detail about how LiveView, in particular, deals with state a … | Continue reading


@yellowduck.be | 1 year ago

🐥 Importing CSV files into SQLite

To import CSV files into SQLite, you can do this in your terminal: 1sqlite3 mydatabase.db 2SQLite version 3.43.2 2023-10-10 13:08:14 3Enter ".help" for usage hints. 4sqlite> .import --csv mydata.csv table_name If the table already exists and the field names don't match the heade … | Continue reading


@yellowduck.be | 1 year ago

🔗 LiveView Is Not a Zero-JS Framework, It's a Zero-Boring-JS Framework

A recent Twitter discussion about the "ceiling" of server-side rendered frameworks like Phoenix LiveView has caused quite a stir. Most of it was in good faith, and many devs have responded with some great takes on the matter. One from Jose Valim particularly resonated with me: Th … | Continue reading


@yellowduck.be | 1 year ago

🔗 The decline of the user interface

When we first got the personal computer, we didn't worry much about how things worked. We were, frankly, stunned that we even had such a thing. You had to learn some arcane lingo to type into a DOS prompt. That the computer might be difficult or awkward to use didn't occur to us. … | Continue reading


@yellowduck.be | 1 year ago

🔗 Laravel Typed Collection

A collection in Laravel is a powerful tool that provides a fluent, convenient wrapper for working with arrays of data. However, standard collections don't restrict the type of data they hold, which can sometimes lead to unexpected behaviors or bugs. Typed Collections — a feature … | Continue reading


@yellowduck.be | 1 year ago

🔗 A quote from Russ Cox

Most people think that we format Go code with gofmt to make code look nicer or to end debates among team members about program layout. But the most important reason for gofmt is that if an algorithm defines how Go source code is formatted, then programs, like goimports or gorenam … | Continue reading


@yellowduck.be | 1 year ago

🔗 How to scale document question answering using LLMs

At Sensible we've used large language models (LLMs) to transform documents into structured data since the developer preview of GPT-3. In that time we've developed a set of best practices for document question answering that complement the basic chunking and embedding scoring appr … | Continue reading


@yellowduck.be | 1 year ago

🔗 Database Design for Google Calendar: a tutorial

In this database design tutorial (~9000 words) I'm going to show how to design the database tables for a real-world project of substantial complexity. We'll design a clone of Google Calendar. We will model as much as possible of the functionality that is directly related to the c … | Continue reading


@yellowduck.be | 1 year ago

🔗 Breaking up is hard to do: Chunking in RAG applications

As you go deeper down the rabbit hole building LLM-based applications, you may find that you need to root your LLM responses in your source data. Fine-tuning an LLM with your custom data may get you a generative AI model that understands your particular domain, but it may still b … | Continue reading


@yellowduck.be | 1 year ago

🔗 Custom Retriever | 🦜️🔗 LangChain

Many LLM applications involve retrieving information from external data sources using a Retriever. A retriever is responsible for retrieving a list of relevant Documents to a given user query. The retrieved documents are often formatted into prompts that are fed into an LLM, allo … | Continue reading


@yellowduck.be | 1 year ago

🔗 From $erverless to Elixir

I recently rewrote a service that was on AWS API Gateway and Lambda in Elixir and apparently that intrigued some people, so I decided to do a small write up. This post is going to be about our motivations for the move and what the replacement implementation looks like. This post … | Continue reading


@yellowduck.be | 1 year ago

🐥 Using Laravel migration with different databases

At work, I recently had the need to use the Laravel migrations for multiple databases. Long story short, our main database is MySQL but we also use PostgreSQL as an AI vector store. I wanted to use the Laravel migrations to create the tables in both databases. It turns out to be … | Continue reading


@yellowduck.be | 1 year ago

🔗 Essays on programming I think about a lot

Every so often I read an essay that I end up thinking about, and citing in conversation, over and over again. Here's my index of all the ones of those I can remember! I'll try to keep it up to date as I think of more. ⚠️ This post links to an external website. ⚠️ | Continue reading


@yellowduck.be | 1 year ago

🐥 Purging the MySQL binlogs

Today, I learned how to purge the binlogs from MySQL: 1PURGE BINARY LOGS BEFORE now(); You can read more about it in the MySQL documentation: 1PURGE { BINARY | MASTER } LOGS { 2 TO 'log_name' 3 | BEFORE datetime_expr 4} The binary log is a set of files that contain informat … | Continue reading


@yellowduck.be | 1 year ago

🔗 iyaja/llama-fs: A self-organizing file system with llama 3

LlamaFS is a self-organizing file manager. It automatically renames and organizes your files based on their contents and well-known conventions (e.g., time). It supports many kinds of file, and even images (through Moondream) and audio (through Whisper). LlamaFS runs in two "mode … | Continue reading


@yellowduck.be | 1 year ago

🐥 Streaming a download to a file using the Laravel HTTP client

If you want to stream a HTTP download to a file when using the Laravel HTTP client, you can do this: 1$resource = \GuzzleHttp\Psr7\Utils::tryFopen('/path/to/file', 'w'); 2 3Http::withOptions(['sink' => $resource])->get('url'); You can read more about the sink option in the Guzzl … | Continue reading


@yellowduck.be | 1 year ago

🔗 Phoenix LiveView 1.0-rc is here! - Phoenix Blog

LiveView 1.0.0-rc.0 is out! This 1.0 milestone comes almost six years after the first LiveView commit. Much worth a read if you're into Elixir and Phoenix development. The LiveView library has come a long way since its inception, and it's now more stable and feature-rich than eve … | Continue reading


@yellowduck.be | 1 year ago

🐥 Fast import of CSV data into PostgreSQL

To quickly import a CSV file into a PostgreSQL table: 1SET DateStyle = 'ISO, DMY'; -- Set the correct date format 2copy mytable (column1, column2) from 'local-file.csv' delimiter ',' csv header; -- Import the files If you want, you can also stream from stdin: 1SET DateStyle = 'I … | Continue reading


@yellowduck.be | 1 year ago

🔗 Your Bike Tires Are Too Skinny. Riding on Fat, Supple Tires Is Just Better

I used to ride thin, high-pressure tires everywhere. But adhering to "the supple life" and cycling on wider, lower-pressure tires boosted my comfort and stability without slowing me down. ⚠️ This post links to an external website. ⚠️ | Continue reading


@yellowduck.be | 1 year ago

🐥 Laravel collections and first call callables

I'm quite a fan of using PHP first class callables, but combining them with Laravel collections can be a bit tricky. Imagine you have a collection with header names you want to convert to snake case. 1$headers = collect(["First Name", "Last Name", "Zip Code", "City"]); With firs … | Continue reading


@yellowduck.be | 1 year ago

🐥 Using a cookie jar with the Laravel HTTP client

If you want to do multiple HTTP requests in a row using the HTTP client from Laravel and persist cookies between them, you can use a cookie jar. This is a class that stores cookies and sends them back to the server when needed. Here's how you can use it: 1use GuzzleHttp\Cookie\C … | Continue reading


@yellowduck.be | 1 year ago

🔗 VSCode: Setting line lengths in the Black Python code formatter

The docs for the Black Python code formatter say that the formatter "is not configurable". This is largely true, but if you have Black set up > to work in VSCode, you can configure the line length. In VSCode, go 'Code -> Preferences -> Settings' and search for "python formatting … | Continue reading


@yellowduck.be | 1 year ago

🔗 GitHub - integrations/slack: Bring your code to the conversations you care about with the GitHub and Slack integration

The GitHub integration for Slack gives you and your teams full visibility into your GitHub projects right in Slack channels, where you can generate ideas, triage issues and collaborate with other teams to move projects forward. This integration is an open source project, built an … | Continue reading


@yellowduck.be | 1 year ago

🐥 Caveat with MySQL full-text search and testing

Today, I was writing a test for a Laravel application that uses MySQL full-text search. I was testing a search query that uses the MATCH and AGAINST operators. The test was failing as no results were returned from the search. Running the same code outside the context of the test … | Continue reading


@yellowduck.be | 2 years ago

🔗 Rotating one or more pages in a PDF in linux

Had to rotate a single page of a PDF. Here's how to do it using pdftk. rotate page 1 by 90 degrees clockwise: pdftk in.pdf cat 1east output out.pdf To rotate all pages clockwise: pdftk in.pdf cat 1-endeast output out.pdf The east etc. is meaningful if you want other rotations. … | Continue reading


@yellowduck.be | 2 years ago

🔗 Force JSON response on all API routes in Laravel

Laravel often returns an HTML response or redirect response on API routes, mostly if the response is an error one. However, it is quite easy to force Laravel to return JSON response in those cases. ⚠️ This post links to an external website. ⚠️ | Continue reading


@yellowduck.be | 2 years ago

🔗 Modern Advances in Prompt Engineering

Due to their ease of use, large language models (LLMs) have seen an explosive rise to popularity. By just crafting a textual prompt, even those who are completely unfamiliar with deep learning can leverage massive neural networks to quickly solve a wide variety of complex problem … | Continue reading


@yellowduck.be | 2 years ago

🔗 The ultimate guide to technical due diligence

Technical due diligence (TDD) helps investors and companies uncover the tech strengths and weaknesses of startups. TDD plays a crucial role in revealing risks and opportunities tied to technology, allowing for a thorough assessment that aids in making better business decisions. ⚠ … | Continue reading


@yellowduck.be | 2 years ago

🐥 Fixing GPG errors when installing apt packages

I was experiencing GPG errors when trying to install packages using apt when using GitHub Actions. The errors I was seeing were similar to the following: Err:16 http://ppa.launchpad.net/ondrej/php/ubuntu jammy InRelease The following signatures were invalid: ERRSIG 4F4EA0AAE526 … | Continue reading


@yellowduck.be | 2 years ago

🔗 Testing Patterns

While building tempest/highlight, I came across an interesting design problem. One of its core components is a concept called "patterns"; these are classes that match a very specific part of code-to-be-highlighted using regex. Part of my test suite's responsibility is to test eac … | Continue reading


@yellowduck.be | 2 years ago

🔗 The Problem With LangChain

If you've been following the explosion of AI hype in the past few months, you've probably heard of LangChain. LangChain, developed by Harrison Chase, is a Python and JavaScript library for interfacing with [OpenAI(https://openai.com/)]'s GPT APIs (later expanding to more models) … | Continue reading


@yellowduck.be | 2 years ago

🔗 How to send progress updates

If you work on anything worthwhile, sooner or later people will care about it and will want you to send progress updates. These could be quarterly investor updates, weekly updates to your boss, emails to adjacent teams, etc. Here are tips on how to do this well. ⚠️ This post link … | Continue reading


@yellowduck.be | 2 years ago

🔗 Fast Full-text Search with PGroonga, Postgres, and Elixir

We're Indie Courses, the video course platform for indie creators. We help you sell your online courses quickly and give you the tools and knowledge to make more sales than you would elsewhere. No marketing degree needed. Our goal at Indie Courses is to offer creators the most ad … | Continue reading


@yellowduck.be | 2 years ago

🔗 Healthy Code Reviews

I worked with a client in the early days of my career building social media sentiment analysis platform when Twitter was still called Twitter. We were a team of seven and I was a junior-level developer back then. We were young and enthusiastic and full of ourselves. "We're agile, … | Continue reading


@yellowduck.be | 2 years ago

🔗 Tips on Adding JSON Output to Your CLI App

A couple of years ago I wrote a somewhat controversial article on the topic of Bringing the Unix Philosophy to the 21st Century by adding a JSON output option to CLI tools. This allows easier parsing in scripts by using JSON parsing tools like jq, jello, jp, etc. without arcane a … | Continue reading


@yellowduck.be | 2 years ago

🔗 Developing Rapidly with Generative AI

Generative AI is attracting attention as the technology has progressed in leaps and bounds in recent years, offering fresh ways to solve user problems. Since it's a relatively new area in terms of its practical application, figuring out how to start building with LLMs (large lang … | Continue reading


@yellowduck.be | 2 years ago

🔗 Build A Route Planner For Maps Using Python

In this article I use the metric system, where 1 meter = 3.28 feet. I also talk about highways. Here I use the definition in British English, where highway refers to any path with a public right of access. We are all familiar with the existence of route planners like google maps … | Continue reading


@yellowduck.be | 2 years ago

🔗 OpenStreetMaps, Overpass API And Python

OpenStreetMaps (OSM) is known for being an open source project that allows people to browse the world map and to plan routes. However it is more than that. Among others it provides a read-only API that allows users to query for very diverse map data: Overpass API ⚠️ This post lin … | Continue reading


@yellowduck.be | 2 years ago

🔗 Lessons after a half-billion GPT tokens

My startup Truss (gettruss.io) released a few LLM-heavy features in the last six months, and the narrative around LLMs that I read on Hacker News is now starting to diverge from my reality, so I thought I'd share some of the more "surprising" lessons after churning through just n … | Continue reading


@yellowduck.be | 2 years ago

🔗 Email DNS Records Cheatsheet

Every so often, I need to chase down some aspect of email validation. This involves a number of DNS records and queries, but I may forget just which ones. So here's a quick cheatsheet for future me to pull up the next time I don't remember which records are used to validate SPF, … | Continue reading


@yellowduck.be | 2 years ago

🔗 Here is why vim uses hjkl keys as arrow keys

I was reading about vim the other day and found out why it used hjkl keys as arrow keys. When Bill Joy created the vi text editor he used the ADM-3A terminal, which had the arrows on hjkl keys. Naturally he reused the same keys and the rest is history. ⚠️ This post links to an ex … | Continue reading


@yellowduck.be | 2 years ago

🔗 Jeffrey Way's PhpStorm Setup in 2024

Call it age. Call it apathy, if you must. I call it contentment. Much of my twenties were spent endlessly experimenting and searching for the perfect editor and workflow. As I read these words back to myself, I'm somewhat embarrassed. "Really? That's what you spent your twenties … | Continue reading


@yellowduck.be | 2 years ago