This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import time | |
async def await_sleep(): | |
await asyncio.create_task(sleep()) | |
async def await_multiple(): | |
task1 = asyncio.create_task(sleep()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `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(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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 |