Skip to content

Instantly share code, notes, and snippets.

View carlgleisner's full-sized avatar

Carl Gleisner carlgleisner

View GitHub Profile
@by-nari
by-nari / readme.md
Last active May 6, 2025 18:16
1Password commit signing inside devcontainers
defmodule YourAPp.Gotenberg.Api do
alias YourApp.Gotenberg.Options
require Logger
@timeout 30_000
@doc """
Converts given URL to a PDF binary
"""
@spec html_to_pdf(binary, Options.t()) :: {:ok, binary} | {:error, any}

Comparing usage of Ash & Ecto

# https://gist.github.com/Gazler/b4e92e9ab7527c7e326f19856f8a974a

Application.put_env(:phoenix, :json_library, Jason)

Application.put_env(:sample, SamplePhoenix.Endpoint,
  http: [ip: {127, 0, 0, 1}, port: 5001],
  server: true,
@brainlid
brainlid / .iex.exs
Created April 2, 2024 12:52
My .iex.exs file that lives in my Home directory. Gets loaded and used in every IEx session on my machines. I borrowed and stole all the great ideas from others an tweaked them over the years.
Application.put_env(:elixir, :ansi_enabled, true)
# IEx shell customization for color
# - Added as a comment: https://thinkingelixir.com/course/code-flow/module-1/pipe-operator/
# - Original source: https://samuelmullen.com/articles/customizing_elixirs_iex/
# - Can add to a specific project or can put in the User home folder as a global config.
# Updates from:
# - https://github.com/am-kantox/finitomata/blob/48e1b41b21f878e9720e6562ca34f1ce7238d810/examples/ecto_intergation/.iex.exs
timestamp = fn ->
{_date, {hour, minute, _second}} = :calendar.local_time
Application.put_env(:example, Example.Endpoint,
server: true,
http: [ip: {127, 0, 0, 1}, port: 4001],
adapter: Bandit.PhoenixAdapter,
render_errors: [formats: [html: Example.ErrorHTML], layout: false],
live_view: [signing_salt: "aaaaaaaa"],
secret_key_base: String.duplicate("a", 64)
)
Application.put_env(:ex_money, :default_cldr_backend, Example.Cldr)
@c0m4r
c0m4r / freebsd_ovh_vps.md
Last active November 16, 2025 22:49
FreeBSD installation on OVH VPS

FreeBSD installation on OVH VPS

OVH now offers FreeBSD as a distro choice, however you might still want to install a specific version yourself or choose another root filesystem. In such case - this guide is for you.

This guide explains how to install the FreeBSD on OVH VPS. This might also work for other VPS providers with the proper rescue system in place.

Inspired by https://www.klajnszmit.net/unix-bsd-linux/openbsd-on-ovh-vps

Table of contents:

@caspg
caspg / 1_searchbar_live.ex
Last active September 28, 2025 22:09
Example of real-time search bar implementation in Phoenix LiveView and Tailwind. Working example on https://travelermap.net/parks/usa
defmodule TravelerWeb.SearchbarLive do
use TravelerWeb, :live_view
alias Phoenix.LiveView.JS
alias Traveler.Places
def mount(_params, _session, socket) do
socket = assign(socket, places: [])
{:ok, socket, layout: false}
end
@zblanco
zblanco / getting_lazy_with_dataflow_graphs_in_elixir.livemd
Last active August 25, 2025 06:02
Getting Lazy with Dataflow Graphs in Elixir

Getting Lazy with Dataflow Graphs in Elixir

Intro

What do Tensorflow, Apache Airflow, Rule Engines, and Excel have in common?

Under the hood they all use DAGs to model data-flow dependencies of the program. Using graphs to model programs is great because you can modify the program at runtime. Lets talk about doing this in Elixir for great good.

@theodorosploumis
theodorosploumis / Nework_throttling_profiles.md
Last active November 28, 2025 03:24
Web development - Custom network throttling profiles
Profile download (kb/s) upload (kb/s) latency (ms)
Native 0 0 0
GPRS 50 20 500
56K Dial-up 50 30 120
Mobile EDGE 240 200 840
2G Regular 250 50 300
2G Good 450 150 150
3G Slow 780 330 200
@qpre
qpre / elixir.yml
Created January 28, 2020 15:07
GitHub Actions for Elixir/Phoenix test/build/release + release on GitHub
name: Elixir CI
on: push
jobs:
test:
runs-on: ${{ matrix.os }}
name: OTP ${{ matrix.otp }} | Elixir ${{ matrix.elixir }} | Node ${{ matrix.node }} | OS ${{ matrix.os }}
strategy:
matrix: