Skip to content

Instantly share code, notes, and snippets.

View dkarter's full-sized avatar

Dorian Karter dkarter

View GitHub Profile

Automate Your Elixir Deployments - Part 1 - Ansible

Summary

This post will guide you through automating a "bare-metal" machine configuration, and getting a server ready for building and deploying Elixir / Phoenix applications (with LiveView support!)

Body

name: Elixir CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
MIX_ENV: test
defmodule KingOfTokyoWeb.ChatComponent do
@moduledoc """
Displays the chat history and allows sending new messages
"""
use KingOfTokyoWeb, :live_component
@impl true
def handle_event("send-message", %{"body" => body}, socket) do
send(self(), {:send_message, body})
@dkarter
dkarter / error.log
Last active March 14, 2022 17:47
ASDF Erlang Failed Install Log (POP_OS)
/home/dorian/.asdf/plugins/erlang/kerl-home/builds/asdf_24.2/otp_src_24.2/configure --cache-file=/dev/null CC=clang CPPFLAGS=-I/usr/local/opt/qt/include\ -I/usr/local/opt/openssl\@1\.1/include LDFLAGS=-L/usr/local/opt/qt/lib\ -L/usr/local/opt/openssl\@1\.1/lib --with-ssl=/usr/include/openssl
=== Running configure in /home/dorian/.asdf/plugins/erlang/kerl-home/builds/asdf_24.2/otp_src_24.2/erts ===
./configure 'CC=clang' 'CPPFLAGS=-I/usr/local/opt/qt/include -I/usr/local/opt/[email protected]/include' '--with-ssl=/usr/include/openssl' LDFLAGS='-L/usr/local/opt/qt/lib -L/usr/local/opt/[email protected]/lib' --disable-option-checking --cache-file=/dev/null --srcdir="/home/dorian/.asdf/plugins/erlang/kerl-home/builds/asdf_24.2/otp_src_24.2/erts"
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether
@dkarter
dkarter / migrate.exs
Created June 28, 2022 20:00
Migrate TypeScript/Javascript projects from relative to absolute paths
relative_to_absolute = fn relative_path, importing_file ->
Path.expand(relative_path, Path.dirname(importing_file))
|> String.split("src/")
|> List.last()
end
Path.wildcard('src/**/*.{ts,tsx}')
|> Enum.each(fn file ->
IO.puts("Migrating #{file}...")
contents = File.read!(file)
@dkarter
dkarter / snippet.liquid
Created December 14, 2022 20:19
Malomo Tracking Block Theme 1.0 Snippet
{%- style -%}
{% assign header_font = section.settings.header_font %}
{{ header_font | font_face }}
{% assign header_font_bold = header_font | font_modify: 'weight', 'bolder' %}
{% assign header_font_italic = header_font | font_modify: 'style', 'italic' %}
{% assign header_font_bold_and_italic = header_font_bold | font_modify: 'style', 'italic' %}
{{ header_font_bold | font_face }}
@dkarter
dkarter / malomo tracking page url.md
Last active February 14, 2023 19:04
Malomo Tracking Page URL

Get Tracking Page URL

Returns the tracking page url for an account + order/return

API URL

https://api.gomalomo.com/public/tracking_pages/url

Parameters

@dkarter
dkarter / Taskfile.dist.yml
Last active March 9, 2025 16:01
Elixir CI
# yaml-language-server: $schema=https://taskfile.dev/schema.json
# NOTE: this file lives in the root of your project
version: 3
includes:
ci:
taskfile: ./taskfiles/ci.yml
# I have the phoenix app in ./app, so setting the dir here ensures that all the tasks below run inside that cwd
@dkarter
dkarter / scan_repos_for_secrets_parallel.sh
Last active July 14, 2025 14:18
scan all your repos for secrets
#!/bin/bash
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color