Add server start alias `mix s`.

Add server start alias `mix s`.

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/'


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]


Updated doc dependencies

Updated doc dependencies

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/'


Enable mix aliases

Enable mix aliases

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/'


New GenDict protocol

New GenDict protocol

defprotocol GenDict, [
#  @doc """
#  Returns a list containing all dict's keys.
#
#  For Keyword and Orddict, the keys are guaranteed to be sorted. For other
#  types of dicts, the order is not enforced.
#
#  ## Examples
#
#      GenDict.keys [a: 1, b: 2]  #=> [:a,:b]
#
#  """
  keys(dict),

#  @doc """
#  Returns a list containing all dict's values.
#
#  ## Examples
#
#      GenDict.values [a: 1, b: 2]  #=> [1,2]
#
#  """
  values(dict),

#  @doc """
#  Returns the number of elements in `dict`.
#
#  ## Examples
#
#      GenDict.size [a: 1, b: 2]  #=> 2
#
#  """
  size(dict),

#  @doc """
#  Returns whether the given key exists in the given dict.
#
#  ## Examples
#
#      GenDict.has_key?([a:, 1], :a)  #=> true
#      GenDict.has_key?([a:, 1], :b)  #=> false
#  """
  has_key?(dict, key),

#  @doc """
#  Returns the value associated with `key` in `dict`. If `dict` does not
#  contain `key`, returns `default` (or nil if not provided).
#
#  ## Examples
#
#      GenDict.get [a: 1], :a     #=> 1
#      GenDict.get [a: 1], :b     #=> nil
#      GenDict.get [a: 1], :b, 3  #=> 3
#  """
  get(dict, key, default),

#  @doc """
#  Stores the given `value` under `key` in `dict`.
#  If `dict` already has `key`, the stored value is replaced by the new one.
#
#  ## Examples
#
#      GenDict.put [a: 1, b: 2], :a, 3
#      #=> [a: 3, b: 2]
#      GenDict.put [a: 1, b: 2], {:c, 3}
#      #=> [a: 1, b: 2, c: 3]
#  """
  put(dict, key, val),
  put(dict, pair),

#  @doc """
#  Removes the entry stored under the given key from `dict`.
#  If `dict` does not contain `key`, returns the dictionary unchanged.
#
#  ## Examples
#
#      GenDict.delete [a: 1, b: 2], :a  #=> [b: 2]
#      GenDict.delete [b: 2], :a        #=> [b: 2]
#  """
  delete(dict, key),

#  @doc """
#  Merges two dicts into one. If the dicts have duplicated entries, the one
#  given as second argument wins.
#
#  ## Examples
#
#      GenDict.merge [a: 1, b: 2], [a: 3, d: 4]
#      #=> [a:3, b:2, d: 4]
#  """
  merge(dict1, dict2),

#  @doc """
#  Merges two dicts into one. If the dicts have duplicated entries, the given
#  function is invoked to solve conflicts.
#
#  ## Examples
#
#      GenDict.merge [a: 1, b: 2], [a: 3, d: 4], fn(_k, v1, v2) ->
#        v1 + v2
#      end
#      #=> [a: 4, b: 2, d: 4]
#  """
  merge(dict1, dict2, fun)
], only: [Record]

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


[patch] EHealth-89: get employees with status APPROVED


Mark camera as offline when stopping the worker


Custom filter tests

Custom filter tests

defmodule Solid.Integration.CustomFiltersTest do
  use ExUnit.Case, async: true
  import Solid.Helpers

  defmodule Solid.CustomFilters do
    def date_year(input) do
      date = Date.from_iso8601!(input)
      date.year
    end

    def date_format(input, format) when is_binary(input),
      do: input |> Date.from_iso8601!() |> date_format(format)

    def date_format(date, "m/d/yyyy"),
      do: Enum.join([date.month, date.day, date.year], "/")

    def date_format(date, "d.m.yyyy"),
      do: Enum.join([date.day, date.month, date.year], ".")

    def date_format(date, _format),
      do: to_string(date)
  end

  setup do
    Application.put_env(:solid, :custom_filters, Solid.CustomFilters)
    {:ok, %{date: "2019-10-31"}}
  end

  describe "custom filters" do
    test "date year filter", %{date: date} do
      assert render("{{ date_var | date_year }}", %{"date_var" => date}) == "2019"
    end

    test "date format m/d/yyyy", %{date: date} do
      assert render(~s<{{ date_var | date_format: "m/d/yyyy" }}>, %{"date_var" => date}) == "10/31/2019"
    end

    test "date format d.m.yyyy", %{date: date} do
      assert render(~s<{{ date_var | date_format: "d.m.yyyy" }}>, %{"date_var" => date}) == "31.10.2019"
    end

    test "date format with malformed format", %{date: date} do
      assert render(~s<{{ date_var | date_format: "x/y/z" }}>, %{"date_var" => date} == "2019-10-31")
    end
  end
end

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


Start adding tests for Yodado.FeatureSetTest

defmodule Yodado.FeatureSetTest do
  defmodule AllTest do
    use ExUnit.Case, async: true
    alias Yodado.FeatureSet, as: FeatureSet

    test "multi_do returns a keyword list of features" do
      result = FeatureSet.multi_do(nil)
      assert Keyword.keyword?(result)
    end
  end
end

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


:+1: Add Protocols04

:+1: Add Protocols04

defmodule Protocols04 do
    defimpl Inspect, for: Person do
      def inspect(p, _) do
          "%#{p.__struct__}{age: #{p.age}, name: #{p.name}}"
      end
    end
end

# 結果確認用のダミー構造体
defmodule Person do
  defstruct [:name, :age]
end

# iex(1)> p = %Person{age: 10, name: 'budougumi'}
# %Elixir.Person{age: 10, name: budougumi}
# iex(2)> p2 = p
# %Elixir.Person{age: 10, name: budougumi}
# iex(3)> p2 == p
# true
# iex(4)> p2 = IO.inspect p
# %Elixir.Person{age: 10, name: budougumi}
# %Elixir.Person{age: 10, name: budougumi}
# iex(5)> p2 == p
# true

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


Increased timespan for updating camera_status and Logging. (#615)


Fix typo

Fix typo


:+1: Add WorkingWithMultipleProcesses06.

defmodule WorkingWithMultipleProcesses06 do
  def pmap(collection, fun) do
    me = self()
    collection
    |> Enum.map(fn (elem) ->
      spawn_link fn -> (
        IO.inspect "me = #{inspect me}"
        IO.inspect "self = #{inspect self()}"
        send me, { self(), fun.(elem) }) end
      end)
    |> Enum.map(fn (pid) ->
      receive do {^pid, result} -> result end
    end)
  end
end

# self()を遅延評価させないと、子プロセスのPIDになってしまうからmeという変数に代入しておかないといけない。
# iex(1)> WorkingWithMultipleProcesses06.pmap 1..10, &(&1 * &1)
# "me = #PID<0.84.0>"
# "me = #PID<0.84.0>"
# "me = #PID<0.84.0>"
# "me = #PID<0.84.0>"
# "me = #PID<0.84.0>"
# "me = #PID<0.84.0>"
# "me = #PID<0.84.0>"
# "me = #PID<0.84.0>"
# "me = #PID<0.84.0>"
# "me = #PID<0.84.0>"
# "self = #PID<0.86.0>"
# "self = #PID<0.90.0>"
# "self = #PID<0.87.0>"
# "self = #PID<0.88.0>"
# "self = #PID<0.89.0>"
# "self = #PID<0.91.0>"
# "self = #PID<0.92.0>"
# "self = #PID<0.93.0>"
# "self = #PID<0.94.0>"
# "self = #PID<0.95.0>"
# [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]

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


Disable cloud recordings for most cameras

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


[Minor] Add view module for Cabinet auth_controller

fatal: unable to access 'https://github.com/edenlabllc/ehealth.api.git/': The requested URL returned error: 403


Make the snapshot index endpoint use corrected camera offset


Fixed resolutions 0 and multiple hls entries (#616)


teste

teste

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/thluiz/ddd21.git/'


Add api home page

Add api home page

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/mrmicahcooper/taskdown.git/'


Add wrapper for compatiblity between elixir < 1.4.0 and >= 1.4.0

defmodule Ewebmachine.Compat do
  @moduledoc false
end

defmodule Ewebmachine.Compat.Enum do
  @moduledoc false

  case Version.compare(System.version(), "1.4.0") do
    :gt ->
      defdelegate split_with(arg0, arg1), to: Enum
    _ ->
      defdelegate split_with(arg0, arg1), to: Enum, as: :partition
  end
end

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


chroe: Regex

chroe: Regex

fatal: unable to access 'https://github.com/rockdragon/julia-programming.git/': The requested URL returned error: 403


Used sort function without fun

Used sort function without fun


Implement loading snapshots from seaweedfs


Start writing a simple GitHub issues fetcher

defmodule Issues.GitHub do
  def fetch_issues(user, project) do
    url = "https://api.github.com/repos/#{user}/#{project}/issues"
    # TODO: add user agent, but verify and understand the data structure
    # passed as a parameter first
    response = HTTPoison.get(url)
    handle_response(response)
  end

  def handle_response({ :ok, %{status_code: 200, body: body}}) do
    IO.puts body
  end
end

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


Broker unit tests

Broker unit tests

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


Formatting

Formatting


fixed post create error

fixed post create error

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/'


adds Server module

adds Server module

defmodule Hangman.Server do
  alias Hangman.Game

  use GenServer

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

  def init(_) do
    { :ok, Game.new_game() }
  end

  def handle_call({ :make_move, guess }, _from, game) do
    { game, tally } = Game.make_move(game, guess)
    { :reply, tally, game }
  end
end

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


[minor] fix contract_number validation on create, sign (#2348)

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 option route for snapmail

Added option route for snapmail

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/'


raise on snapshot error

raise on snapshot error

defmodule EvercamMedia.Snapshot do
  alias EvercamMedia.Repo
  alias EvercamMedia.S3
  alias EvercamMedia.HTTPClient
  require Logger

  def fallback do
    path = Application.app_dir(:evercam_media)
    path = Path.join path, "priv/static/images/unavailable.jpg"
    File.read! path
  end

  def check_camera(args, retry \\ true) do
    [username, password] = String.split(args[:auth], ":")
    response =
      case args[:vendor_exid] do
        "samsung" -> HTTPClient.get(:digest_auth, args[:url], username, password)
        "ubiquiti" -> HTTPClient.get(:cookie_auth, args[:url], username, password)
        _ -> HTTPClient.get(:basic_auth, args[:url], username, password)
      end
    response = response.body
    timestamp = Ecto.DateTime.utc
    check_jpg(response, args[:camera_exid], timestamp)
    broadcast_snapshot(args[:camera_exid], response)
    store(args[:camera_exid], args[:camera_id], response, "Evercam Proxy")
  end

  def store(camera_exid, camera_id, image, notes \\ "", count \\ 1) do
    snap_timestamp = Ecto.DateTime.utc
    file_timestamp = Timex.Date.now(:secs)
    file_path = "/#{camera_exid}/snapshots/#{file_timestamp}.jpg"
    response =  S3.upload(camera_exid, image, file_path, file_timestamp)
    case response do
      {:error, httpotion_response} ->
        %HTTPoison.Error{reason: reason} = httpotion_response
        Logger.error "Error uploading file to S3:  #{reason}"
      _ ->
        Logger.info "Uploaded file to S3 for camera #{camera_exid}: #{file_path}"
    end

    update_camera_status(camera_exid, snap_timestamp, true)
    save_snapshot_record(camera_exid, camera_id, notes, snap_timestamp, file_timestamp, true, file_path)
    ConCache.put(:cache, camera_exid, %{image: image, timestamp: file_timestamp, notes: notes})
    %{camera_id: camera_exid, image: image, timestamp: file_timestamp, notes: notes}
  end

  def check_jpg(response, camera_exid, timestamp) do
    if String.valid?(response) do
      update_camera_status(camera_exid, timestamp, false)
      raise SnapshotError
    end
  end

  def check_jpg(response) do
    if String.valid?(response) do
      raise SnapshotError
    end
  end

  def error_handler(error) do
    Logger.error inspect(error)
    Logger.error Exception.format_stacktrace System.stacktrace
  end

  def save_snapshot_record(camera_exid, camera_id, _, _, file_timestamp, _, _, count) when count >= 10 do
    Logger.error "Snapshot '#{file_timestamp}' for '#{camera_exid}' not found on S3, aborting."
  end

  def save_snapshot_record(camera_exid, camera_id, notes, snap_timestamp, file_timestamp, true, file_path, _) do
    Repo.insert %Snapshot{camera_id: camera_id, data: "S3", notes: notes, created_at: snap_timestamp}
    update_thumbnail_url(camera_exid, file_path)
  end

  def save_snapshot_record(camera_exid, camera_id, notes, snap_timestamp, file_timestamp, false, file_path, count \\ 0) when count < 10 do
    Logger.warn "Snapshot '#{file_timestamp}' for '#{camera_exid}' not found on S3, try ##{count}"
    :timer.sleep 1000
    save_snapshot_record(camera_exid, camera_id, notes, snap_timestamp, file_timestamp, S3.exists?(file_path), file_path, count + 1)
  end

  def update_thumbnail_url(camera_exid, file_path) do
    camera = Repo.one! Camera.by_exid(camera_exid)
    camera = %{camera | thumbnail_url: S3.file_url(file_path)}
    Repo.update camera
  end

  def update_camera_status(camera_exid, timestamp, status) do
    camera = Repo.one! Camera.by_exid(camera_exid)
    camera_is_online = camera.is_online
    camera = construct_camera(camera, timestamp, status, camera_is_online == status)
    Repo.update camera

    unless camera_is_online == status do
      try do
        log_camera_status(camera.id, status, timestamp)
      rescue
        _error ->
          error_handler(_error)
      end
      invalidate_cache(camera_exid)
    end
  end

  def invalidate_cache(camera_exid) do
    Exq.Enqueuer.enqueue(
      :exq_enqueuer,
      "cache",
      "Evercam::CacheInvalidationWorker",
      camera_exid
    )
  end

  def broadcast_snapshot(camera_id, image) do
    EvercamMedia.Endpoint.broadcast(
      "cameras:#{camera_id}",
      "snapshot-taken",
      %{image: Base.encode64(image)}
    )
  end

  def log_camera_status(camera_id, true, timestamp) do
    Repo.insert %CameraActivity{camera_id: camera_id, action: "online", done_at: timestamp}
  end

  def log_camera_status(camera_id, false, timestamp) do
    Repo.insert %CameraActivity{camera_id: camera_id, action: "offline", done_at: timestamp}
  end

  defp construct_camera(camera, timestamp, _, true) do
    %{camera | last_polled_at: timestamp}
  end

  defp construct_camera(camera, timestamp, false, false) do
    %{camera | last_polled_at: timestamp, is_online: false}
  end

  defp construct_camera(camera, timestamp, true, false) do
    %{camera | last_polled_at: timestamp, is_online: true, last_online_at: timestamp}
  end

  def decode_request_token(token) do
    {_, encrypted_message} = Base.url_decode64(token)
    message = :crypto.block_decrypt(
      :aes_cbc256,
      System.get_env["SNAP_KEY"],
      System.get_env["SNAP_IV"],
      encrypted_message
    )
    String.split(message, "|")
  end
end

defmodule SnapshotError do
  defexception message: "Response isn't an image"
end

defmodule EvercamMedia.Snapshot do
  alias EvercamMedia.Repo
  alias EvercamMedia.S3
  alias EvercamMedia.HTTPClient
  require Logger

  def fallback do
    path = Application.app_dir(:evercam_media)
    path = Path.join path, "priv/static/images/unavailable.jpg"
    File.read! path
  end

  def check_camera(args, retry \\ true) do
    [username, password] = String.split(args[:auth], ":")
    response =
      case args[:vendor_exid] do
        "samsung" -> HTTPClient.get(:digest_auth, args[:url], username, password)
        "ubiquiti" -> HTTPClient.get(:cookie_auth, args[:url], username, password)
        _ -> HTTPClient.get(:basic_auth, args[:url], username, password)
      end
    response = response.body
    timestamp = Ecto.DateTime.utc
    check_jpg(response, args[:camera_exid], timestamp)
    broadcast_snapshot(args[:camera_exid], response)
    store(args[:camera_exid], args[:camera_id], response, "Evercam Proxy")
  end

  def store(camera_exid, camera_id, image, notes \\ "", count \\ 1) do
    snap_timestamp = Ecto.DateTime.utc
    file_timestamp = Timex.Date.now(:secs)
    file_path = "/#{camera_exid}/snapshots/#{file_timestamp}.jpg"
    response =  S3.upload(camera_exid, image, file_path, file_timestamp)
    case response do
      {:error, httpotion_response} ->
        %HTTPoison.Error{reason: reason} = httpotion_response
        Logger.error "Error uploading file to S3:  #{reason}"
      _ ->
        Logger.info "Uploaded file to S3 for camera #{camera_exid}: #{file_path}"
    end

    update_camera_status(camera_exid, snap_timestamp, true)
    save_snapshot_record(camera_exid, camera_id, notes, snap_timestamp, file_timestamp, true, file_path)
    ConCache.put(:cache, camera_exid, %{image: image, timestamp: file_timestamp, notes: notes})
    %{camera_id: camera_exid, image: image, timestamp: file_timestamp, notes: notes}
  end

  def check_jpg(response, camera_exid, timestamp) do
    if String.valid?(response) do
      update_camera_status(camera_exid, timestamp, false)
    end
  end

  def check_jpg(response) do
    if String.valid?(response) do
      raise SnapshotError
    end
  end

  def error_handler(error) do
    Logger.error inspect(error)
    Logger.error Exception.format_stacktrace System.stacktrace
  end

  def save_snapshot_record(camera_exid, camera_id, _, _, file_timestamp, _, _, count) when count >= 10 do
    Logger.error "Snapshot '#{file_timestamp}' for '#{camera_exid}' not found on S3, aborting."
  end

  def save_snapshot_record(camera_exid, camera_id, notes, snap_timestamp, file_timestamp, true, file_path, _) do
    Repo.insert %Snapshot{camera_id: camera_id, data: "S3", notes: notes, created_at: snap_timestamp}
    update_thumbnail_url(camera_exid, file_path)
  end

  def save_snapshot_record(camera_exid, camera_id, notes, snap_timestamp, file_timestamp, false, file_path, count \\ 0) when count < 10 do
    Logger.warn "Snapshot '#{file_timestamp}' for '#{camera_exid}' not found on S3, try ##{count}"
    :timer.sleep 1000
    save_snapshot_record(camera_exid, camera_id, notes, snap_timestamp, file_timestamp, S3.exists?(file_path), file_path, count + 1)
  end

  def update_thumbnail_url(camera_exid, file_path) do
    camera = Repo.one! Camera.by_exid(camera_exid)
    camera = %{camera | thumbnail_url: S3.file_url(file_path)}
    Repo.update camera
  end

  def update_camera_status(camera_exid, timestamp, status) do
    camera = Repo.one! Camera.by_exid(camera_exid)
    camera_is_online = camera.is_online
    camera = construct_camera(camera, timestamp, status, camera_is_online == status)
    Repo.update camera

    unless camera_is_online == status do
      try do
        log_camera_status(camera.id, status, timestamp)
      rescue
        _error ->
          error_handler(_error)
      end
      invalidate_cache(camera_exid)
    end
  end

  def invalidate_cache(camera_exid) do
    Exq.Enqueuer.enqueue(
      :exq_enqueuer,
      "cache",
      "Evercam::CacheInvalidationWorker",
      camera_exid
    )
  end

  def broadcast_snapshot(camera_id, image) do
    EvercamMedia.Endpoint.broadcast(
      "cameras:#{camera_id}",
      "snapshot-taken",
      %{image: Base.encode64(image)}
    )
  end

  def log_camera_status(camera_id, true, timestamp) do
    Repo.insert %CameraActivity{camera_id: camera_id, action: "online", done_at: timestamp}
  end

  def log_camera_status(camera_id, false, timestamp) do
    Repo.insert %CameraActivity{camera_id: camera_id, action: "offline", done_at: timestamp}
  end

  defp construct_camera(camera, timestamp, _, true) do
    %{camera | last_polled_at: timestamp}
  end

  defp construct_camera(camera, timestamp, false, false) do
    %{camera | last_polled_at: timestamp, is_online: false}
  end

  defp construct_camera(camera, timestamp, true, false) do
    %{camera | last_polled_at: timestamp, is_online: true, last_online_at: timestamp}
  end

  def decode_request_token(token) do
    {_, encrypted_message} = Base.url_decode64(token)
    message = :crypto.block_decrypt(
      :aes_cbc256,
      System.get_env["SNAP_KEY"],
      System.get_env["SNAP_IV"],
      encrypted_message
    )
    String.split(message, "|")
  end
end

defmodule SnapshotError do
  defexception message: "Response isn't an image"
end


add cache tests

add cache 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/mononym/exmud.git/'


Add some elixir

Add some elixir

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


[patch] drop phones from fraud parties table


Add parameter validation to port check endpoint


Add missing closing parantheses.

Add missing closing parantheses.

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/JordanAlimi/jalimi.git/'


Migration - change photo rate relationship.

defmodule EmotionsWheelBackend.Repo.Migrations.ChangePhotoRateRelationship do
  use Ecto.Migration

  def change do
    alter table(:photos) do
      remove :rate_id
    end

    alter table(:rates) do
      add :photo_id, references(:photos)
    end
  end
end

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


Add namespace to send request.

Add namespace to send request.


Return tuples on error in the same format

defmodule EvercamMedia.Snapshot.CamClient do
  @moduledoc """
  Client to talk with the camera for various data. Currently this only fetches snapshots.
  In future, we could expand this module to check camera status, video stream etc.
  """

  alias EvercamMedia.HTTPClient
  alias EvercamMedia.Snapshot.Util
  require Logger

  @doc """
  Connect to the camera and get the snapshot
  """
  def fetch_snapshot(args) do
    [username, password] = String.split(args[:auth], ":")
    try do
      response =
        case args[:vendor_exid] do
          "samsung" -> HTTPClient.get(:digest_auth, args[:url], username, password)
          "ubiquiti" -> HTTPClient.get(:cookie_auth, args[:url], username, password)
          _ -> HTTPClient.get(:basic_auth, args[:url], username, password)
        end
      parse_snapshot_response(response)
    rescue
      error -> {:error, error}
    end
  end

  ## Private functions

  defp parse_snapshot_response(%HTTPotion.Response{status_code: 200} = response) do
    case Util.is_jpeg(response.body) do
      true -> {:ok, response.body}
      _ -> {:error, "Response not a jpeg image: #{inspect response}"}
    end
  end

  defp parse_snapshot_response(error) do
    {:error, error}
  end
end

defmodule EvercamMedia.Snapshot.CamClient do
  @moduledoc """
  Client to talk with the camera for various data. Currently this only fetches snapshots.
  In future, we could expand this module to check camera status, video stream etc.
  """

  alias EvercamMedia.HTTPClient
  alias EvercamMedia.Snapshot.Util

  @doc """
  Connect to the camera and get the snapshot
  """
  def fetch_snapshot(args) do
    [username, password] = String.split(args[:auth], ":")
    try do
      response =
        case args[:vendor_exid] do
          "samsung" -> HTTPClient.get(:digest_auth, args[:url], username, password)
          "ubiquiti" -> HTTPClient.get(:cookie_auth, args[:url], username, password)
          _ -> HTTPClient.get(:basic_auth, args[:url], username, password)
        end
      parse_snapshot_response(response)
    rescue
      error -> {:error, error}
    end
  end

  defp parse_snapshot_response(%HTTPotion.Response{status_code: 200} = response) do
    case Util.is_jpeg(response.body) do
      true -> {:ok, response.body}
      _ -> {:error, "Response not a jpeg image: #{inspect response}"}
    end
  end

  defp parse_snapshot_response(error) do
    error
  end
end


Invalidate cache on thumbnail update

Invalidate cache on thumbnail update


[patch] add logging

[patch] add logging


Add new ChangesetHelper module into example test support folder

This module contains functions related with models changesets for test purposes

defmodule ChangesetHelper do

  # Company related changeset functions
  def new_company(attrs), do: Company.changeset(%Company{}, attrs)
  def new_company(attrs, :multitenant) do
    new_company(attrs) |> MultiTenantHelper.add_prefix_to_changeset()
  end

  def update_company(company, attrs), do: Company.changeset(company, attrs)
  def update_company(company, attrs, :multitenant) do
    update_company(company, attrs) |> MultiTenantHelper.add_prefix_to_changeset()
  end

  # Person related changeset functions
  def new_person(attrs), do: Person.changeset(%Person{}, attrs)
  def new_person(attrs, :multitenant) do
    new_person(attrs) |> MultiTenantHelper.add_prefix_to_changeset()
  end

  def update_person(person, attrs), do: Person.changeset(person, attrs)
  def update_person(person, attrs, :multitenant) do
    update_person(person, attrs) |> MultiTenantHelper.add_prefix_to_changeset()
  end
end

error: pathspec 'example/test/support/changeset_helper.exs' did not match any file(s) known to git


Add HexSonar

Add HexSonar

defmodule HexSonar do
  alias Refaktor.Util.JSON

  @server_and_port Application.get_env(:hex_faktor, :hex_server)
  @url "#{@server_and_port}/api/packages/:name"

  def load(name) do
    load_json(name)
  end

  defp load_json(name) do
    url = @url |> String.replace(":name", name |> to_string)
    case load_url(url) do
      {:ok, map} -> map
      {:error, error} -> IO.inspect error
    end
  end

  defp load_url(url) do
    # IO.puts "Getting url: #{url}"
    case HTTPoison.get(url) do
      {:ok, %HTTPoison.Response{status_code: 200, body: body}} ->
        {:ok, JSON.parse(body)}
      {:ok, %HTTPoison.Response{status_code: 404}} ->
        {:error, 404}
      {:error, %HTTPoison.Error{reason: reason}} ->
        {:error, reason}
    end
  end

end

error: pathspec 'web/oauth/hex_sonar.ex' did not match any file(s) known to git


New users are admin by default

New users are admin by default

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


chore: named fn

chore: named fn

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/'


added tests for params plug

added tests for params plug

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


Add solution to first project euler problem in elixir

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/kerkeslager/sandbox.git/'


Refactor Post Model adding Required and Optional fields

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


Invalidate camera cache on camera update request


Returning 404 on memory not found.

Returning 404 on memory not found.

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


module

module

defmodule Greeter do
  def greet(name \\ "you") do
    "Hello #{name}!"
  end
end

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


fixed elixir wit version, weird behavior in 2.0.0; reverted to 1

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/'


[minor] fix medication request request sign (#2378)


Disable snapshot deletion task temporarily

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


Default for prod db (temp)

Default for prod db (temp)

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/kainlite/catalogify.git/'


Migration - create indexes for tables.

Migration - create indexes for tables.

defmodule EmotionsWheelBackend.Repo.Migrations.AddIndexesToTables do
  use Ecto.Migration

  def change do
    create index(:rates, [:photo_id, :experiment_id, :participant_id])
    create index(:experiments_has_participants, [:uuid, :participant_id, :experiment_id])
    create index(:experiments_has_photos, [:photo_id, :experiment_id])
  end
end

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


Add multi type test file

Add multi type test file

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

  import Xema, only: [validate: 2]

  test "&new/1 called with a wrong type list raised an exception" do
    assert_raise ArgumentError, fn ->
      Xema.new([:string, :foo])
    end
  end

  describe "schema with type string or nil:" do
    setup do
      %{schema: Xema.new([:string, nil], min_length: 5)}
    end

    test "with a string", %{schema: schema} do
      assert validate(schema, "foobar") == :ok
    end

    test "with an invalid string", %{schema: schema} do
      assert validate(schema, "foo") == {:error, %{min_length: 5, value: "foo"}}
    end

    test "with nil", %{schema: schema} do
      assert validate(schema, nil) == :ok
    end

    test "with integer", %{schema: schema} do
      assert validate(schema, 42) ==
               {:error, %{type: [:string, nil], value: 42}}
    end
  end

  describe "property with type number or nil:" do
    setup do
      %{schema: Xema.new(:properties, %{foo: [:number, nil]})}
    end

    test "with a number", %{schema: schema} do
      assert validate(schema, %{foo: 42}) == :ok
    end

    test "with nil", %{schema: schema} do
      assert validate(schema, %{foo: nil}) == :ok
    end

    test "with a string", %{schema: schema} do
      assert validate(schema, %{foo: "foo"}) ==
               {:error,
                %{properties: %{foo: %{type: [:number, nil], value: "foo"}}}}
    end
  end
end

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


function collide(me::Circle, other::Rectangle)
function collide(me::Polygon, other::Circle)
function collide(me::Polygon, other::Rectangle)

collide(objeto, outro)

#https://pt.stackoverflow.com/q/448123/101

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


chore: improve indexes for scheduler (#5043)

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/'


Use async.

Use async.

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/fux.git/'


Bug fix, for loading oldest file from seaweedfs with limit 1. (#1037)

* Bug fix, for loading oldest file from seaweedfs with limit 1.

* Sort in case of 2 oldest files. (olderone).

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/'


Increase timeout for snapshot directory deletion


adding auto help to command struct

adding auto help to command struct

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/mononym/exmud.git/'


Add a simple koan around basic message passing

defmodule ConcurrencyTest do
  use ExUnit.Case, async: true

  defmodule Computator do
    def double do
      receive do
        {sender, msg} ->
          send sender, { :ok, 2 * msg }
      end
    end
  end

  # @tag :focus
  test "spawns a process that passes back a message" do
    # run it in a separate process
    pid = spawn(Computator, :double, [])
    # send a message with the number we want to double
    send pid, {self, 10}
    # wait for the spawned process to send something back to us
    receive do
      {:ok, outcome} ->
        assert 20 == outcome
    end
  end
end

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


Added functions to get snapshots according to timezone (#820)


defines some initial mock data

defines some initial mock data

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/lookuppm/package_finder.git/'


Remove obsolete code related to thumbnails


Formatting

Formatting


Add timer module file

Add timer module file

defmodule Farmbot.CeleryScript.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(msg) do
    GenServer.call(__MODULE__, {:start_timer, msg})
  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, _msg}, _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/celery_script/estop_timer.ex' did not match any file(s) known to git


Add window example

Add window example

Application.ensure_started(:ex_ncurses)

ExNcurses.initscr()

# ExNcurses.start_color()
# ExNcurses.init_pair(1, :red, :black)
# ExNcurses.attron(1)
w = ExNcurses.newwin(20, 40, 5, 10)
ExNcurses.wborder(w)
ExNcurses.wmove(w, 5, 1)
ExNcurses.waddstr(w, "Hello, color. #{inspect(w)} Now press a key.")
ExNcurses.wrefresh(w)

# ExNcurses.attroff(1)
# ExNcurses.refresh()
ExNcurses.getch()
ExNcurses.endwin()

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


Add b-tree indexes to retros.facilitator_id and ideas.user_id

defmodule :"Elixir.RemoteRetro.Repo.Migrations.Add-foreign-key-indexes-to-retros-and-ideas" do
  use Ecto.Migration

  def change do
    create index(:retros, [:facilitator_id])
    create index(:ideas, [:user_id])
  end
end

error: pathspec 'priv/repo/migrations/20190331130808_add-foreign-key-indexes-to-retros-and-ideas.exs' did not match any file(s) known to git


Add Elixir example file

Add Elixir example file

# We cannot use to_char_list because it depends on inspect,
# which depends on protocol, which depends on this module.
import Elixir::Builtin, except: [to_char_list: 1]

defmodule Module do
  require Erlang.ets, as: ETS

  @moduledoc """
  This module provides many functions to deal with modules during
  compilation time. It allows a developer to dynamically attach
  documentation, merge data, register attributes and so forth.

  After the module is compiled, using many of the functions in
  this module will raise errors, since it is out of their purpose
  to inspect runtime data. Most of the runtime data can be inspected
  via the `__info__(attr)` function attached to each compiled module.
  """

  @doc """
  Evalutes the quotes contents in the given module context.
  Raises an error if the module was already compiled.

  ## Examples

      defmodule Foo do
        contents = quote do: (def sum(a, b), do: a + b)
        Module.eval_quoted __MODULE__, contents, [], __FILE__, __LINE__
      end

      Foo.sum(1, 2) #=> 3
  """
  def eval_quoted(module, quoted, binding, filename, line) do
    assert_not_compiled!(:eval_quoted, module)
    { binding, scope } = Erlang.elixir_module.binding_and_scope_for_eval(line, to_char_list(filename), module, binding)
    Erlang.elixir_def.reset_last(module)
    Erlang.elixir.eval_quoted([quoted], binding, line, scope)
  end

  @doc """
  Checks if the module is compiled or not.

  ## Examples

      defmodule Foo do
        Module.compiled?(__MODULE__) #=> false
      end

      Module.compiled?(Foo) #=> true

  """
  def compiled?(module) do
    table = data_table_for(module)
    table == ETS.info(table, :name)
  end

  @doc """
  Reads the data for the given module. This is used
  to read data of uncompiled modules. If the module
  was already compiled, you shoul access the data
  directly by invoking `__info__(:data)` in that module.

  ## Examples

      defmodule Foo do
        Module.merge_data __MODULE__, value: 1
        Module.read_data __MODULE__ #=> [value: 1]
      end

  """
  def read_data(module) do
    assert_not_compiled!(:read_data, module)
    ETS.lookup_element(data_table_for(module), :data, 2)
  end

  @doc """
  Reads the data from `module` at the given key `at`.

  ## Examples

      defmodule Foo do
        Module.merge_data __MODULE__, value: 1
        Module.read_data __MODULE__, :value #=> 1
      end

  """
  def read_data(module, at) do
    Orddict.get read_data(module), at
  end

  @doc """
  Merge the given data into the module, overriding any
  previous one.

  If any of the given data is a registered attribute, it is
  automatically added to the attribute set, instead of marking
  it as data. See register_attribute/2 and add_attribute/3 for
  more info.

  ## Examples

      defmodule Foo do
        Module.merge_data __MODULE__, value: 1
      end

      Foo.__info__(:data) #=> [value: 1]

  """
  def merge_data(module, data) do
    assert_not_compiled!(:merge_data, module)

    table      = data_table_for(module)
    old        = ETS.lookup_element(table, :data, 2)
    registered = ETS.lookup_element(table, :registered_attributes, 2)

    { attrs, new } = Enum.partition data, fn({k,_}) -> List.member?(registered, k) end
    Enum.each attrs, fn({k,v}) -> add_attribute(module, k, v) end
    ETS.insert(table, { :data,  Orddict.merge(old, new) })
  end

  @doc """
  Attaches documentation to a given function. It expects
  the module the function belongs to, the line (a non negative
  integer), the kind (def or defmacro), a tuple representing
  the function and its arity and the documentation, which should
  be either a binary or a boolean.

  ## Examples

      defmodule MyModule do
        Module.add_doc(__MODULE__, __LINE__ + 1, :def, { :version, 0 }, "Manually added docs")
        def version, do: 1
      end

  """
  def add_doc(module, line, kind, tuple, doc) when
      is_binary(doc) or is_boolean(doc) do
    assert_not_compiled!(:add_doc, module)
    case kind do
    match: :defp
      :warn
    else:
      table = docs_table_for(module)
      ETS.insert(table, { tuple, line, kind, doc })
      :ok
    end
  end

  @doc """
  Checks if a function was defined, regardless if it is
  a macro or a private function. Use function_defined?/3
  to assert for an specific type.

  ## Examples

      defmodule Example do
        Module.function_defined? __MODULE__, { :version, 0 } #=> false
        def version, do: 1
        Module.function_defined? __MODULE__, { :version, 0 } #=> true
      end

  """
  def function_defined?(module, tuple) when is_tuple(tuple) do
    assert_not_compiled!(:function_defined?, module)
    table = function_table_for(module)
    ETS.lookup(table, tuple) != []
  end

  @doc """
  Checks if a function was defined and also for its `kind`.
  `kind` can be either :def, :defp or :defmacro.

  ## Examples

      defmodule Example do
        Module.function_defined? __MODULE__, { :version, 0 }, :defp #=> false
        def version, do: 1
        Module.function_defined? __MODULE__, { :version, 0 }, :defp #=> false
      end

  """
  def function_defined?(module, tuple, kind) do
    List.member? defined_functions(module, kind), tuple
  end

  @doc """
  Return all functions defined in the given module.

  ## Examples

      defmodule Example do
        def version, do: 1
        Module.defined_functions __MODULE__ #=> [{:version,1}]
      end

  """
  def defined_functions(module) do
    assert_not_compiled!(:defined_functions, module)
    table = function_table_for(module)
    lc { tuple, _, _ } in ETS.tab2list(table), do: tuple
  end

  @doc """
  Returns all functions defined in te given module according
  to its kind.

  ## Examples

      defmodule Example do
        def version, do: 1
        Module.defined_functions __MODULE__, :def  #=> [{:version,1}]
        Module.defined_functions __MODULE__, :defp #=> []
      end

  """
  def defined_functions(module, kind) do
    assert_not_compiled!(:defined_functions, module)
    table = function_table_for(module)
    entry = kind_to_entry(kind)
    ETS.lookup_element(table, entry, 2)
  end

  @doc """
  Adds a compilation callback hook that is invoked
  exactly before the module is compiled.

  This callback is useful when used with `use` as a mechanism
  to clean up any internal data in the module before it is compiled.

  ## Examples

  Imagine you are creating a module/library that is meant for
  external usage called `MyLib`. It could be defined as:

      defmodule MyLib do
        def __using__(target) do
          Module.merge_data target, some_data: true
          Module.add_compile_callback(target, __MODULE__, :__callback__)
        end

        defmacro __callback__(target) do
          value = Orddict.get(Module.read_data(target), :some_data, [])
          quote do: (def my_lib_value, do: unquote(value))
        end
      end

  And a module could use `MyLib` with:

      defmodule App do
        use ModuleTest::ToBeUsed
      end

  In the example above, `MyLib` defines a data to the target. This data
  can be updated throughout the module definition and therefore, the final
  value of the data can only be compiled using a compiation callback,
  which will read the final value of :some_data and compile to a function.
  """
  def add_compile_callback(module, target, fun // :__compiling__) do
    assert_not_compiled!(:add_compile_callback, module)
    new   = { target, fun }
    table = data_table_for(module)
    old   = ETS.lookup_element(table, :compile_callbacks, 2)
    ETS.insert(table, { :compile_callbacks,  [new|old] })
  end

  @doc """
  Adds an Erlang attribute to the given module with the given
  key and value. The same attribute can be added more than once.

  ## Examples

      defmodule MyModule do
        Module.add_attribute __MODULE__, :custom_threshold_for_lib, 10
      end

  """
  def add_attribute(module, key, value) when is_atom(key) do
    assert_not_compiled!(:add_attribute, module)
    table = data_table_for(module)
    attrs = ETS.lookup_element(table, :attributes, 2)
    ETS.insert(table, { :attributes, [{key, value}|attrs] })
  end

  @doc """
  Deletes all attributes that matches the given key.

  ## Examples

      defmodule MyModule do
        Module.add_attribute __MODULE__, :custom_threshold_for_lib, 10
        Module.delete_attribute __MODULE__, :custom_threshold_for_lib
      end

  """
  def delete_attribute(module, key) when is_atom(key) do
    assert_not_compiled!(:delete_attribute, module)
    table = data_table_for(module)
    attrs = ETS.lookup_element(table, :attributes, 2)
    final = lc {k,v} in attrs, k != key, do: {k,v}
    ETS.insert(table, { :attributes, final })
  end

  @doc """
  Registers an attribute. This allows a developer to use the data API
  but Elixir will register the data as an attribute automatically.
  By default, `vsn`, `behavior` and other Erlang attributes are
  automatically registered.

  ## Examples

      defmodule MyModule do
        Module.register_attribute __MODULE__, :custom_threshold_for_lib
        @custom_threshold_for_lib 10
      end

  """
  def register_attribute(module, new) do
    assert_not_compiled!(:register_attribute, module)
    table = data_table_for(module)
    old = ETS.lookup_element(table, :registered_attributes, 2)
    ETS.insert(table, { :registered_attributes,  [new|old] })
  end

  @doc false
  # Used internally to compile documentation. This function
  # is private and must be used only internally.
  def compile_doc(module, line, kind, pair) do
    case read_data(module, :doc) do
    match: nil
      # We simply discard nil
    match: doc
      result = add_doc(module, line, kind, pair, doc)
      merge_data(module, doc: nil)
      result
    end
  end

  ## Helpers

  defp kind_to_entry(:def),      do: :public
  defp kind_to_entry(:defp),     do: :private
  defp kind_to_entry(:defmacro), do: :macros

  defp to_char_list(list) when is_list(list),  do: list
  defp to_char_list(bin)  when is_binary(bin), do: binary_to_list(bin)

  defp data_table_for(module) do
    list_to_atom Erlang.lists.concat([:d, module])
  end

  defp function_table_for(module) do
    list_to_atom Erlang.lists.concat([:f, module])
  end

  defp docs_table_for(module) do
    list_to_atom Erlang.lists.concat([:o, module])
  end

  defp assert_not_compiled!(fun, module) do
    compiled?(module) ||
      raise ArgumentError, message:
        "could not call #{fun} on module #{module} because it was already compiled"
  end
end

error: pathspec 'tests/examplefiles/example_elixir.ex' did not match any file(s) known to git


Don't log in a library (#144)

Don't log in a library (#144)

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/cs-victor-nascimento/joken.git/'


Work In Progress.

Work In Progress.


add missing doc to function

add missing doc to function


removed variable

removed variable

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/menuan/trolldryck.git/'


Revert "bump phoenix version"

Revert "bump phoenix version"

This reverts commit f6fb8f68ea2912bb1be16e953ede9fe18d49109f.

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/izakp/APR.git/'


Increment version [ci skip]

Increment version [ci skip]


Create mix.exs

Create mix.exs

defmodule Illacceptanything.MixProject do
  use Mix.Project

  def project do
    [
      app: :illacceptanything,
      version: "0.1.0",
      elixir: "~> 1.13",
      start_permanent: Mix.env() == :prod,
      deps: deps()
    ]
  end

  def application do
    [
      extra_applications: [:logger]
    ]
  end

  defp deps do
    []
  end
end

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


forces newer version for poison dependency

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/'


[Elixir Quiz] Solution for second problem - RLE.

defmodule RLE do
  def encode(input) do
    ones = Stream.cycle([ 1 ])

    Stream.zip(letters_stream(input), ones)
      |> Enum.reduce([], &group_by/2)
      |> Enum.reverse
      |> Enum.map(fn { letter, frequency } -> "#{frequency}#{letter}" end)
      |> Enum.join
  end

  def group_by({ ch, n1 }, [ { ch, n2 } | rest ]) do
    [ { ch, n1 + n2 } | rest ]
  end

  def group_by({ ch, n }, rest) do
    [ { ch, n } | rest ]
  end

  def letters_stream(input) do
    String.graphemes(input) |> Enum.take(String.length(input))
  end
end

ExUnit.start()

defmodule RunLengthEncoderTest do
  use ExUnit.Case, async: true

  test "Encoding works with all unique letters" do
    input  = "HORSE"
    output = "1H1O1R1S1E"

    assert RLE.encode(input) == output
  end

  test "Encoding works with all uppercase letters" do
    input  = "JJJTTWPPMMMMYYYYYYYYYVVVVVV"
    output = "3J2T1W2P4M9Y6V"

    assert RLE.encode(input) == output
  end
end

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


Helper.Html test

Helper.Html test

defmodule WeberHelperHtmlTest do
  use ExUnit.Case

  import Weber.Helper.Html

  test "Create a tag without attributes within text" do
    html = tag(:p, "test")
    assert(html == "
test
")
  end

  test "Create tag with attributes" do
    html = tag(:p, "test", [class: "test_class", id: "test_id"])
    assert(html == "
test
")
  end

  test "Create tag with attributes" do
    html = tag(:p, "test", [class: "test_class", id: "test_id", required: true])
    assert(html == "
test
")
  end
end

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


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/'


Add schema loading to mix ecto.setup

Add schema loading to mix ecto.setup


Add helpful mix task to change remote fbos env

defmodule Mix.Tasks.Farmbot.Firmware.EnvChange do
  use Mix.Task

  def run([node_name]) do
    node_name = connect!(node_name)
    files = :rpc.call(node_name, Path, :wildcard, ["/root/*-dev.sqlite3"])
    :rpc.call(node_name, Enum, :each, [files, fn(filename) ->
      new_filename = String.replace(filename, "dev", "prod")
      File.cp!(filename, new_filename)
    end])
  end

  defp connect!(farmbot_node) do
    farmbot_node = String.to_atom(farmbot_node)
    {:ok, _} = Node.start(:reloader, :shortnames)
    Node.set_cookie(:democookie)
    true = Node.connect(farmbot_node)
    Application.load(:farmbot)
    farmbot_node
  end
end

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


ase . syntax for accessing maps

ase . syntax for accessing maps

+ remove some more credo warnings

defmodule Pan.Parser.Episode do
  use Pan.Web, :controller
  alias Pan.Parser.Contributor
  alias Pan.Parser.Chapter
  alias Pan.Parser.Enclosure
  alias Pan.Parser.Author
  alias Pan.Repo
  require Logger

  def get_or_insert(episode_map, podcast_id) do
    case Repo.get_by(PanWeb.Episode, guid: episode_map.guid, podcast_id: podcast_id) do
      nil ->
        if episode_map.guid do
          insert(episode_map, podcast_id)
        else
          case Repo.get_by(PanWeb.Episode, title: episode_map.title || episode_map.subtitle,
                                           podcast_id: podcast_id) do
            nil ->
              insert(episode_map, podcast_id)
            episode ->
              {:exists, episode}
          end
        end
      episode ->
        {:exists, episode}
    end
  end

  def insert(episode_map, podcast_id) do
    # Here comes the line with the initial update time
    PanWeb.Podcast
    |> Repo.get(podcast_id)
    |> PanWeb.Podcast.changeset(%{update_intervall: 10,
                               next_update: Timex.shift(Timex.now(), hours: 10)})
    |> Repo.update()

    %PanWeb.Episode{podcast_id: podcast_id}
    |> Map.merge(episode_map)
    |> Repo.insert()
  end

  def get(episode_map, podcast_id) do
    case Repo.get_by(PanWeb.Episode, guid: episode_map.guid, podcast_id: podcast_id) do
      nil ->
        case Repo.get_by(PanWeb.Episode, title: episode_map.title, podcast_id: podcast_id) do
          nil ->
            {:error, "not_found"}
          episode ->
            {:exists, episode}
        end
      episode ->
        {:exists, episode}
    end
  end

  def persist_many(episodes_map, podcast) do
    for {_, episode_map} <- episodes_map do

      if episode_map.enclosures do
        first_enclosure = episode_map.enclosures |> Map.to_list |> List.first |> elem(1)
        fallback_url = if episode_map.link, do: episode_map.link, else: first_enclosure.url

        plain_episode_map = episode_map
        |> Map.drop([:chapters, :enclosures, :contributors])
        |> Map.put_new(:guid, fallback_url)

        case get_or_insert(plain_episode_map, podcast.id) do
          {:ok, episode} ->
            if episode_map.chapters do
              for {_, chapter_map} <- episode_map.chapters do
                Chapter.get_or_insert(chapter_map, episode.id)
              end
            end

            if episode_map.enclosures do
              for {_, enclosure_map} <- episode_map.enclosures do
                Enclosure.get_or_insert(enclosure_map, episode.id)
              end
            end

            Contributor.persist_many(episode_map.contributors, episode)
            Author.get_or_insert_persona_and_gig(episode_map.author, episode, podcast)
            Logger.info "\n\e[33m === Importing new episode: #{episode.title} ===\e[0m"
          {:exists, _episode} ->
            true
        end
      end
    end
  end

  def insert_contributors(episodes_map, podcast) do
    for {_, episode_map} <- episodes_map do
      if episode_map.enclosures do
        first_enclosure = episode_map.enclosures |> Map.to_list |> List.first |> elem(1)
        fallback_url = if episode_map.link, do: episode_map.link, else: first_enclosure.url

        plain_episode_map = episode_map
        |> Map.drop([:chapters, :enclosures, :contributors])
        |> Map.put_new(:guid, fallback_url)

        case get(plain_episode_map, podcast.id) do
          {:exists, episode} ->
            Contributor.persist_many(episode_map.contributors, episode)
            Logger.info "\n\e[33m === Updating contributors for episode: #{episode.title} ===\e[0m"

          {:error, "not_found"} ->
            true
        end
      end
    end
  end

  def clean() do
    episodes = Repo.all(PanWeb.Episode)

    for episode <- episodes do
      episode
      |> PanWeb.Episode.changeset(
        %{description: HtmlSanitizeEx2.basic_html_reduced(episode.description),
          summary:     HtmlSanitizeEx2.basic_html_reduced(episode.summary)}
      )
      |> Repo.update()
    end
  end
end

defmodule Pan.Parser.Episode do
  use Pan.Web, :controller
  alias Pan.Parser.Contributor
  alias Pan.Parser.Chapter
  alias Pan.Parser.Enclosure
  alias Pan.Parser.Author
  alias Pan.Repo
  require Logger

  def get_or_insert(episode_map, podcast_id) do
    case Repo.get_by(PanWeb.Episode, guid: episode_map[:guid], podcast_id: podcast_id) do
      nil ->
        if episode_map[:guid] do
          insert(episode_map, podcast_id)
        else
          case Repo.get_by(PanWeb.Episode, title: episode_map[:title] || episode_map[:subtitle],
                                           podcast_id: podcast_id) do
            nil ->
              insert(episode_map, podcast_id)
            episode ->
              {:exists, episode}
          end
        end
      episode ->
        {:exists, episode}
    end
  end

  def insert(episode_map, podcast_id) do
    # Here comes the line with the initial update time
    Repo.get(PanWeb.Podcast, podcast_id)
    |> PanWeb.Podcast.changeset(%{update_intervall: 10,
                               next_update: Timex.shift(Timex.now(), hours: 10)})
    |> Repo.update()

    %PanWeb.Episode{podcast_id: podcast_id}
    |> Map.merge(episode_map)
    |> Repo.insert()
  end

  def get(episode_map, podcast_id) do
    case Repo.get_by(PanWeb.Episode, guid: episode_map[:guid], podcast_id: podcast_id) do
      nil ->
        case Repo.get_by(PanWeb.Episode, title: episode_map[:title], podcast_id: podcast_id) do
          nil ->
            {:error, "not_found"}
          episode ->
            {:exists, episode}
        end
      episode ->
        {:exists, episode}
    end
  end

  def persist_many(episodes_map, podcast) do
    for {_, episode_map} <- episodes_map do

      if episode_map[:enclosures] do
        first_enclosure = episode_map[:enclosures] |> Map.to_list |> List.first |> elem(1)
        fallback_url = if episode_map[:link], do: episode_map[:link], else: first_enclosure[:url]

        plain_episode_map = Map.drop(episode_map, [:chapters, :enclosures, :contributors])
                            |> Map.put_new(:guid, fallback_url)

        case get_or_insert(plain_episode_map, podcast.id) do
          {:ok, episode} ->
            if episode_map[:chapters] do
              for {_, chapter_map} <- episode_map[:chapters] do
                Chapter.get_or_insert(chapter_map, episode.id)
              end
            end

            if episode_map[:enclosures] do
              for {_, enclosure_map} <- episode_map[:enclosures] do
                Enclosure.get_or_insert(enclosure_map, episode.id)
              end
            end

            Contributor.persist_many(episode_map[:contributors], episode)
            Author.get_or_insert_persona_and_gig(episode_map[:author], episode, podcast)
            Logger.info "\n\e[33m === Importing new episode: #{episode.title} ===\e[0m"
          {:exists, _episode} ->
            true
        end
      end
    end
  end

  def insert_contributors(episodes_map, podcast) do
    for {_, episode_map} <- episodes_map do
      if episode_map[:enclosures] do
        first_enclosure = episode_map[:enclosures] |> Map.to_list |> List.first |> elem(1)
        fallback_url = if episode_map[:link], do: episode_map[:link], else: first_enclosure[:url]

        plain_episode_map = Map.drop(episode_map, [:chapters, :enclosures, :contributors])
                            |> Map.put_new(:guid, fallback_url)

        case get(plain_episode_map, podcast.id) do
          {:exists, episode} ->
            Contributor.persist_many(episode_map[:contributors], episode)
            Logger.info "\n\e[33m === Updating contributors for episode: #{episode.title} ===\e[0m"

          {:error, "not_found"} ->
            true
        end
      end
    end
  end

  def clean() do
    episodes = Repo.all(PanWeb.Episode)

    for episode <- episodes do
      PanWeb.Episode.changeset(episode, %{description: HtmlSanitizeEx2.basic_html_reduced(episode.description),
                                          summary:     HtmlSanitizeEx2.basic_html_reduced(episode.summary)})
      |> Repo.update()
    end
  end
end


Force firmware to be flashed

Force firmware to be flashed

defmodule FarmbotCore.Config.Repo.Migrations.SetFirmwareFlashTrue do
  use Ecto.Migration

  def up do
    FarmbotCore.Config.update_config_value(:bool, "settings", "firmware_needs_flash", true)
  end

  def down do
    FarmbotCore.Config.update_config_value(:bool, "settings", "firmware_needs_flash", true)
  end
end

error: pathspec 'farmbot_core/priv/config/migrations/20191022175032_set_firmware_flash_true.exs' did not match any file(s) known to git


missed file in last checkin

missed file in last checkin

defmodule OpenAperture.Manager.Repo.Migrations.EncryptPevValues do
  use Ecto.Migration
  alias OpenAperture.Manager.Repo
  alias OpenAperture.Manager.DB.Models.ProductEnvironmentalVariable
  alias OpenAperture.Manager.Controllers.FormatHelper

  require Repo

  def change do
    alter table(:product_environmental_variables) do
      add :value_keyname, :boolean, null: true
    end

    ProductEnvironmentalVariable
    |> Repo.all
    |> Enum.map(&updatePEV/1)
  end

  def updatePEV(pev) do
    pev
    |> ProductEnvironmentalVariable.update(%{value: FormatHelper.encrypt_value(pev.value)})
    |> Repo.update
  end
end

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


missing required fields

missing required fields

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/'


Fix build

Fix build


fix: generate documents links (#4250)

fix: generate documents links (#4250)


Add migration for AskedQuestion

Add migration for AskedQuestion

defmodule BlueSky.Repo.Migrations.AddAskedQuestions do
  use Ecto.Migration

  def change do
    create table(:asked_questions) do
      add :room_id, references(:rooms, on_delete: :delete_all, type: :uuid)
      add :question_id, references(:questions, on_delete: :nothing)

      timestamps
    end

    create index(:asked_questions, [:room_id])
    create index(:asked_questions, [:question_id])
  end
end

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


Increase pool size for snapshot database

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 class controller

add class controller

defmodule HaruElixirApi.ClassController do
  use HaruElixirApi.Web, :controller

  def delete_class(conn, params) do
    json conn, params
  end

end

error: pathspec 'web/controllers/class_controller.ex' did not match any file(s) known to git


adding docs; adding callback behaviour

adding docs; adding callback behaviour

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/mononym/exmud.git/'