Increment version [ci skip]

Increment version [ci skip]

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/edenlabllc/ehealth.api.git/'


Increment version [ci skip]

Increment version [ci skip]


Add test for filter expansion

Add test for filter expansion

defmodule Api.Documents.FilterTest do
  import Core.Utils
  alias Api.Documents.Filter
  alias Core.ProjectConfigLoader
  use ExUnit.Case

  test "expand" do
    start_supervised({ProjectConfigLoader, {"resources/projects", ["default"]}})
    conf = ProjectConfigLoader.get("default")

    filters = [
      {"resource.category.name", "Find"},
      {"resource.category.name", "Layer"},
      {"project", "test"}
    ]

    expanded_filters = Filter.expand(filters, conf)
    expanded_categories = for {"resource.category.name", c} <- expanded_filters, do: c

    subcategories = Enum.find(conf, &(&1.item.name == "Find"))
      |> (fn find -> Enum.map(find.trees, &(&1.item.name)) end).()

    assert Enum.all?(subcategories, &(&1 in expanded_categories))

  end
end

error: pathspec 'api/test/unit/api/documents/filter_test.exs' did not match any file(s) known to git


more complex matches

more complex matches

list = [1, 2, 3]
[a, b, c] = list

IO.puts a
IO.puts b
IO.puts c

error: pathspec 'elixir/3.exs' did not match any file(s) known to git


fix: ael logging (#4564)

fix: ael logging (#4564)


restructures docs

restructures docs

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/elixytics/report.git/'


more pattern matching

more pattern matching

list = [1, 2, 3]
[a, 2, b] = list

IO.puts a
IO.puts b

error: pathspec 'elixir/5.exs' did not match any file(s) known to git


replace guard with pattern match

replace guard with pattern match

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/atweiden/scripts.git/'


add migration

add migration

defmodule Org.Repo.Migrations.CreateUser do
  use Ecto.Migration

  def change do
    create table(:users, primary_key: false) do
      add :id, :binary_id, primary_key: true
      add :avatar, :string
      add :bio, :string
      add :blog, :string
      add :company, :string
      add :created_at, :string
      add :email, :string
      add :followers, :integer
      add :following, :integer
      add :hireable, :boolean, default: false
      add :html_url, :string
      add :github_id, :integer
      add :location, :string
      add :login, :string
      add :name, :string
      add :public_gists, :integer
      add :public_repos, :integer
      add :role, :string, default: "user"
      add :type, :string

      timestamps
    end
    create unique_index(:users, [:github_id])

  end
end

error: pathspec 'priv/repo/migrations/20160320075955_create_user.exs' did not match any file(s) known to git


Refactor motion detection controller

Refactor motion detection controller

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/evercam/evercam-media.git/'


Bump version to 0.6.0

Bump version to 0.6.0

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/preciz/insta_scrapex.git/'


Serialize also board_id

Serialize also board_id

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/gtcode/phoenix-trello.git/'


Add a user type for our absinthe schema

Add a user type for our absinthe schema

defmodule TimeTrackerBackend.Schema.Types do
  use Absinthe.Schema.Notation

  object :user do
    field :id, :id
    field :name, :string
    field :gender, :string
    field :email, :string
    field :username, :string
    field :is_active, :boolean
    field :avatar, :string
  end
end

error: pathspec 'time_tracker_backend/web/schema/types.ex' did not match any file(s) known to git


Added run length encoding solution.

Added run length encoding solution.

#!/usr/bin/env elixir

# PROBLEM:
#   Write a routine that run length encodes strings.
#   You may use any language.
#   Example Input  : abbbccddddddefff
#   Example Output : a1b3c2d6e1f3

# A single file solution written in Elixir follows.
# This solution also includes a routine to run length decode strings.
# To see a list of the command line arguments, run the following.
#   chmod +x rle.exs
#   ./rle.exs --help
# Examples:
#   ./rle.exs abbbccddddddefff
#   ./rle.exs -s abbbccddddddefff
#   ./rle.exs -d a1b3c2d6e1f3
#   ./rle.exs -d ab3c2d6ef3

defmodule RLE do
  defp encoder(pItem, {pItem, pCount, pOutput}), do: {pItem, pCount + 1, pOutput}
  defp encoder(pNewItem, {pItem, pCount, pOutput}), do: {pNewItem, 1, finishEncodingItem({pItem, pCount, pOutput})}
  defp finishEncodingItem({nil, _pCount, pOutput}), do: pOutput
  defp finishEncodingItem({pItem, 0, pOutput}), do: pOutput ++ [{pItem, 1}] # for short decoding
  defp finishEncodingItem({pItem, pCount, pOutput}), do: pOutput ++ [{pItem, pCount}]

  def encode(pInputList) do
    pInputList
    |> Enum.reduce({nil, 0, []}, &encoder/2)
    |> finishEncodingItem()
  end

  defp itemToString(pItem, 1, true), do: "#{pItem}" # short encoding
  defp itemToString(pItem, pCount, _), do: "#{pItem}#{pCount}"

  def encodeString(pInputString, pShortEncoding \\ false) do
    pInputString
    |> String.to_charlist
    |> Enum.map(&(to_string([&1])))
    |> encode
    |> Enum.map(fn {pItem, pCount} -> itemToString(pItem, pCount, pShortEncoding) end)
    |> Enum.reverse
    |> Enum.reduce("", &Kernel.<>/2)
  end

  def decode(pInputList) do
    pInputList
    |> Enum.map(fn {pItem, pCount} -> List.duplicate(pItem, pCount) end)
    |> Enum.reverse
    |> Enum.reduce([], &Kernel.++/2)
  end

  defp stringDecoder(pCharacter, {pItem, pCount, pOutput}) when pCharacter in ?0..?9, do: {pItem, pCount * 10 + pCharacter - ?0, pOutput}
  defp stringDecoder(pCharacter, {pItem, pCount, pOutput}), do: {pCharacter, 0, finishEncodingItem({pItem, pCount, pOutput})}

  def decodeString(pInputString) do
    pInputString
    |> String.to_charlist
    |> Enum.reduce({nil, 0, []}, &stringDecoder/2)
    |> finishEncodingItem()
    |> decode
    |> Enum.map(&(to_string([&1])))
    |> Enum.reverse
    |> Enum.reduce("", &Kernel.<>/2)
  end
end

defmodule Script do
  def main(args) do
    defaults = [
      decode: false,
      short: false,
      help: false,
    ]
    switches = [
      decode: :boolean,
      short: :boolean,
      help: :boolean,
    ]
    aliases = [
      d: :decode,
      s: :short,
      "?": :help,
    ]
    {parsed, remaining, invalid} = OptionParser.parse(args, strict: switches, aliases: aliases)
    options = defaults
    |> Keyword.merge(parsed)
    cond do
      options[:help] or (0 < length invalid) ->
        usage
      true ->
        process(remaining, options)
    end
  end

  def usage() do
    IO.puts("Run length encode (or decode) input strings.")
    IO.puts("Usage:")
    IO.puts("  rle [--decode] STRING_A [STRING_B ...]")
    IO.puts("    --short  : do not encode 1 after run length 1 items")
    IO.puts("    -s       : do not encode 1 after run length 1 items")
    IO.puts("    --decode : decode strings instead of encoding them")
    IO.puts("    -d       : decode strings instead of encoding them")
    IO.puts("    --help   : display this usage summary")
    IO.puts("    -?       : display this usage summary")
    IO.puts("Examples:")
    IO.puts("  rle abbbccddddddefff")
    IO.puts("  rle -s abbbccddddddefff")
    IO.puts("  rle -d a1b3c2d6e1f3")
    IO.puts("  rle -d ab3c2d6ef3")
  end

  def process(pSetList, pOptions) do
    decode = pOptions[:decode]
    short = pOptions[:short]
    pSetList
    |> Enum.map(fn pInputString -> encodeString(pInputString, decode, short) end)
    |> Enum.each(&IO.puts/1)
  end

  def encodeString(pInputString, false, pShort), do: RLE.encodeString(pInputString, pShort)
  def encodeString(pInputString, true, _pShort), do: RLE.decodeString(pInputString)
end

Script.main(System.argv)

error: pathspec 'rle.exs' did not match any file(s) known to git


Remove unused S3 module

Remove unused S3 module


sorted post by descending creation time

sorted post by descending creation time

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/udia-software/udia.git/'


Add stricter check for camera share endpoint

fatal: unable to access 'https://github.com/evercam/evercam-media.git/': The requested URL returned error: 403


Whitespace

Whitespace


configuring extwitter

configuring extwitter

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/bit-engine/dustbin.git/'


chore: recursively output file content

chore: recursively output file content

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/rockdragon/julia-programming.git/'


feat: added reason and reason description to declarations to fraud db (#4204)


Adds a generic Enum type for Status on the database level

defmodule CoursePlanner.Repo.Migrations.CreateEntityStatus do
  use Ecto.Migration

  def change do
    execute("""
          CREATE TYPE entity_status AS ENUM (
            'Planned',
            'Active',
            'Finished',
            'Graduated',
            'Frozen',
            'Deleted'
          )
        """)
  end
end

error: pathspec 'priv/repo/migrations/20170419143747_create_entity_status.exs' did not match any file(s) known to git


Add partnership migration

Add partnership migration

fatal: unable to access 'https://github.com/melbystyle/jw_ministry_api.git/': The requested URL returned error: 403


ets based registry (definitely not for production)

defmodule SimpleRegistry do
  use GenServer

  def start_link do
    GenServer.start_link(__MODULE__, nil, name: __MODULE__)
  end

  def register(key) do
    # Thereis a long explanation why we have to link first and then update
    # ets tables. (Possible race condition :((((( non language is perfect)
    Process.link(Process.whereis(__MODULE__))

    # Good registry implementation could be found here.
    # https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/registry.ex
    if :ets.insert_new(__MODULE__, {key, self()}) do
      :ok
    else
      :error
    end
  end

  def whereis(key) do
    case :ets.lookup(__MODULE__, key) do
      [{^key, pid}] -> pid
      [] -> nil
    end
  end

  @impl GenServer
  def init(_) do
    Process.flag(:trap_exit, true)
    :ets.new(__MODULE__, [:named_table, :public, write_concurrency: true])
    {:ok, nil}
  end

  @impl GenServer
  def handle_info({:EXIT, pid, _reason}, _) do
    {:noreply, remove_by_pid(pid)}
  end

  def handle_info(other, state) do
    super(other, state)
  end

  defp remove_by_pid(pid) do
    :ets.match_delete(__MODULE__, {:_, pid})
  end
end

# SimpleRegistry.start_link() # PID<...>
# SimpleRegistry.register(:some_name) # :ok
# SimpleRegistry.register(:some_name) # :error
# SimpleRegistry.whereis(:some_name) # PID<...>
# SimpleRegistry.whereis(:unregistered_name) # nil

error: pathspec 'elixir/registry/ets.ex' did not match any file(s) known to git


Handle streaming when camera doesn't exist


Add ElixirValidatorTest

Add ElixirValidatorTest

defmodule Serum.Project.ElixirValidatorTest do
  @moduledoc """
  Tests for `Serum.Project.ElixirValidator`

  The purpose of this module is to check whether the input (an Elixir term
  generated by evaluating `serum.exs`) is a valid Serum project definition.

  An Elixir term `t` is a valid Serum project definition if all of the
  conditions below is true:

  - `t` is a map.
  - `t` contains all the required keys.
  - `t` does not contain any undefined key, which is neither of the required
    keys nor the optional keys.
  - Any value associated with a key in `t` does not violate the constraints
    specific to that key.
  """

  use ExUnit.Case
  import Serum.Project.ElixirValidator

  @test_path "/test/serum.exs"

  @base_map %{
    site_name: "Test Site",
    site_description: "This is a test site.",
    author: "John Doe",
    author_email: "john.doe@example.com",
    base_url: "/"
  }

  describe "validate/2" do
    test "good, contains required keys only" do
      assert :ok = validate(@base_map, @test_path)
    end

    test "good, also contains optional keys" do
      map =
        Map.merge(@base_map, %{
          server_root: "https://example.com/test",
          date_format: "{WDfull}, {D} {Mshort} {YYYY}",
          list_title_all: "All posts",
          list_title_tag: "Posts about ~s",
          pagination: true,
          posts_per_page: 10,
          preview_length: 200
        })

      assert :ok = validate(map, @test_path)
    end

    test "not a map" do
      assert {:error, _} = validate(:foo, @test_path)
    end

    test "missing one required key" do
      map = Map.delete(@base_map, :base_url)
      {:error, {msg, @test_path, _}} = validate(map, @test_path)

      assert String.starts_with?(msg, "missing required property:")
    end

    test "missing multiple required keys" do
      map = Map.drop(@base_map, [:base_url, :site_description])
      {:error, {msg, @test_path, _}} = validate(map, @test_path)

      assert String.starts_with?(msg, "missing required properties:")
    end

    test "one extra key" do
      map = Map.put(@base_map, :foo, :bar)
      {:error, {msg, @test_path, _}} = validate(map, @test_path)

      assert String.starts_with?(msg, "unknown property:")
    end

    test "multiple extra keys" do
      map =
        @base_map
        |> Map.put(:foo, :bar)
        |> Map.put(:lorem, "ipsum")

      {:error, {msg, @test_path, _}} = validate(map, @test_path)

      assert String.starts_with?(msg, "unknown properties:")
    end

    test "constraint check 1" do
      map = Map.put(@base_map, :base_url, "hello")
      {:error, {_, l}} = validate(map, @test_path)

      assert length(l) == 1
    end

    test "constraint check 2" do
      map =
        Map.merge(@base_map, %{
          base_url: "hello",
          server_root: "htttps://foo.bar/baz",
          date_format: 3,
          posts_per_page: 0,
          preview_length: -1
        })

      {:error, {_, l}} = validate(map, @test_path)

      assert length(l) == 5
    end
  end
end

error: pathspec 'test/serum/project/elixir_validator_test.exs' did not match any file(s) known to git


Add TweetBufferFiller module

Add TweetBufferFiller module

defmodule EmojiMap.TweetBufferFiller do
  @moduledoc """
  Starts the TweetBroadcaster and multiple TweetPrinter. Then starts the
  Twitter Stream in a seperate process via Task.async so that we don't block
  our console. This should probably be done in a GenServer.
  """

  alias EmojiMap.TweetBroadcaster
  alias EmojiMap.TweetConsumer
  alias EmojiMap.TwitterStream

  def start() do
    try do
      TweetBroadcaster.start_link()

      # start multiple producers
      TweetConsumer.start_link()
      TweetConsumer.start_link()

      task = Task.async(fn ->
        TwitterStream.get_emoji_stream()
        # Here the interesting part happens. We Stream.map the notify function of the TweetBroadcaster in the stream. As soon as we enumerate over the stream (via Enum.to_list/1) every tweet will be sent to the TweetBroadcaster and from there broadcasted to all consumers (or kept in a queue)
        |> Stream.map(&TweetBroadcaster.sync_notify(&1))
        |> Enum.to_list()
      end)
      Task.await(task, 1000) # one sec
    catch
      :exit, {:timeout, {Task, :await, [_, 1000]}} ->
        {:allgood, :catch}
    end
  end
end

error: pathspec 'backend/lib/emoji_map/tweet_buffer_filler.ex' did not match any file(s) known to git


Dont add Content-type for get requests

Dont add Content-type for get requests

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/edenlabllc/ehealth.api.git/'


Added test for user being signed up with share_request_key (#471)

* Added test for user being signed up with share_request_key

* Changed test to check confirmed at value not nil

* Refactored code


Added numbers test

Added numbers test

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/pap/elixirscript.git/'


add missing comma

add missing comma

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/3zcurdia/worldb.git/'


More tests: FarmbotFirmware.UARTTransport.{open, reset}

use Mix.Config

if Mix.env() == :test do
  config :farmbot_firmware, :uart_adapter, FarmbotFirmware.UartTestAdapter
else
  IO.puts("!!!!!!!!! On CircleCI, Mix.env() == " <> Mix.env())
end

error: pathspec 'farmbot_firmware/config/config.exs' did not match any file(s) known to git


Create README.ex

Create README.ex

initial commit

# Overview
Apache nifi supports powerful and scalable directed graphs of data routing, transformation, and system mediation logic. Some of the high-level capabilities and objectives of Apache NiFi include:
Web-based user interface
	Seamless experience between design, control, feedback, and monitoring
Highly configurable
	Loss tolerant vs guaranteed delivery
	Low latency vs high throughput
	Dynamic prioritization
	Flow can be modified at runtime
	Back pressure
Data Provenance
	Track dataflow from beginning to end
Designed for extension
	Build your own processors and more
	Enables rapid development and effective testing
Secure
	SSL, SSH, HTTPS, encrypted content, etc...
	Pluggable role-based authentication/authorization
# Installation
 To deploy this charm you will need at a minimum: a cloud environment,
 working Juju installation and a successful bootstrap.

error: pathspec 'README.ex' did not match any file(s) known to git


Skip camera test with a warning

Skip camera test with a warning

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/evercam/evercam-media.git/'


Configure credo linting rules

Configure credo linting rules

# This file contains the configuration for Credo and you are probably reading
# this after creating it with `mix credo.gen.config`.
#
# If you find anything wrong or unclear in this file, please report an
# issue on GitHub: https://github.com/rrrene/credo/issues
#
%{
  #
  # You can have as many configs as you like in the `configs:` field.
  configs: [
    %{
      #
      # Run any config using `mix credo -C <name>`. If no config name is given
      # "default" is used.
      name: "default",
      #
      # these are the files included in the analysis
      files: %{
        #
        # you can give explicit globs or simply directories
        # in the latter case `**/*.{ex,exs}` will be used
        included: ["lib/", "src/", "web/", "apps/"],
        excluded: [~r"/_build/", ~r"/deps/"]
      },
      #
      # If you create your own checks, you must specify the source files for
      # them here, so they can be loaded by Credo before running the analysis.
      requires: [],
      #
      # Credo automatically checks for updates, like e.g. Hex does.
      # You can disable this behaviour below:
      check_for_updates: true,
      #
      # You can customize the parameters of any check by adding a second element
      # to the tuple.
      #
      # To disable a check put `false` as second element:
      #
      #     {Credo.Check.Design.DuplicatedCode, false}
      #
      checks: [
        {Credo.Check.Consistency.ExceptionNames},
        {Credo.Check.Consistency.LineEndings},
        {Credo.Check.Consistency.SpaceAroundOperators},
        {Credo.Check.Consistency.SpaceInParentheses},
        {Credo.Check.Consistency.TabsOrSpaces},

        # For some checks, like AliasUsage, you can only customize the priority
        # Priority values are: `low, normal, high, higher`
        {Credo.Check.Design.AliasUsage, priority: :low},

        # For others you can set parameters

        # If you don't want the `setup` and `test` macro calls in ExUnit tests
        # or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
        # set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
        {Credo.Check.Design.DuplicatedCode, excluded_macros: []},

        # You can also customize the exit_status of each check.
        # If you don't want TODO comments to cause `mix credo` to fail, just
        # set this value to 0 (zero).
        {Credo.Check.Design.TagTODO, exit_status: 2},
        {Credo.Check.Design.TagFIXME},

        {Credo.Check.Readability.FunctionNames},
        {Credo.Check.Readability.LargeNumbers},
        {Credo.Check.Readability.MaxLineLength, false},
        {Credo.Check.Readability.ModuleAttributeNames},
        {Credo.Check.Readability.ModuleDoc},
        {Credo.Check.Readability.ModuleNames},
        {Credo.Check.Readability.PredicateFunctionNames},
        {Credo.Check.Readability.TrailingBlankLine},
        {Credo.Check.Readability.TrailingWhiteSpace},
        {Credo.Check.Readability.VariableNames},

        {Credo.Check.Refactor.ABCSize},
        # {Credo.Check.Refactor.CaseTrivialMatches}, # deprecated in 0.4.0
        {Credo.Check.Refactor.CondStatements},
        {Credo.Check.Refactor.FunctionArity},
        {Credo.Check.Refactor.MatchInCondition},
        {Credo.Check.Refactor.PipeChainStart, false},
        {Credo.Check.Refactor.CyclomaticComplexity},
        {Credo.Check.Refactor.NegatedConditionsInUnless},
        {Credo.Check.Refactor.NegatedConditionsWithElse},
        {Credo.Check.Refactor.Nesting},
        {Credo.Check.Refactor.UnlessWithElse},

        {Credo.Check.Warning.IExPry},
        {Credo.Check.Warning.IoInspect},
        {Credo.Check.Warning.NameRedeclarationByAssignment},
        {Credo.Check.Warning.NameRedeclarationByCase},
        {Credo.Check.Warning.NameRedeclarationByDef},
        {Credo.Check.Warning.NameRedeclarationByFn},
        {Credo.Check.Warning.OperationOnSameValues},
        {Credo.Check.Warning.BoolOperationOnSameValues},
        {Credo.Check.Warning.UnusedEnumOperation},
        {Credo.Check.Warning.UnusedKeywordOperation},
        {Credo.Check.Warning.UnusedListOperation},
        {Credo.Check.Warning.UnusedStringOperation},
        {Credo.Check.Warning.UnusedTupleOperation},
        {Credo.Check.Warning.OperationWithConstantResult},

        # Custom checks can be created using `mix credo.gen.check`.
        #
      ]
    }
  ]
}

error: pathspec '.credo.exs' did not match any file(s) known to git


Add keyword const

Add keyword const

defmodule Xema.ConstTest do
  use ExUnit.Case, async: true

  import Xema, only: [validate: 2]

  describe "keyword not:" do
    setup do
      %{schema: Xema.new(const: 42)}
    end

    test "type", %{schema: schema} do
      assert schema.content.type == :any
    end

    test "validate/2 with a valid value", %{schema: schema} do
      assert validate(schema, 42) == :ok
    end

    test "validate/2 with an invalid value", %{schema: schema} do
      assert validate(schema, 1) == {:error, %{const: 42, value: 1}}
    end
  end
end

error: pathspec 'test/xema/const_test.exs' did not match any file(s) known to git


git-svn-id: http://monkey-stuff.googlecode.com/svn/trunk@145 aaeee498-0047-0410-bd38-07bdd6096719

error: RPC failed; HTTP 403 curl 22 The requested URL returned error: 403
fatal: the remote end hung up unexpectedly


pipe operator

pipe operator

error: pathspec 'elixir/58.exs' did not match any file(s) known to git


binary

binary

bin = <<1, 2>>

bin
|> IO.inspect

bin
|> byte_size
|> IO.puts

error: pathspec 'elixir/24.exs' did not match any file(s) known to git


Fix credo/dogma issue

Fix credo/dogma issue


elixirPracticeSamples: decisionMakingAndStrings.ex - samples of String manipulation

error: pathspec 'elixirPracticeSamples/decisionMakingAndStrings.ex' did not match any file(s) known to git


Increment version [ci skip]

Increment version [ci skip]


Add scope validation on create declaration request(2)


example expect script

example expect script

#!/usr/bin/expect

#If it all goes pear shaped the script will timeout after 20 seconds.
set timeout 20
#Second argument is assigned to the variable user
set user [lindex $argv 0]
#Third argument is assigned to the variable password
set password [lindex $argv 1]
#This spawns the telnet program and connects it to the variable name
spawn telnet creeper.ktwit.net 8080
#The script expects login
expect "username: "
#The script sends the user variable
send "$user\n"
#The script expects Password
expect "password: "
#The script sends the password variable
send "$password\n"
#This hands control of the keyboard over two you (Nice expect feature!)
interact

error: pathspec 'creeper.ex' did not match any file(s) known to git


:+1: Add OTP-Servers-5

:+1: Add OTP-Servers-5

defmodule OtpServer.OtpServer05 do
  use GenServer

  #####
  # External API

  def start_link(current_stack) do
    GenServer.start_link(__MODULE__, current_stack, name: __MODULE__)
  end

  def pop do
    GenServer.call(__MODULE__, :pop)
  end

  def push(elem) do
    GenServer.cast(__MODULE__, {:push, elem})
  end

  #####
  # Server implementations

  def handle_call(:pop, _from, current_stack) do
    [ head | tail ] = current_stack
    { :reply, head, tail }
  end

  # 返事を必要としないのでhandle_cast
  # 戻り値は:noreplyと新しい状態のみ。
  def handle_cast({:push, e}, current_stack) do # 戻さないのでクライアントのPID(from)もいらない。
    if e == 'err' do
      IO.puts 'got err'
      System.halt 0
    end
   { :noreply, [ e | current_stack ]}
  end

  def terminate(state, reason) do
    IO.puts "state : #{inspect state}"
    IO.puts "reason : #{inspect reason}"
  end
end

# $ iex -S mix
# Erlang/OTP 20 [erts-9.0.5] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
#
# Interactive Elixir (1.5.1) - press Ctrl+C to exit (type h() ENTER for help)
# iex(1)> OtpServer.OtpServer05.start_link []
# {:ok, #PID<0.121.0>}
# iex(2)> OtpServer.OtpServer05.pop
# state : {{:badmatch, []}, [{OtpServer.OtpServer05, :handle_call, 3, [file: 'lib/otp-servers05/otp_servers05.ex', line: 23]}, {:gen_server, :try_handle_call, 4, [file: 'gen_server.erl', line: 636]}, {:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 665]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 247]}]}
# reason : []
# ** (EXIT from #PID<0.119.0>) evaluator process exited with reason: an exception was raised:
#     ** (MatchError) no match of right hand side value: []
#         (ch16) lib/otp-servers05/otp_servers05.ex:23: OtpServer.OtpServer05.handle_call/3
#         (stdlib) gen_server.erl:636: :gen_server.try_handle_call/4
# iex(2)> OtpServer.OtpServer05.start_link []
# {:ok, #PID<0.126.0>}
# iex(3)> OtpServer.OtpServer05.push 'err'
# got err
# :ok

error: pathspec 'apps/ch16/lib/otp-servers05/otp_servers05.ex' did not match any file(s) known to git


(37.7%) Begin pin control tests

(37.7%) Begin pin control tests

fatal: unable to access 'https://github.com/FarmBot/farmbot_os.git/': The requested URL returned error: 403


Discard timestamp precision higher than a millisecond


Elixir

Elixir

fatal: unable to access 'https://github.com/amitsaha/learning.git/': The requested URL returned error: 403


elixir hello world

elixir hello world

parent = self()

spawn_link(fn ->
  send parent, {:msg, "hello world"}
end)

receive do
  {:msg, contents} -> IO.puts contents
end

error: pathspec 'elixir/hello.ex' did not match any file(s) known to git


Update mock server for /medication_request

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/edenlabllc/ehealth.api.git/'


Remove unused snapshot fetch module

Remove unused snapshot fetch module


Make JSON type follow MACADDR style

Make JSON type follow MACADDR style


Return :no_comments if there are no media_comments

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/preciz/insta_scrapex.git/'


debug to verbose logging

debug to verbose logging

defmodule Hypnotoad.WebSocket do
  @behaviour :cowboy_websocket_handler
  use Hypnotoad.Common

  def init({:tcp, :http}, _Req, _Opts) do
  	{:upgrade, :protocol, :cowboy_websocket}
  end

  defrecordp :state, subscriptions: nil

  def websocket_init(_transport, req, _opts) do
  	{:ok, req, state(subscriptions: :ets.new(__MODULE__.Subscriptions, []))}
  end

  def websocket_handle({:text, msg}, req, s) do
  	packet = JSEX.decode!(msg)
    L.verbose "Received WebSocket request: ${packet}", packet: packet
    handle_command(packet["command"], packet)
  	{:ok, req, s}
  end

  def websocket_handle(_, req, s) do
  	{:ok, req, s}
  end

  def websocket_info({:send, packet}, req, s) do
    encoded_packet = encode_packet(packet)
  	L.verbose "Sending WebSocket response: ${packet}", packet: JSEX.decode!(encoded_packet)
  	{:reply, {:text, encoded_packet}, req, s}
  end

  def websocket_info({:subscribe, id, event, fun}, req, state(subscriptions: subscriptions) = s) do
  	try do
	  	:gproc_ps.subscribe(:l, event)
  	rescue _ ->
	    :ok
    end
  	:ets.insert(subscriptions, {event, {id, fun}})
  	{:ok, req, s}
  end

  def websocket_info({:gproc_ps_event, event, msg}, req, state(subscriptions: subscriptions) = s) do
  	L.verbose "Event ${event} fired, with ${msg}", event: event, msg: msg
  	:ets.lookup(subscriptions, event)
  	|> Enum.each(fn({_, {_id, fun}}) ->
  	  fun.(msg)
    end)
  	{:ok, req, s}
  end
  def websocket_info(_info, req, s) do
  	{:ok, req, s}
  end

  def websocket_terminate(_reason, _req, _state) do
  	:ok
  end

  defp handle_command("info", packet) do
  	{:ok, keys} = :application.get_all_key(:hypnotoad)
  	version = "#{keys[:vsn]}"
  	reply(packet, [config: [path: Hypnotoad.path, version: version]])
  end

  defp handle_command("hosts", packet) do
  	hosts = Hypnotoad.Hosts.hosts
  	|> Enum.map(fn({name, {info, facts}}) ->
  	  [name: "#{name}", value: Hypnotoad.Host.to_json(info), facts: facts]
  	end)
  	reply(packet, [hosts: hosts])
  end

  defp handle_command("modules", packet) do
  	modules = Hypnotoad.Modules.modules
  	|> Enum.map(fn({name, path}) ->
  	  [name: inspect(name), path: path, description: name.description]
  	end)
  	subscribe(packet, {Hypnotoad.Modules, :modules_reloaded}, fn(modules) ->
  	  modules = Enum.map(modules, fn({name, path}) ->
  	    [name: inspect(name), path: path, description: name.description]
      end)
      reply(packet, [modules: modules])
  	end)
  	reply(packet, [modules: modules])
  end

  defp handle_command("plans", packet) do
    subscribe(packet, Hypnotoad.Plan, fn(_) ->
      plans(packet)
    end)
    subscribe(packet, {Hypnotoad.Modules, :modules_reloaded}, fn(_) ->
      plans(packet)
    end)

    plans(packet)
  end

  defp handle_command("run_plan", packet) do
    server = Module.safe_concat([packet["plan"]])
    Hypnotoad.Plan.run(server)
    reply(packet, [status: "ok"])
  end

  defp handle_command("jobs", packet) do
    subscribe(packet, Hypnotoad.Job, fn(_) ->
      jobs(packet)
    end)
    jobs(packet)
  end

  defp handle_command("reload_modules", packet) do
    :gen_server.cast(Hypnotoad.Modules, :init)
  	reply(packet, [status: "ok"])
  end

  defp plans(packet) do
    plans = Enum.map(:gproc.lookup_local_properties(Hypnotoad.Plan), fn({_pid, opts}) ->
      [name: inspect(opts[:module]), description: opts[:module].description, status: "#{opts[:status]}",
       start_timestamp: opts[:start_timestamp], end_timestamp: opts[:end_timestamp]]
    end)
    reply(packet, [plans: plans])
  end

  defp jobs(packet) do
    jobs = Enum.filter_map(:gproc.lookup_local_properties(Hypnotoad.Job), fn({_pid, opts}) ->
      inspect(Hypnotoad.Plan.module(opts[:plan])) == packet["plan"]
    end, fn({_pid, opts}) ->
      host = opts[:host]
      unless is_binary(host), do: host = inspect(host)
      options = opts[:options]
      if options == [], do: options = [{}]
      hash = :erlang.phash2({opts[:module], options, host})
      reqs = Enum.map(opts[:requirements], fn({mod, opts}) ->
        if opts == [], do: opts = [{}]
        [name: inspect(mod), opts: opts]
      end)
      [module: inspect(opts[:module]), options: options, host: host,
       status: "#{opts[:status]}", output: opts[:output],
       id: "#{hash}", requirements: reqs]
    end)
    reply(packet, [jobs: jobs])
  end

  defp reply(packet, response) do
  	id = packet["id"]
  	response = Dict.put(response, "id", id)
  	send(response)
  end
  defp send(packet) do
  	self <- {:send, packet}
  end

  defp subscribe(packet, event, fun) do
  	self <- {:subscribe, packet["id"], event, fun}
  end

  defp encode_packet(packet) do
    case JSEX.encode(packet) do
      {:ok, encoded} -> encoded
      _ ->
       JSEX.encode!(filter_non_json(packet))
    end
  end

  defp filter_non_json([{}]), do: [{}]
  defp filter_non_json(list) when is_list(list) do
    lc i inlist list, do: filter_non_json(i)
  end
  defp filter_non_json({key, value}) when is_atom(key) do
    {key, filter_non_json(value)}
  end
  defp filter_non_json({key, value}) do
    {filter_non_json(key),   filter_non_json(value)}
  end
  defp filter_non_json(item) do
    case JSEX.encode(item) do
      {:ok, _} -> item
      _ -> "<< #{inspect(item)} (non-JSON) >>"
    end
  end

end

defmodule Hypnotoad.WebSocket do
  @behaviour :cowboy_websocket_handler
  use Hypnotoad.Common

  def init({:tcp, :http}, _Req, _Opts) do
  	{:upgrade, :protocol, :cowboy_websocket}
  end

  defrecordp :state, subscriptions: nil

  def websocket_init(_transport, req, _opts) do
  	{:ok, req, state(subscriptions: :ets.new(__MODULE__.Subscriptions, []))}
  end

  def websocket_handle({:text, msg}, req, s) do
  	packet = JSEX.decode!(msg)
    L.verbose "Received WebSocket request: ${packet}", packet: packet
    handle_command(packet["command"], packet)
  	{:ok, req, s}
  end

  def websocket_handle(_, req, s) do
  	{:ok, req, s}
  end

  def websocket_info({:send, packet}, req, s) do
    encoded_packet = encode_packet(packet)
  	L.debug "Sending WebSocket response: ${packet}", packet: JSEX.decode!(encoded_packet)
  	{:reply, {:text, encoded_packet}, req, s}
  end

  def websocket_info({:subscribe, id, event, fun}, req, state(subscriptions: subscriptions) = s) do
  	try do
	  	:gproc_ps.subscribe(:l, event)
  	rescue _ ->
	    :ok
    end
  	:ets.insert(subscriptions, {event, {id, fun}})
  	{:ok, req, s}
  end

  def websocket_info({:gproc_ps_event, event, msg}, req, state(subscriptions: subscriptions) = s) do
  	L.verbose "Event ${event} fired, with ${msg}", event: event, msg: msg
  	:ets.lookup(subscriptions, event)
  	|> Enum.each(fn({_, {_id, fun}}) ->
  	  fun.(msg)
    end)
  	{:ok, req, s}
  end
  def websocket_info(_info, req, s) do
  	{:ok, req, s}
  end

  def websocket_terminate(_reason, _req, _state) do
  	:ok
  end

  defp handle_command("info", packet) do
  	{:ok, keys} = :application.get_all_key(:hypnotoad)
  	version = "#{keys[:vsn]}"
  	reply(packet, [config: [path: Hypnotoad.path, version: version]])
  end

  defp handle_command("hosts", packet) do
  	hosts = Hypnotoad.Hosts.hosts
  	|> Enum.map(fn({name, {info, facts}}) ->
  	  [name: "#{name}", value: Hypnotoad.Host.to_json(info), facts: facts]
  	end)
  	reply(packet, [hosts: hosts])
  end

  defp handle_command("modules", packet) do
  	modules = Hypnotoad.Modules.modules
  	|> Enum.map(fn({name, path}) ->
  	  [name: inspect(name), path: path, description: name.description]
  	end)
  	subscribe(packet, {Hypnotoad.Modules, :modules_reloaded}, fn(modules) ->
  	  modules = Enum.map(modules, fn({name, path}) ->
  	    [name: inspect(name), path: path, description: name.description]
      end)
      reply(packet, [modules: modules])
  	end)
  	reply(packet, [modules: modules])
  end

  defp handle_command("plans", packet) do
    subscribe(packet, Hypnotoad.Plan, fn(_) ->
      plans(packet)
    end)
    subscribe(packet, {Hypnotoad.Modules, :modules_reloaded}, fn(_) ->
      plans(packet)
    end)

    plans(packet)
  end

  defp handle_command("run_plan", packet) do
    server = Module.safe_concat([packet["plan"]])
    Hypnotoad.Plan.run(server)
    reply(packet, [status: "ok"])
  end

  defp handle_command("jobs", packet) do
    subscribe(packet, Hypnotoad.Job, fn(_) ->
      jobs(packet)
    end)
    jobs(packet)
  end

  defp handle_command("reload_modules", packet) do
    :gen_server.cast(Hypnotoad.Modules, :init)
  	reply(packet, [status: "ok"])
  end

  defp plans(packet) do
    plans = Enum.map(:gproc.lookup_local_properties(Hypnotoad.Plan), fn({_pid, opts}) ->
      [name: inspect(opts[:module]), description: opts[:module].description, status: "#{opts[:status]}",
       start_timestamp: opts[:start_timestamp], end_timestamp: opts[:end_timestamp]]
    end)
    reply(packet, [plans: plans])
  end

  defp jobs(packet) do
    jobs = Enum.filter_map(:gproc.lookup_local_properties(Hypnotoad.Job), fn({_pid, opts}) ->
      inspect(Hypnotoad.Plan.module(opts[:plan])) == packet["plan"]
    end, fn({_pid, opts}) ->
      host = opts[:host]
      unless is_binary(host), do: host = inspect(host)
      options = opts[:options]
      if options == [], do: options = [{}]
      hash = :erlang.phash2({opts[:module], options, host})
      reqs = Enum.map(opts[:requirements], fn({mod, opts}) ->
        if opts == [], do: opts = [{}]
        [name: inspect(mod), opts: opts]
      end)
      [module: inspect(opts[:module]), options: options, host: host,
       status: "#{opts[:status]}", output: opts[:output],
       id: "#{hash}", requirements: reqs]
    end)
    reply(packet, [jobs: jobs])
  end

  defp reply(packet, response) do
  	id = packet["id"]
  	response = Dict.put(response, "id", id)
  	send(response)
  end
  defp send(packet) do
  	self <- {:send, packet}
  end

  defp subscribe(packet, event, fun) do
  	self <- {:subscribe, packet["id"], event, fun}
  end

  defp encode_packet(packet) do
    case JSEX.encode(packet) do
      {:ok, encoded} -> encoded
      _ ->
       JSEX.encode!(filter_non_json(packet))
    end
  end

  defp filter_non_json([{}]), do: [{}]
  defp filter_non_json(list) when is_list(list) do
    lc i inlist list, do: filter_non_json(i)
  end
  defp filter_non_json({key, value}) when is_atom(key) do
    {key, filter_non_json(value)}
  end
  defp filter_non_json({key, value}) do
    {filter_non_json(key),   filter_non_json(value)}
  end
  defp filter_non_json(item) do
    case JSEX.encode(item) do
      {:ok, _} -> item
      _ -> "<< #{inspect(item)} (non-JSON) >>"
    end
  end

end


Remove data from snapshots table

Remove data from snapshots table


[minor] fix document links (#2574)

[minor] fix document links (#2574)


counter async service

counter async service

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/jacklin10/rumbl.git/'


add token controller tests

add token controller tests

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/kylekthompson/WodUp.git/'


fixes typo

fixes typo

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/elixytics/report.git/'


Preload country api login & token assoc

Preload country api login & token assoc

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/evercam/evercam-media.git/'


Project server tests

Project server tests

defmodule Kairos.ProjectTest do
  use ExUnit.Case, async: true

  alias Kairos.Project

  setup do
    project_id = :crypto.strong_rand_bytes(32) |> Base.encode64()
    {:ok, pid} = Project.create(project_id)

    {:ok, project_id: project_id, pid: pid}
  end

  test "it creates a new Poject process", %{pid: pid} do
    assert is_pid(pid)
  end

  test "it has a list of time entries", %{project_id: project_id} do
    assert %{user_stories: user_stories} = Project.state(project_id)
    assert is_list(user_stories)
  end
end

error: pathspec 'test/lib/project_test.exs' did not match any file(s) known to git


Solve Intermediate #0013 in Elixir

Solve Intermediate #0013 in Elixir

Intermediate Challenges/Challenge #0013 [Intermediate]/solutions/solution.exs

error: pathspec 'Intermediate' did not match any file(s) known to git
error: pathspec 'Challenges/Challenge' did not match any file(s) known to git


needed this too

needed this too

defmodule HashState do
  @moduledoc """
  """
  defstruct hashes: [], missing: [], lines: []
end

error: pathspec 'apps/reducers/lib/services/hash_structure.ex' did not match any file(s) known to git


Added a Damerau-Levenshtein string distance computer in Elixir.

# attempt to calculate damerau-levenshtein equivalence of 2 strings with distance k

defmodule DamerauLevenshtein do
  @moduledoc """
  Compute whether the damerau-levenshtein distance between 2 strings is at or below k (cost).
  This entails tallying the total cost of all insertions, deletions, substitutions and transpositions
  """

  @doc """
  Test for Damerau-Levenshtein equivalency, given two strings and a k (cost/distance) value.
  """
  def equivalent?(candidate, target, k) do
    distance(candidate, target, k) <= k
  end

  # handle simplest cases breezily

  @doc """
  no max cost provided
  """
  def distance(a, b) do
    distance(a, b, 10)
  end

  @doc """
  initialize current_cost state
  """
  def distance(a, b, max) do
    distance(a, b, max, 0)
  end

  @doc """
  current_cost exceeds max_cost
  """
  def distance(_, _, max_cost, current_cost) when current_cost > max_cost do
    # can't error or raise here since other recursions may find smaller costs, so just return max+1
    # also because the distance function is expected to return an integer.
    max_cost + 1
  end

  @doc """
  empty strings
  """
  def distance("", "", _max_cost, current_cost) do
    current_cost
  end

  @doc """
  two equivalent strings
  """
  def distance(same, same, _max_cost, current_cost) do
    current_cost
  end

  @doc """
  ran out of characters on first string, add second string length as cost
  """
  def distance("", target, max_cost, current_cost) do
    distance("", "", max_cost, current_cost + String.length(target))
  end

  @doc """
  ran out of characters on second string, add remaining first string length as cost
  """
  def distance(candidate, "", max_cost, current_cost) do
    distance("", "", max_cost, current_cost + String.length(candidate))
  end

  @doc """
  if both heads are the same, advance both
  """
  def distance(<<equal_char::utf8, candidate_tail::binary>>, <<equal_char::utf8, target_tail::binary>>, max_cost, current_cost) do
    distance(candidate_tail, target_tail, max_cost, current_cost)
  end

  @doc """
  heads are different, but a transposition is in place. advance both and increment cost by 1
  """
  def distance(<<first_char::utf8, second_char::utf8, candidate_tail::binary>>, <<second_char::utf8, first_char::utf8, target_tail::binary>>, max_cost, current_cost) do
    distance(candidate_tail, target_tail, max_cost, current_cost + 1)
  end

  @doc """
  heads are different, but second characters are the same. substitution. advance both and increment cost by 1
  """
  def distance(<<_::utf8, second_char::utf8, candidate_tail::binary>>, <<_::utf8, second_char::utf8, target_tail::binary>>, max_cost, current_cost) do
    distance(candidate_tail, target_tail, max_cost, current_cost + 1)
  end

  @doc """
  heads are different, assume 1 deletion in either side (an insertion relative to the other side) and return minimum value of either cost.
  Note that this is where runtimes can get hairy in worst cases, there's no TCO here
  """
  def distance(whole_candidate = <<_candidate_head::utf8, candidate_tail::binary>>, whole_target = <<_target_head::utf8, target_tail::binary>>, max_cost, current_cost) do
    Enum.min([
      distance(candidate_tail, target_tail, max_cost, current_cost + 1),  # substitution of character
      distance(candidate_tail, whole_target, max_cost, current_cost + 1), # single deletion in candidate (insertion in target)
      distance(whole_candidate, target_tail, max_cost, current_cost + 1)  # single deletion in target (insertion in candidate)
    ])
  end

end

# run this inline suite with "elixir #{__ENV__.file} test"
if System.argv |> List.first == "test" do
  ExUnit.start

  defmodule DamerauLevenshteinTest do
    use ExUnit.Case, async: true
    alias DamerauLevenshtein, as: DL

    test "distance of empty strings" do
      assert 0 == DL.distance("","")
    end

    test "distance of equivalent strings" do
      assert 0 == DL.distance("test", "test")
    end

    test "distance of strings with empty string" do
      assert 4 == DL.distance("", "test")
      assert 4 == DL.distance("test", "")
    end

    test "transpositions" do
      assert 1 == DL.distance("etst", "test")
      assert 1 == DL.distance("tset", "test")
      assert 1 == DL.distance("tets", "test")
      assert 2 == DL.distance("etts", "test")
      assert 2 == DL.distance("eptre", "peter")
    end

    test "substitutions" do
      assert 1 == DL.distance("test", "tent")
      assert 2 == DL.distance("terp", "test")
    end

    test "insertions/deletions of 1 character" do
      assert 1 == DL.distance("Peter", "Petter")
      assert 1 == DL.distance("Petter", "Peter")
    end

    test "combination of an insertion and a transposition" do
      assert 2 == DL.distance("Peter", "Peetre")
    end

    test "an insertion, a deletion, a substitution and a transposition" do
      assert 4 == DL.distance("Peter", "pterre")
    end

    test "an extra/missing word" do
      assert 6 == DL.distance("four score and", "four and")
      assert 6 == DL.distance("four and", "four score and")
    end

    test "distance exceeds max" do
      assert 5 == DL.distance("testing", "", 4)
    end

    test "d-l equivalence" do
      assert DL.equivalent?("Peter", "Petter", 1)
      refute DL.equivalent?("Peter", "Pesterer", 2)
    end
  end
end

error: pathspec 'damerau_levenshtein.exs' did not match any file(s) known to git


added user foreign key to experience, set experiences to be deleted when user is deleted

defmodule Resume.Repo.Migrations.AddUserReferenceToExperience do
  use Ecto.Migration

  def change do
    add :user_id, references(:users, on_delete: :delete_all)
    create index(:experience, [:user_id])
  end
end

error: pathspec 'priv/repo/migrations/20170112005749_add_user_reference_to_experience.exs' did not match any file(s) known to git


Disable changing camera status on general http error


Wrap camera update in a timeout

Wrap camera update in a timeout


A delay, good for testing and polling mechanism

defmodule Baumeister.Observer.Delay do

  alias Baumeister.Observer
  @moduledoc """
  An `Observer` Plugin that waits a given amount of time before
  letting the process to move forward.

  """
  @behaviour Baumeister.Observer

  @doc """
  Provide a number of milliseconds as delay.
  """
  @spec init(non_neg_integer) :: {:ok, any}
  def init(number) when is_integer(number) and number >= 0 do
    {:ok, number}
  end

  @doc """
  Sleeps for the given number of `n` milliseconds.
  """
  @spec observe(state :: non_neg_integer) :: Observer.observer_return_t
  def observe(n) do
    Process.sleep(n)
    {:ok, n}
  end

end

error: pathspec 'apps/baumeister/lib/observer/delay.ex' did not match any file(s) known to git


Removed extra methods & Made one for every request.


Implement first pass of PostBuilder

Implement first pass of PostBuilder

defmodule Serum.BuildPass1.PostBuilder do
  import Serum.Util
  alias Serum.Error
  alias Serum.Build
  alias Serum.PostInfo

  @type state :: Build.state
  @type erl_datetime :: {erl_date, erl_time}
  @type erl_date :: {non_neg_integer, non_neg_integer, non_neg_integer}
  @type erl_time :: {non_neg_integer, non_neg_integer, non_neg_integer}

  @typep header :: {binary, [Serum.Tag.t], [binary]}

  @re_fname ~r/^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{4}-[0-9a-z\-]+$/
  @async_opt [max_concurrency: System.schedulers_online * 10]

  @spec run(Build.mode, state) :: Error.result([PostInfo.t])

  def run(mode, state) do
    list = load_file_list "#{state.src}posts/"
    File.mkdir_p! "#{state.dest}posts/"
    result = launch mode, list, state
    Error.filter_results_with_values result, :post_builder
  end

  @spec load_file_list(binary) :: [binary]

  defp load_file_list(srcdir) do
    case File.ls srcdir do
      {:ok, list} ->
        list
        |> Enum.filter_map(&String.ends_with?(&1, ".md"), fn x ->
          String.replace x, ~r/\.md$/, ""
        end)
        |> Enum.sort
      {:error, _reason} ->
        warn "Cannot access `posts/'. No post will be generated."
        []
    end
  end

  @spec launch(Build.mode, [binary], state) :: [Error.result(PostInfo.t)]

  defp launch(:parallel, files, state) do
    files
    |> Task.async_stream(__MODULE__, :post_task, [state], @async_opt)
    |> Enum.map(&(elem &1, 1))
  end

  defp launch(:sequential, files, state) do
    files |> Enum.map(&post_task(&1, state))
  end

  @spec post_task(binary, state) :: Error.result(PostInfo.t)

  def post_task(file, state) do
    %{src: src, dest: dest} = state
    state =
      %{state|src: "#{src}posts/#{file}.md", dest: "#{dest}posts/#{file}.html"}
    base = state.project_info.base_url
    with {:ok, raw_date} <- extract_date(state.src),
         {:ok, header} <- extract_header(state.src, base) do
      info = PostInfo.new file, header, raw_date, "", state
      {:ok, info}
    else
      {:error, _, _} = error -> error
    end
  end

  @spec extract_date(binary) :: Error.result(erl_datetime)

  def extract_date(path) do
    fname = :filename.basename path, ".md"
    if fname =~ @re_fname do
      [y, m, d, hhmm|_] =
        fname
        |> String.split("-")
        |> Enum.take(4)
        |> Enum.map(&(&1 |> Integer.parse |> elem(0)))
      {h, i} =
        with h <- div(hhmm, 100), i <- rem(hhmm, 100) do
          h = h > 23 && 23 || h
          i = i > 59 && 59 || i
          {h, i}
        end
      raw_date = {{y, m, d}, {h, i, 0}}
      {:ok, raw_date}
    else
      {:error, :post_error, {:invalid_filename, path, 0}}
    end
  end

  @spec extract_header(binary, binary) :: Error.result(header)

  def extract_header(fname, base) do
    case File.read fname do
      {:ok, data} ->
        do_extract_header fname, data, base
      {:error, reason} ->
        {:error, :file_error, {reason, fname, 0}}
    end
  end

  @spec do_extract_header(binary, binary, binary) :: Error.result(header)

  defp do_extract_header(fname, data, base) do
    try do
      [l1, l2|rest] = data |> String.split("\n")
      {"# " <> title, "#" <> tags} = {l1, l2}
      title = String.trim title
      tags =
        tags
        |> String.split(~r/, */)
        |> Stream.map(&String.trim/1)
        |> Stream.reject(&(&1 == ""))
        |> Enum.sort
        |> Enum.map(&(%Serum.Tag{name: &1, list_url: "#{base}tags/#{&1}"}))
      {:ok, {title, tags, rest}}
    rescue
      _ in MatchError ->
        {:error, :post_error, {:invalid_header, fname, 0}}
    end
  end
end

error: pathspec 'lib/serum/build_pass1/post_builder.ex' did not match any file(s) known to git


Create RoutesHelper module

Create RoutesHelper module

defmodule WhoWeb.RoutesHelper do
  @moduledoc """
  A set of functions used to build and return custom routes and paths.
  """

  def member_id_path(member_id) do
    ~s(/member/#{member_id})
  end

end

error: pathspec 'lib/who_web/helpers/routes_helper.ex' did not match any file(s) known to git


Add date format

Add date format

defmodule Draft7.Optional.Format.DateTest do
  use ExUnit.Case, async: true

  import Xema, only: [valid?: 2]

  describe "validation of date strings" do
    setup do
      %{schema: Xema.new(:format, :date)}
    end

    test "a valid date string", %{schema: schema} do
      data = "1963-06-19"
      assert valid?(schema, data)
    end

    test "an invalid date-time string", %{schema: schema} do
      data = "06/19/1963"
      refute valid?(schema, data)
    end

    test "only RFC3339 not all of ISO 8601 are valid", %{schema: schema} do
      data = "2013-350"
      refute valid?(schema, data)
    end
  end
end

error: pathspec 'test/suite/draft7/optional/format/date_test.exs' did not match any file(s) known to git


Add Serum.RealDummyTheme for testing

Add Serum.RealDummyTheme for testing

defmodule Serum.RealDummyTheme do
  @behaviour Serum.Theme

  def name, do: "Real Dummy Theme"
  def author, do: "John Doe"
  def description, do: "This is a real dummy theme."
  def legal, do: "Use this for testing purposes only."
  def version, do: "0.1.0"
  def serum, do: ">= 0.1.0"

  def get_templates, do: Path.wildcard(Path.join(dir(), "templates/*"))
  def get_includes, do: Path.wildcard(Path.join(dir(), "includes/*"))
  def get_assets, do: Path.join(dir(), "assets")

  defp dir do
    Agent.get(Serum.TestAgent, & &1)
  end
end

error: pathspec 'test_fixtures/theme_modules/real_dummy_theme.ex' did not match any file(s) known to git


access data

access data

states = %{ "AL" => "Alabama", "WI" => "Wisconsin"}

states["AL"]
|> IO.puts

states["TX"]
|> IO.puts

error: pathspec 'elixir/22.exs' did not match any file(s) known to git


mrr prequalify api fixed (#2967)

mrr prequalify api fixed (#2967)

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/edenlabllc/ehealth.api.git/'


fixes timeframe setting

fixes timeframe setting


Write basic tests for the NestedFunctionCalls readability check

defmodule Credo.Check.Readability.NestedFunctionCallsTest do
  use Credo.Test.Case

  alias Credo.Check.Readability.NestedFunctionCalls

  test "it should NOT code with no nested function calls" do
    """
    defmodule CredoSampleModule do
      def some_code do
        Enum.shuffle([1,2,3])
      end
    end
    """
    |> to_source_file()
    |> run_check(NestedFunctionCalls)
    |> refute_issues()
  end

  test "it should NOT report string interpolation" do
    """
    defmodule CredoSampleModule do
      def some_code do
        "Take 10 #{Enum.take([1,2,2,3,3], 10)}"
      end
    end
    """
    |> to_source_file()
    |> run_check(NestedFunctionCalls)
    |> refute_issues()
  end

  test "it should NOT report Access protocol lookups" do
    """
    defmodule CredoSampleModule do
      def some_code do
        Enum.take(map[:some_key])
      end
    end
    """
    |> to_source_file()
    |> run_check(NestedFunctionCalls)
    |> refute_issues()
  end

  test "it should NOT two nested functions calls when the inner function call takes no arguments" do
    """
    defmodule CredoSampleModule do
      def some_code do
        Enum.shuffle(Enum.uniq())
      end
    end
    """
    |> to_source_file()
    |> run_check(NestedFunctionCalls)
    |> refute_issues()
  end

  test "it should report two nested functions calls when the inner call receives some arguments" do
    """
    defmodule CredoSampleModule do
      def some_code do
        Enum.shuffle(Enum.uniq([1,2,2,3,3]))
      end
    end
    """
    |> to_source_file()
    |> run_check(NestedFunctionCalls)
    |> assert_issue()
  end

  test "it should report three nested functions calls" do
    """
    defmodule CredoSampleModule do
      def some_code do
        Enum.shuffle(Enum.uniq(Enum.take([1,2,2,3,3], 10)))
      end
    end
    """
    |> to_source_file()
    |> run_check(NestedFunctionCalls)
    |> assert_issue()
  end
end

error: pathspec 'test/credo/check/readability/nested_function_calls_test.exs' did not match any file(s) known to git


Set the FTP upload type to binary

Set the FTP upload type to binary


Add tests for loading serum.json

Add tests for loading serum.json

defmodule ProjectInfoLoadTest do
  use ExUnit.Case, async: true
  import ExUnit.CaptureIO
  alias Serum.SiteBuilder
  alias Serum.ProjectInfoStorage

  test "get info when not loaded" do
    {:ok, pid} = SiteBuilder.start_link "", ""
    warn =
      capture_io :stderr, fn ->
        send self(), ProjectInfoStorage.get(pid, :site_name)
      end
    assert "\x1b[33m * project info is not loaded yet\x1b[0m\n" == warn
    assert_received nil
    SiteBuilder.stop pid
  end

  test "ok" do
    {:ok, pid} = SiteBuilder.start_link "#{priv()}/testsite_good/", ""
    assert :ok == SiteBuilder.load_info pid
    SiteBuilder.stop pid
  end

  test "serum.json does not exist" do
    {:ok, pid} = SiteBuilder.start_link "/nonexistent_123/", ""
    expected =
      {:error, :file_error, {:enoent, "/nonexistent_123/serum.json", 0}}
    assert expected == SiteBuilder.load_info pid
    SiteBuilder.stop pid
  end

  test "contains json parse error" do
    path = "#{priv()}/test_projinfo/badjson/"
    {:ok, pid} = SiteBuilder.start_link path, ""
    expected =
      {:error, :json_error,
       {"parse error at position 0", path <> "serum.json", 0}}
    assert expected == SiteBuilder.load_info pid
    SiteBuilder.stop pid
  end

  test "contains json parse error 2" do
    path = "#{priv()}/test_projinfo/badjson_info/"
    {:ok, pid} = SiteBuilder.start_link path, ""
    expected =
      {:error, :json_error,
       {"parse error near `}' at position 25", path <> "serum.json", 0}}
    assert expected == SiteBuilder.load_info pid
    SiteBuilder.stop pid
  end

  test "contains validation error" do
    path = "#{priv()}/test_projinfo/schema_error/"
    {:ok, pid} = SiteBuilder.start_link path, ""
    {:error, :child_tasks, {:validate_json, errors}} = SiteBuilder.load_info pid
    Enum.each errors, fn {:error, reason, {_msg, schema_name, 0}} ->
      assert :validation_error == reason
      assert "serum.json" == schema_name
    end
    SiteBuilder.stop pid
  end

  defp priv, do: :code.priv_dir :serum
end

error: pathspec 'test/serum/project_info_load_test.exs' did not match any file(s) known to git


add fizzbuzz example

add fizzbuzz example

## If Statement Free FizzBuzz in Elixir

defmodule FizzBuzz do
  def fizz_word(0, 0, _), do: "FizzBuzz"
  def fizz_word(0, _, _), do: "Fizz"
  def fizz_word(_, 0, _), do: "Buzz"
  def fizz_word(_, _, n), do: n

  def fizz_buzz(n) do
    fizz_word( rem(n,3), rem(n,5), n )
  end

  def result(n) do
    Enum.map(1..n, fn(n) ->
      fizz_buzz(n)
    end)
  end

  def print(n) do
    result(n)
      |> Enum.join(", ")
      |> IO.puts
  end
end

FizzBuzz.print(100)
# $> elixir fizzbuzz.exs
# 1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FizzBuzz, 16, 17, Fizz, 19, Buzz,
# Fizz, 22, 23, Fizz, Buzz, 26, Fizz, 28, 29, FizzBuzz, 31, 32, Fizz, 34, Buzz, Fizz, 37, 38, Fizz,
# Buzz, 41, Fizz, 43, 44, FizzBuzz, 46, 47, Fizz, 49, Buzz, Fizz, 52, 53, Fizz, Buzz, 56, Fizz, 58, 59,
# FizzBuzz, 61, 62, Fizz, 64, Buzz, Fizz, 67, 68, Fizz, Buzz, 71, Fizz, 73, 74, FizzBuzz, 76, 77, Fizz,
# 79, Buzz, Fizz, 82, 83, Fizz, Buzz, 86, Fizz, 88, 89, FizzBuzz, 91, 92, Fizz, 94, Buzz, Fizz, 97, 98,
# Fizz, Buzz

error: pathspec 'lib/examples/fizzbuzz.exs' did not match any file(s) known to git


Increment version [ci skip]

Increment version [ci skip]


[patch] mix.exs version updated

[patch] mix.exs version updated


CORS please

CORS please

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/udia-software/udia.git/'


Add missing migrations file

Add missing migrations file

defmodule TheJuice.Repo.Migrations.AddUserIdToPosts do
  use Ecto.Migration

  def change do

  end
end

error: pathspec 'the_juice/priv/repo/migrations/20170424203304_add_user_id_to_posts.exs' did not match any file(s) known to git


Added an alias for EvercamMedia.Repo using .iex.exs

import_file "~/.iex.exs"

alias EvercamMedia.Repo

error: pathspec '.iex.exs' did not match any file(s) known to git


chore(core): fix log severity on postmark calls (#4717)


Formatting

Formatting

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/evercam/evercam-media.git/'


Add mix task for running migrations in exrm releases


Not sure what the status of this linked list question is.  Nor do I really care at this point.  May as well make it available for people to see.

#!/usr/bin/env elixir

# I found this on my drive, but it was not committed to GitHub.
# No clue what the status is, but I may as well commit it.

# PROBLEM:
#   Single linked list, print backwards.
#     head = [payload: value, next: next_object]
#     head[:next] = [payload: value2, next: next_object2]

# y  = f(x)
# y' = h(g(f(x)))
#
# y_not = x
# |> f
# |> g
# |> h

defmodule InterviewProblem do
  # nil for empty list
  def print_backwards(nil) do
    nil
    |> IO.inspect
  end

  def print_backwards({value, nil}) do
    value
    |> IO.inspect
  end

  def print_backwards({value, next_node}) do
    print_backwards(next_node)
    value
    |> IO.inspect
  end

  def print_linked_list(list) do
    list

    |> IO.inspect
  end
end

defmodule Utility do
  def reverse_linked_list({value, next_node} = list) do
    list[:final_value]
  end

  def reverse_linked_list({value, next_node} = list) do
    # transform here
    reverse_linked_list(list[:not_final])
  end
end

defmodule Script do
  def main(args) do

  end

  def usage() do
    IO.puts("Description")
    IO.puts("Usage:")
    IO.puts("  interview_problem [--option OPTION]")
    IO.puts("Examples:")
    IO.puts("  interview_problem")
    IO.puts("  interview_problem --option OPTION")
  end

  def process(pOptions) do
  end
end

Script.main(System.argv)

error: pathspec 'reverse_linked_list.exs' did not match any file(s) known to git


add an index on name and project_id

add an index on name and project_id

defmodule BaumeisterWeb.Repo.Migrations.AddBuildsIndex do
  use Ecto.Migration

  def change do
    index :builds, :project_id
    index :project, :name
  end
end

error: pathspec 'apps/baumeister_web/priv/repo/migrations/20170322184849_add_builds_index.exs' did not match any file(s) known to git


Pass string instead of variable for validation key arguments


improve medication request list filters (#1293)


Removed extra variables and correct name for camera


[minor] support decimal in logger_json (#1634)


Add missing utils module.

Add missing utils module.

defmodule PhoenixPoker.Utils do
  @moduledoc false

  def yyyymmdd_now() do
    DateTime.utc_now.year * 10000 + DateTime.utc_now.month * 100 + DateTime.utc_now.day
  end
end

error: pathspec 'lib/phoenix_poker/utils.ex' did not match any file(s) known to git


adds formatter

adds formatter

# Used by "mix format"
[
  inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]

error: pathspec '.formatter.exs' did not match any file(s) known to git


[#104100792] Starting server web app based on Cowboy

defmodule PaypalIpnForwarder.ServerWeb do
  use Plug.Router

  plug :match
  plug :dispatch

  # Where our Paypal IPN forwarder is sending to:
  # https://4.196.147.91:3333/payments/ipn
  post "/send_ipn" do

  end

  defp do_match("POST", ["send_ipn"]), do
    conn
    |> Plug.Conn.fetch_params
  end

end

error: pathspec 'lib/server_web.ex' did not match any file(s) known to git


formats the formatter configuration

formats the formatter configuration

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/elixytics/report.git/'


Sample for deactivating the fast warnings

# Deactivate the fast warnings if they annoy you
Benchee.run(%{time: 1, print: %{fast_warning: false}},
            %{"fast" => fn -> 1 + 1 end})

# tobi@speedy ~/github/benchee $ mix run samples/one_fast_fun_no_warnings.exs
# Benchmark suite executing with the following configuration:
# warmup: 2.0s
# time: 1.0s
# parallel: 1
# Estimated total run time: 3.0s
#
# Benchmarking fast...
#
# Name           ips        average    deviation         median
# fast   51132911.86       0.0196μs    (±41.92%)       0.0190μs

error: pathspec 'samples/one_fast_fun_no_warnings.exs' did not match any file(s) known to git


Add example of location  mapping file.

Add example of location  mapping file.

git-svn-id: 227c23bb629cf7bef445105b977924772e49ae4f@1111907 13f79535-47bb-0310-9956-ffa450edef68

## EXAMPLE

@prefix rdf:        <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:	    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd:        <http://www.w3.org/2001/XMLSchema#> .
@prefix lm:         <http://jena.hpl.hp.com/2004/08/location-mapping#> .

# Application location to alternative location mappings.
#
# + Order does not matter.
# + The location mapping parser looks for lm:mapping properties
#   and uses the object value so this can be written in several different styles.
#
# The translation algorithm is:
#
# 1 - Exact mappings: these are tried before attempting a prefix match.
# 2 - By prefix: find the longest matching prefix
# 3 - Use the original if no alternative.

# Use N3's , (multiple objects => multiple statements of same subject and predicate)
# Note the commas

## -- Example 1

[] lm:mapping
   [ lm:name "file:foo.n3" ; lm:altName "file:etc/foo.n3" ] ,
   [ lm:prefix "file:etc/" ; lm:altPrefix "file:ETC/" ] ,
   [ lm:name "file:etc/foo.n3" ; lm:altName "file:DIR/foo.n3" ] ,
   .

## -- Example 1

# This is exactly the same graph using the ; syntax of N3
# Multiple statements with the same subject - and we used the same predicate.

[]	lm:mapping [ lm:name "file:foo.n3" ; lm:altName "file:etc/foo.n3" ] ;
	lm:mapping [ lm:prefix "file:etc/" ; lm:altPrefix "file:ETC/" ] ;
	lm:mapping [ lm:name "file:etc/foo.n3" ; lm:altName "file:DIR/foo.n3" ] ;
	.

## -- Example 1

# Different graph - same effect.  The fact there are different subjects is immaterial.

[]	lm:mapping [ lm:name "file:foo.n3" ; lm:altName "file:etc/foo.n3" ] .
[]	lm:mapping [ lm:prefix "file:etc/" ; lm:altPrefix "file:ETC/" ] .
[]	lm:mapping [ lm:name "file:etc/foo.n3" ; lm:altName "file:DIR/foo.n3" ] .
	.

error: pathspec 'etc/location-mapping.ex' did not match any file(s) known to git


[minor] add party name fields to fraud db (#2336)


Add credo donfig to disable line ending consistency checks

# This file contains the configuration for Credo and you are probably reading
# this after creating it with `mix credo.gen.config`.
#
# If you find anything wrong or unclear in this file, please report an
# issue on GitHub: https://github.com/rrrene/credo/issues
#
%{
  #
  # You can have as many configs as you like in the `configs:` field.
  configs: [
    %{
      #
      # Run any exec using `mix credo -C <name>`. If no exec name is given
      # "default" is used.
      #
      name: "default",
      #
      # These are the files included in the analysis:
      files: %{
        #
        # You can give explicit globs or simply directories.
        # In the latter case `**/*.{ex,exs}` will be used.
      #
        included: ["lib/", "src/", "web/", "apps/"],
        excluded: [~r"/_build/", ~r"/deps/"]
      },
      #
      # If you create your own checks, you must specify the source files for
      # them here, so they can be loaded by Credo before running the analysis.
      #
      requires: [],
      #
      # Credo automatically checks for updates, like e.g. Hex does.
      # You can disable this behaviour below:
      #
      check_for_updates: true,
      #
      # If you want to enforce a style guide and need a more traditional linting
      # experience, you can change `strict` to `true` below:
      #
      strict: false,
      #
      # If you want to use uncolored output by default, you can change `color`
      # to `false` below:
      #
      color: true,
      #
      # You can customize the parameters of any check by adding a second element
      # to the tuple.
      #
      # To disable a check put `false` as second element:
      #
      #     {Credo.Check.Design.DuplicatedCode, false}
      #
      checks: [
        {Credo.Check.Consistency.ExceptionNames},
        {Credo.Check.Consistency.LineEndings, false},
        {Credo.Check.Consistency.ParameterPatternMatching},
        {Credo.Check.Consistency.SpaceAroundOperators},
        {Credo.Check.Consistency.SpaceInParentheses},
        {Credo.Check.Consistency.TabsOrSpaces},

        # For some checks, like AliasUsage, you can only customize the priority
        # Priority values are: `low, normal, high, higher`
        #
        {Credo.Check.Design.AliasUsage, priority: :low},

        # For others you can set parameters

        # If you don't want the `setup` and `test` macro calls in ExUnit tests
        # or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
        # set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
        #
        {Credo.Check.Design.DuplicatedCode, excluded_macros: []},

        # You can also customize the exit_status of each check.
        # If you don't want TODO comments to cause `mix credo` to fail, just
        # set this value to 0 (zero).
        #
        {Credo.Check.Design.TagTODO, exit_status: 2},
        {Credo.Check.Design.TagFIXME},

        {Credo.Check.Readability.FunctionNames},
        {Credo.Check.Readability.LargeNumbers},
        {Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 80},
        {Credo.Check.Readability.ModuleAttributeNames},
        {Credo.Check.Readability.ModuleDoc},
        {Credo.Check.Readability.ModuleNames},
        {Credo.Check.Readability.ParenthesesOnZeroArityDefs},
        {Credo.Check.Readability.ParenthesesInCondition},
        {Credo.Check.Readability.PredicateFunctionNames},
        {Credo.Check.Readability.PreferImplicitTry},
        {Credo.Check.Readability.RedundantBlankLines},
        {Credo.Check.Readability.StringSigils},
        {Credo.Check.Readability.TrailingBlankLine},
        {Credo.Check.Readability.TrailingWhiteSpace},
        {Credo.Check.Readability.VariableNames},
        {Credo.Check.Readability.Semicolons},
        {Credo.Check.Readability.SpaceAfterCommas},

        {Credo.Check.Refactor.DoubleBooleanNegation},
        {Credo.Check.Refactor.CondStatements},
        {Credo.Check.Refactor.CyclomaticComplexity},
        {Credo.Check.Refactor.FunctionArity},
        {Credo.Check.Refactor.LongQuoteBlocks},
        {Credo.Check.Refactor.MatchInCondition},
        {Credo.Check.Refactor.NegatedConditionsInUnless},
        {Credo.Check.Refactor.NegatedConditionsWithElse},
        {Credo.Check.Refactor.Nesting},
        {Credo.Check.Refactor.PipeChainStart},
        {Credo.Check.Refactor.UnlessWithElse},

        {Credo.Check.Warning.BoolOperationOnSameValues},
        {Credo.Check.Warning.IExPry},
        {Credo.Check.Warning.IoInspect},
        {Credo.Check.Warning.LazyLogging},
        {Credo.Check.Warning.OperationOnSameValues},
        {Credo.Check.Warning.OperationWithConstantResult},
        {Credo.Check.Warning.UnusedEnumOperation},
        {Credo.Check.Warning.UnusedFileOperation},
        {Credo.Check.Warning.UnusedKeywordOperation},
        {Credo.Check.Warning.UnusedListOperation},
        {Credo.Check.Warning.UnusedPathOperation},
        {Credo.Check.Warning.UnusedRegexOperation},
        {Credo.Check.Warning.UnusedStringOperation},
        {Credo.Check.Warning.UnusedTupleOperation},
        {Credo.Check.Warning.RaiseInsideRescue},

        # Controversial and experimental checks (opt-in, just remove `, false`)
        #
        {Credo.Check.Refactor.ABCSize, false},
        {Credo.Check.Refactor.AppendSingleItem, false},
        {Credo.Check.Refactor.VariableRebinding, false},
        {Credo.Check.Warning.MapGetUnsafePass, false},
        {Credo.Check.Consistency.MultiAliasImportRequireUse, false},

        # Deprecated checks (these will be deleted after a grace period)
        #
        {Credo.Check.Readability.Specs, false},
        {Credo.Check.Warning.NameRedeclarationByAssignment, false},
        {Credo.Check.Warning.NameRedeclarationByCase, false},
        {Credo.Check.Warning.NameRedeclarationByDef, false},
        {Credo.Check.Warning.NameRedeclarationByFn, false},

        # Custom checks can be created using `mix credo.gen.check`.
        #
      ]
    }
  ]
}

error: pathspec 'server/config/.credo.exs' did not match any file(s) known to git


Change posts tags table to delete when parents are deleted

defmodule Blog.Repo.Migrations.ChangePostTagsOnDeleteToDeleteAll do
  use Ecto.Migration

  def up do
    execute "ALTER TABLE posts_tags DROP CONSTRAINT posts_tags_post_id_fkey"
    execute "ALTER TABLE posts_tags DROP CONSTRAINT posts_tags_tag_id_fkey"
    alter table(:posts_tags) do
      modify :post_id, references(:posts, on_delete: :delete_all)
      modify :tag_id, references(:tags, on_delete: :delete_all)
    end
  end

  def down do
    execute "ALTER TABLE posts_tags DROP CONSTRAINT posts_tags_post_id_fkey"
    execute "ALTER TABLE posts_tags DROP CONSTRAINT posts_tags_tag_id_fkey"
    alter table(:posts_tags) do
      modify :post_id, references(:posts, on_delete: :nothing)
      modify :tag_id, references(:tags, on_delete: :nothing)
    end
  end
end

error: pathspec 'priv/repo/migrations/20161229015433_change_post_tags_on_delete_to_delete_all.exs' did not match any file(s) known to git


Line is too long (max is 80, was 88).

Line is too long (max is 80, was 88).

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/futhr/ribbon.git/'


Removed overlay path value from changeset


Remove success function

Remove success function


finnaly

finnaly

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/pdgonzalez872/work_samples.git/'


Add random IPv6 generator to HELL.

Add random IPv6 generator to HELL.

defmodule HELL.IP do
  # allowed hex characters, hex is case sensitive, always use lowercased letters
  @hex_chars ?0..?9
    |> Enum.to_list()
    |> Kernel.++(Enum.to_list(?a..?f))
    |> Enum.map(&List.wrap/1)
    |> Enum.map(&to_string/1)

  @doc """
  Generates IPv6 with a header built using given `domain`, `object`, `meta1` and `meta2`.
  Every header component must be two characters long and valid hexadecimal.
  The default value for metas is `00`.
  """
  def create(domain, object, opts \\ []) do
    with {:ok, header} <- ip_head(domain, object, opts) do
      {:ok, "#{header}:#{ip_tail()}"}
    end
  end

  @doc """
  Same as `create/3` but raises `ArgumentError` when header is not valid.
  """
  def create!(domain, object, opts \\ []) do
    case create(domain, object, opts) do
      {:ok, id} -> id
      :error -> raise ArgumentError, "invalid header"
    end
  end

  @doc """
  Parses the IP, never use this with game logic, this is only for debug code or `iex` usage.
  """
  def debug(ip) do
    <<
      domain::bytes-size(2), object::bytes-size(2), ":",
      meta1::bytes-size(2), meta2::bytes-size(2), rest::binary>> = ip
    %{domain: domain, object: object, meta1: meta1, meta2: meta2, ip_part: rest}
  end

  @docp """
  Validates and generates the header.
  """
  defp ip_head(domain, object, opts) do
    meta_a = Keyword.get(opts, :meta1, "00")
    meta_b = Keyword.get(opts, :meta2, "00")

    with true <- valid_info?(domain),
         true <- valid_info?(object),
         true <- valid_info?(meta_a),
         true <- valid_info?(meta_b) do
      {:ok, "#{domain}#{object}:#{meta_a}#{meta_b}"}
    else
      _ -> :error
    end
  end

  @docp """
  Generates a true random IPv6 tail.
  """
  defp ip_tail() do
    "#{ip_hex()}:#{ip_hex()}:#{ip_hex()}:#{ip_hex()}:#{ip_hex()}:#{ip_hex()}"
  end

  @docp """
  Generates a string with four random hex digits.
  """
  defp ip_hex() do
    :crypto.strong_rand_bytes(4)
    |> :erlang.binary_to_list()
    |> Enum.map(&(Enum.at(@hex_chars, rem(&1, 16))))
    |> List.to_string()
  end

  @docp """
  Validates header information.
  """
  for x <- @hex_chars, y <- @hex_chars do
    defp valid_info?("#{unquote(x)}#{unquote(y)}"),
      do: true
  end
  defp valid_info?(_),
    do: false
end

error: pathspec 'apps/hell/lib/hell/ip.ex' did not match any file(s) known to git


Reduce database pool size to 80

Reduce database pool size to 80


updates :geolix configuration

updates :geolix configuration

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/elixytics/monolith.git/'


Fix prod config

Fix prod config


Formatting

Formatting


Added Schedule module for checking scheduled intervals

defmodule EvercamMedia.Schedule do
  def scheduled?(schedule, timezone) do
    today_name = Timex.Date.local
    |> Timex.Date.weekday
    |> Timex.Date.day_name

    today_schedule = schedule[today_name]
    iterate(today_schedule, timezone)
  end

  defp iterate([head|tail], timezone) do
    [from, to] = String.split head, "-"
    [from_hour, from_minute] = String.split from, ":"
    [to_hour, to_minute] = String.split to, ":"

    from_date = to_date(from_hour, from_minute, timezone)
    to_date = to_date(to_hour, to_minute, timezone)
    now = Timex.Date.now

    date_format = "{ISOz}"
    {_, now_str} = Timex.DateFormat.format(now, date_format)
    {_, from_str} = Timex.DateFormat.format(from_date, date_format)
    {_, to_str} = Timex.DateFormat.format(to_date, date_format)

    from_date_now = Timex.Date.compare(from_date, now)
    now_to_date = Timex.Date.compare(now, to_date)

    case {from_date_now, now_to_date} do
      {-1, -1} ->
        true
      {0, -1} ->
        true
      {-1, 0} ->
        true
      _ ->
        iterate(tail, timezone)
    end
  end

  defp iterate(nil, timezone) do
    false
  end

  defp iterate([], timezone) do
    false
  end

  defp to_date(hours, minutes, nil) do
    to_date(hours, minutes, "UTC")
  end

  defp to_date(hours, minutes, timezone) do
    today = {Timex.Date.now.year, Timex.Date.now.month, Timex.Date.now.day}
    {h, _} = Integer.parse(hours)
    {m, _} = Integer.parse(minutes)
    time = {h, m, 0}
    Timex.Date.from({today, time}, timezone)
  end
end

error: pathspec 'lib/evercam_media/schedule.ex' did not match any file(s) known to git


Server: add a custom stream_handler of cowboy

defmodule GRPC.Adapter.Cowboy.StreamHandler do
  defstruct ref: nil, pid: nil, read_body_ref: nil,
            read_body_timer_ref: nil, read_body_is_fin: :nofin, read_bodies: []

  alias __MODULE__, as: State

  def init(stream_id, %{ref: ref} = req, opts) do
    env = Map.get(opts, :env, %{})
    middlewares = Map.get(opts, :middlewares, [:cowboy_router, :cowboy_handler])
    shutdown = Map.get(opts, :shutdown, 5000)
    pid = :proc_lib.spawn_link(__MODULE__, :proc_lib_hack, [req, env, middlewares])
    {[{:spawn, pid, shutdown}], %State{ref: ref, pid: pid}}
  end

  # Stream is not waiting for data
  def data(_stream_id, is_fin, data, %State{read_body_ref: nil, read_bodies: bodies} = state) do
    {[], %State{state | read_body_is_fin: is_fin, read_bodies: bodies ++ [data]}}
  end
  # Stream is waiting for data, DATA receiving is fin and all bodies are read
  def data(_stream_id, is_fin, data, %State{pid: pid, read_body_ref: ref,
            read_body_timer_ref: t_ref, read_bodies: []} = state) when elem(is_fin, 0) == :fin do
    :ok = :erlang.cancel_timer(t_ref, async: true, info: false)
    send pid, {:request_body, ref, is_fin, data}
    {[], %State{state | read_body_ref: nil, read_body_timer_ref: nil, read_body_is_fin: is_fin, read_bodies: []}}
  end
  def data(_stream_id, is_fin, data, %State{pid: pid, read_body_ref: ref, read_body_timer_ref: t_ref} = state) do
    :ok = :erlang.cancel_timer(t_ref, async: true, info: false)
    send pid, {:request_body, ref, :nofin, data}
    {[], %State{state | read_body_ref: nil, read_body_timer_ref: nil, read_body_is_fin: is_fin}}
  end

  def info(_stream_id, {:EXIT, pid, :normal}, %State{pid: pid} = state) do
    {[:stop], state}
  end
  def info(_stream_id, {:EXIT, pid, {_reason, [_, {:cow_http_hd, _, _, _}|_]}}, %State{pid: pid} = state) do
    {[{:error_response, 400, %{}, ""}, :stop], state}
  end
  def info(stream_id, {:EXIT, pid, {reason, stacktrace}} = exit, %State{ref: ref, pid: pid} = state) do
    report_crash(ref, stream_id, pid, reason, stacktrace)
    {[
      {:error_response, 500, %{"content-length" => "0"}, ""},
      {:internal_error, exit, :"Stream process crashed."}
    ], state}
  end

  # DATAs receiving is finished and only one data is left
  def info(_stream_id, {:read_body, ref, _length, _},
            %State{pid: pid, read_body_is_fin: is_fin, read_bodies: [data|[]]} = state) when elem(is_fin, 0) == :fin do
    send pid, {:request_body, ref, is_fin, data}
    {[], %State{state | read_bodies: []}}
  end
  # Not all bodies are read
  def info(_stream_id, {:read_body, ref, _length, _}, %State{pid: pid, read_bodies: [data|bodies]} = state) do
    send pid, {:request_body, ref, :nofin, data}
    {[], %State{state | read_bodies: bodies}}
  end
  # DATAs receiving is not finished but bodies are all read, set timeout
  def info(stream_id, {:read_body, ref, length, period},
            %State{read_body_is_fin: :nofin, read_bodies: []} = state) do
    t_ref = :erlang.send_after(period, self(), {{self(), stream_id}, {:read_body_timeout, ref}})
    {[flow: length], %State{state | read_body_ref: ref, read_body_timer_ref: t_ref}}
  end
  # ref is matched
  def info(_stream_id, {:read_body_timeout, ref},
            %State{pid: pid, read_body_ref: ref, read_body_is_fin: is_fin} = state) do
    {[], %State{state | read_body_ref: nil, read_body_timer_ref: nil}}
  end
  # ref is not matched
  def info(_stream_id, {:read_body_timeout, _}, state) do
    {[], state}
  end
  # response
  def info(_stream_id, {:response, _, _, _} = response, state) do
    {[response], state}
  end
  def info(_stream_id, {:headers, _, _} = headers, state) do
    {[headers], state}
  end
  def info(_stream_id, {:trailers, _} = trailers, state) do
    {[trailers], state}
  end
  def info(_stream_id, {:data, _, _} = data, state) do
    {[data], state}
  end
  def info(_stream_id, {:push, _, _, _, _, _, _, _} = push, state) do
    {[push], state}
  end
  def info(_stream_id, {:switch_protocol, _, _, _} = switch_protocol, state) do
    {[switch_protocol], state}
  end
  # stray message
  def info(_stream_id, _msg, state) do
    {[], state}
  end

  def terminate(_stream_id, _reason, _state), do: :ok

  defp report_crash(_, _, _, :normal, _), do: :ok
  defp report_crash(_, _, _, :shutdown, _), do: :ok
  defp report_crash(_, _, _, {:shutdown, _}, _), do: :ok
  defp report_crash(ref, stream_id, pid, reason, stacktrace) do
    :error_logger.error_msg(
      "Ranch listener ~p, connection process ~p, stream ~p " <>
      "had its request process ~p exit with reason " <>
      "~999999p and stacktrace ~999999p~n",
      [ref, self(), stream_id, pid, reason, stacktrace])
  end

  def proc_lib_hack(req, env, middlewares) do
    try do
      execute(req, env, middlewares)
    catch
      _, reason when elem(0, reason) == :cowboy_handler ->
        exit(reason)
      _, reason ->
        exit({reason, :erlang.get_stacktrace()})
    end
  end

  def execute(_, _, []), do: :ok
  def execute(req, env, [middleware|tail] = mds) do
    res = middleware.execute(req, env)
    case res do
      {:ok, req2, env2} ->
        execute(req2, env2, tail)
      {:suspend, module, function, args} ->
        :proc_lib.hibernate(__MODULE__, :resume, [env, tail, module, function, args])
      {:stop, _req} ->
        :ok
    end
  end

  def resume(env, tail, module, function, args) do
    case apply(module, function, args) do
      {:ok, req, env} ->
        execute(req, env, tail)
      {:suspend, module2, function2, args2} ->
        :proc_lib.hibernate(__MODULE__, :resume, [env, tail, module2, function2, args2])
      {:stop, _req} ->
        :ok
    end
  end
end

error: pathspec 'lib/grpc/adapter/cowboy/stream_handler.ex' did not match any file(s) known to git


Commit missing file

Commit missing file

defmodule Farmbot.Firmware.EstopTimer do
  @moduledoc """
  Module responsible for timing emails about E stops.
  """
  use GenServer
  use Farmbot.Logger

  @msg "Farmbot has been E-Stopped for more than 10 minutes."
  # Ten minutes.
  @timer_ms 600000
  # fifteen seconds.
  # @timer_ms 15000

  @doc "Checks if the timer is active."
  def timer_active? do
    GenServer.call(__MODULE__, :timer_active?)
  end

  @doc "Starts a new timer if one isn't started."
  def start_timer do
    GenServer.call(__MODULE__, :start_timer)
  end

  @doc "Cancels a timer if it exists."
  def cancel_timer do
    GenServer.call(__MODULE__, :cancel_timer)
  end

  @doc false
  def start_link do
    GenServer.start_link(__MODULE__, [], [name: __MODULE__])
  end

  @doc false
  def init([]) do
    {:ok, %{timer: nil, already_sent: false}}
  end

  def handle_call(:timer_active?, _, state) do
    {:reply, is_timer_active?(state.timer), state}
  end

  def handle_call(:start_timer, _from, state) do
    if !is_timer_active?(state.timer) do
      {:reply, :ok, %{state | timer: do_start_timer(self())}}
    else
      {:reply, :ok, state}
    end
  end

  def handle_call(:cancel_timer, _from, state) do
    if is_timer_active?(state.timer) do
      Process.cancel_timer(state.timer)
    end
    {:reply, :ok, %{state | timer: nil, already_sent: false}}
  end

  def handle_info(:timer, state) do
    if state.already_sent do
      {:noreply, %{state | timer: nil}}
    else
      Logger.warn 1, @msg, [channels: [:email]]
      {:noreply, %{state | timer: nil, already_sent: true}}
    end
  end

  defp is_timer_active?(timer) do
    if timer, do: is_number(Process.read_timer(timer)), else: false
  end

  defp do_start_timer(pid) do
    Process.send_after(pid, :timer, @timer_ms)
  end
end

error: pathspec 'lib/farmbot/firmware/estop_timer.ex' did not match any file(s) known to git


Minor refactor of archive controller

Minor refactor of archive controller

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/evercam/evercam-media.git/'