Skip to content

Instantly share code, notes, and snippets.

@dominicletz
dominicletz / ci.yml
Last active March 25, 2021 14:51
Activate msys2 64bit on windows-latest github actions target
name: "CI"
on: ["push", "pull_request"]
jobs:
build_and_test:
name: "Run tests and build artifacts"
strategy:
matrix:
os: ["windows-latest", "ubuntu-latest", "macOS-latest"]
go: ["1.14.x"]
@dominicletz
dominicletz / find_fragmentation.erl
Created June 2, 2020 16:21
Erlang script to show used vs. allocated carrier sizes to find impact of memory fragmentation
f().
Str = fun(X) -> io_lib:format("~p", [X]) end.
Percent = fun
(A, 0) -> "100%";
(A, B) -> [Str(round(100*A/B)), "%"]
end.
Get = fun
@dominicletz
dominicletz / wx.ex
Created October 5, 2020 12:35
wx.ex
defmodule Wx do
@vsn "0.0.2"
@author "Onorio Catenacci"
@author "Dominic Letz"
@last_revision_date "22 May 2019"
@moduledoc """
Elixir version of the constants found in the wx.hrl file
"""
import Bitwise
require Record
@dominicletz
dominicletz / output.log
Created June 26, 2024 08:35
Test JIT optimizer
>elixir test.exs
Operating System: Linux
CPU Information: AMD Ryzen 9 6900HS with Radeon Graphics
Number of Available Cores: 16
Available memory: 30.58 GB
Elixir 1.17.0
Erlang 26.2.3
JIT enabled: true
Benchmark suite executing with the following configuration:
@dominicletz
dominicletz / find_fragmentation.exs
Created September 12, 2024 15:19
Script to see beam memory fragmentation
percent = fn
_a, 0 -> "100%"
a, b -> "#{round(100 * a / b)}%"
end
get = fn
nil, _key -> 0
info, key ->
elem(List.keyfind(info, key, 0), 1)
end
@dominicletz
dominicletz / parse_error.exs
Last active February 6, 2025 11:50
Parse BEAM errors from DeviceCloud logs
#!/usr/bin/env elixir
Mix.install([:jason])
filename =
case System.argv() do
[filename] ->
filename
_ ->
IO.puts("Missing filename")