Skip to content

Instantly share code, notes, and snippets.

View gmile's full-sized avatar
🦆
Poco a poco cresc.

Ievgen Pyrogov gmile

🦆
Poco a poco cresc.
View GitHub Profile
@ChristianAlexander
ChristianAlexander / reqllm.livemd
Last active November 28, 2025 05:31
req_llm Demo Livebook

ReqLLM Demonstration

Mix.install([
  {:zoi, "0.8.1"},
  {:req_llm, github: "agentjido/req_llm", ref: "main"},
  {:kino, "~> 0.17.0"}
])
defmodule Task do
defp await_one(tasks, timeout \\ 5_000) when is_list(tasks) do
awaiting =
Map.new(tasks, fn %Task{ref: ref, owner: owner} = task ->
if owner != self() do
raise ArgumentError, invalid_owner_error(task)
end
{ref, true}
end)
@woylie
woylie / email_validation.ex
Last active October 15, 2024 10:32
Email validation according to RFC 5322 with Elixir and gen_smtp
import Ecto.Changeset
@spec validate_email(Ecto.Changeset.t(), atom) :: Ecto.Changeset.t()
def validate_email(changeset, field) when is_atom(field) do
changeset
|> validate_length(field, max: 160)
|> validate_change(field, &validate_email_rfc5322/2)
end
defp validate_email_rfc5322(field, email) do
@dhh
dhh / linux-setup.sh
Last active October 30, 2025 22:31
linux-setup.sh
# THIS LINUX SETUP SCRIPT HAS MORPHED INTO A WHOLE PROJECT: HTTPS://OMAKUB.ORG
# PLEASE CHECKOUT THAT PROJECT INSTEAD OF THIS OUTDATED SETUP SCRIPT.
#
#
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
@rameerez
rameerez / exit_the_cloud.md
Last active November 25, 2025 22:41
☁️ How I got off the cloud and migrated everything from AWS to a VPS in Hetzner

☁️ How I got off the cloud and migrated everything from AWS to a VPS in Hetzner

This is an opinionated handbook on how I migrated all my Rails apps off the cloud and into VPS.

This is how I manage real production loads for my Rails apps. It assumes:

  • Rails 7+
  • Ruby 3+
  • PostgreSQL
  • Ubuntu Server 24.04
  • Capistrano, Puma, Nginx
@tobz
tobz / steps.md
Last active November 30, 2025 04:01
Migrate Radarr from SQLite to Postgres

Migration steps

  1. Upgrade Radarr to at least v4.1.0.6133 or newer. This brings in support for Postgres. This will also ensure that all of your SQLite tables have the latest schema migrations applied before we migrate to Postgres. If you want to upgrade further, that's fine too, but make sure you've completed all upgrades first before continuing.
  2. Create your Postgres databases (one for the "main" database and one for the "logs" database) and configure Radarr with the relevant Postgres credentials. Both databases need to be owned by/accessible from the same Postgres user.
  3. Restart Radarr, and ensure it connects to Postgres and runs all schema migrations.
  4. Once all schema migrations have been applied, and no other activity is occurring, stop Radarr.
  5. Copy the SQLite databases from the Radarr instance/pod, both the main database and logs database. For this guide, we'll assume these files are called radarr.db and logs.db.
  6. Using pg_dump -s, dump the schema for the main Radarr database . P
@stevendborrelli
stevendborrelli / crossplane-1.14.md
Last active April 26, 2025 07:09
Crossplane 1.14 Overview

A Tour of Crossplane 1.14

Crossplane is an Open-Source project that enables management of almost anything in the Cloud via the Kubernetes API.

Crossplane version 1.14 released November 1, 2023, is one of the most consequential releases in the project's history.

While Composition Functions and Provider performance improvements are headline features, there are substantial updates across the project: from a focus on developer and operator experience, Upbound's code donation to the CNCF, to API maturation.

This Document was updated November 7, 2023.

@kconner
kconner / macOS Internals.md
Last active November 6, 2025 09:43
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

LiveView Native Livebook

Mix.install(
  [
    {:plug_cowboy, "~> 2.5"},
    {:jason, "~> 1.0"},
    {:phoenix, "~> 1.7.2", override: true},
    {:phoenix_live_view, "~> 0.18.2"},
    {:phoenix_live_reload, "~> 1.4.1", override: true},
@LostKobrakai
LostKobrakai / form_live.ex
Last active June 3, 2025 14:28
Phoenix LiveView form with nested embeds and add/delete buttons
defmodule NestedWeb.FormLive do
use NestedWeb, :live_view
require Logger
defmodule Form do
use Ecto.Schema
import Ecto.Changeset
embedded_schema do
field :name, :string