This week in #dev (Aug 23, 2024)

Welcome to another edition of This Week in #dev, a series of posts where we bring some of our most interesting Slack conversations to the public.

Managing uniqueness in Postgres with constraints

Joël Quenneville learned that PostgreSQL enables the management of uniqueness through constraints instead of manually creating indexes. He notes that older documentation even suggests that using constraints is preferable to using indexes.

CREATE TABLE products (
    product_no integer UNIQUE,
    name text,
    price numeric
);

LLMs answering questions in your terminal

Matheus Richard shares that he created a small script to send a question to an LLM (OpenAI’s GPT-4-mini in this case) in the terminal. Jimmy Thigpen chimes in and says that he has a similar script that uses the llm CLI tool and Ollama running locally:

#!/bin/sh

llm -s "Answer in as few words as possible. Use a brief style with short replies." -m llama3.1 "$*"

Usage:

$ ask how to stop all docker containers
docker stop $(docker ps -q)

Thanks

This edition was brought to you by Jimmy Thigpen, Joël Quenneville, and Matheus Richard. Thanks to all contributors! 🎉