Skip to content

Instantly share code, notes, and snippets.

View shamshirz's full-sized avatar
💾
Hello World

Aaron Votre shamshirz

💾
Hello World
  • Corvus Insurance
  • Boston, MA
View GitHub Profile
@shamshirz
shamshirz / analyze_test_results.exs
Last active April 12, 2024 19:24
Analyze the Elixir test time output by `MIX_DEBUG=1`
### CMD Example : Partition & Cover (73s)
# MIX_TEST_PARTITION=1 MIX_DEBUG=1 mix test test/crowbar/scan/vciso_card_test.exs --partitions 2 --cover > tmp.txt && elixir ./analyze.exs
#
# Total Running time: 73.277s
# Total Test time: 54.554s
# Partial test time: 5.2s
# Unaccounted for test time: 49.354s
# Note: The total time isn't right because some of the steps are nested, meaning duplicate counts of time
# eg. start deps.loadpaths, start archive.check, end archive.check Xms, end deps.loadpaths X+Yms
@shamshirz
shamshirz / git_log_cruncher.exs
Created July 27, 2023 18:31
Elixir Script to parse local gitlog data and produce aggregate data
# `elixir git_log_cruncher.exs`
Mix.install([
{:timex, "~> 3.5"}
])
defmodule PR do
defstruct [:hash, :number, :title, :file_count, :insertions, :deletions]
@type t() :: %{
hash: String.t(),
@shamshirz
shamshirz / application.ex
Created June 4, 2023 16:03
Liveview PubSub Example
defmodule App.Application do
@impl true
def start(_type, _args) do
children = [
{App.ScanTracker, []} # <- Add this line
]
opts = [strategy: :one_for_one, name: App.Supervisor]
Supervisor.start_link(children, opts)
@shamshirz
shamshirz / a.ex
Created January 18, 2023 21:32
Example of Elixir Compilation Dependencies
defmodule A do
@moduledoc """
# Run yourself my doing a `mix new example` and then copying these files in a.ex, b.ex, c.ex, c2.ex
# Start - show incremental compile works
* mix compile
# Add `elixirc_options: [verbose: true],` to mix.exs
* mix compile
# Change A, recompile
@shamshirz
shamshirz / test_concurrency.py
Created February 4, 2022 20:44
asyncio practice
import asyncio
import time
async def await_sleep():
await asyncio.create_task(sleep())
async def await_multiple():
task1 = asyncio.create_task(sleep())
@shamshirz
shamshirz / fixmacpostgres.sh
Created October 20, 2020 20:35
Troubleshooting a homebrew installed postgres
# How did you discover the issue?
# Elixir
# 15:22:11.284 [error] GenServer #PID<0.3763.0> terminating
#** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
# psql
# psql -h 127.0.0.1 -d postgres -U postgres -d crowbar_test
# Hunches about what went wrong. Homebrew upgrade or OS upgrade corrupted the data. We did something foolish?