This removes the unused files, as well as cleans mix.lock.
> mix deps.clean --unused --unlock
> mix deps.clean --unused --unlock
@doc """ Returns the map with the keys in kmap renamed to the values in kmap. """ def rename_keys(map, kmap) when is_map(map) and is_map(kmap) do for {key, value} <- map, into: %{}, do: if(new_key = Map.get(kmap, key), do: {new_key, value}, else: {key, value}) end
@doc """ If `key` exists in `map`, updates its value (assumed to be a list) by concatenating `value`. If `key` does not exist in `map`, creates `{key => [value]}` in `map`. ## Examples iex(35)> Tap.Worker.update_conj!(%{a: [1]}, :a, 2) %{a: [1, 2]} iex(36)> Tap.Worker.update_conj!(%{a: [1]}, :b, 2) %{a: [1], b: [2]} """ @spec update_conj!(map, any, any) :: map def update_conj!(map, key, value) when is_map(map) do Map.update(map, key, [value], fn existing_values when is_list(existing_values) -> existing_values ++ [value] existing_value -> raise(ArgumentError, "Value is not a list: #{inspect(existing_value)}") end) end
def to_struct(kind, attrs) do struct = struct(kind) Logger.debug("attrs = #{inspect(attrs)}") Enum.reduce(Map.to_list(struct), struct, fn {k, _}, acc -> case Map.fetch(attrs, k) do {:ok, v} -> %{acc | k => v} :error -> acc end end) end
Volumes
However, some file mounted through a volume in docker-compose invariably resulted in a directory being created in the container instead of a file.
docker-compose.yaml
version: "3.8" services: postgres: container_name: oss-postgres image: postgres:14-alpine stdin_open: true tty: true restart: always ports: - 5432:5432 volumes: - ./postgres/postgres.sh:/docker-entrypoint-initdb.d/postgres.sh environment: POSTGRES_PASSWORD: "xxx"logs
oss-postgres | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/postgres.sh oss-postgres | /usr/local/bin/docker-entrypoint.sh: line 169: /docker-entrypoint-initdb.d/postgres.sh: Is a directory oss-postgres exited with code 126It appears that the volumes need being created in the Minikube VM beforehand (source: Replace Docker Desktop with Minikube and Hyperkit on macOS), like in:
> minikube stop > minikube start --mount --mount-string="/Users/jerome/src/boss/:/Users/jerome/src/boss/" --memory 4096 --cpus 4
Ports
Any service previously reachable through localhost by port forwarding is now available by using docker.dev, mapped to minikube ip
in /etc/hosts.
NOTE
Never use .local domain on macOS, or DNS resolving will become awfully slow: use for ex. docker.dev instead of docker.local for the hostname of the minikube ip, contrary to what the 1st article proposes.iex(20)> Enum.reduce(%{"code" => 33, "kind" => 2, "servid" => 13}, [], fn {k, v}, acc -> acc ++ [{String.to_atom(k), v}] end) [code: 33, kind: 2, servid: 13]or
iex(23)> for {k, v} <- %{"code" => 33, "kind" => 2, "servid" => 13}, do: {String.to_atom(k), v} [code: 33, kind: 2, servid: 13]
*elixir-ls::stderr*
buffer, then install exec-path-from-shell by using M-x package-list-packages
.
crmmbqt=# create table demo (a int, b int, c int, d int);
crmmbqt=# insert into demo (a, b, c, d) values (1,2,1,1), (2,1,3,1), (3,4,5,2), (4,3,4,2);
INSERT 0 4
Time: 6.106 ms
crmmbqt=# select * from demo;
┌───┬───┬───┬───┐
│ a │ b │ c │ d │
├───┼───┼───┼───┤
│ 1 │ 2 │ 1 │ 1 │
│ 2 │ 1 │ 3 │ 1 │
│ 3 │ 4 │ 5 │ 2 │
│ 4 │ 3 │ 4 │ 2 │
└───┴───┴───┴───┘
(4 rows)
crmmbqt=# select first_value(a) over (partition by d order by c) as a, first_value(b) over (partition by d order by c) as b, c, d from demo;
┌───┬───┬───┬───┐
│ a │ b │ c │ d │
├───┼───┼───┼───┤
│ 1 │ 2 │ 1 │ 1 │
│ 1 │ 2 │ 3 │ 1 │
│ 4 │ 3 │ 4 │ 2 │
│ 4 │ 3 │ 5 │ 2 │
└───┴───┴───┴───┘
(4 rows)
first_value(a) over (partition by d order by c desc)
crmmbqt=# select min(a) as a, min(b) as b, min(c), d from (select first_value(a) over (partition by d order by c) as a, first_value(b) over (partition by d order by c) as b, c, d from demo) as foo group by d;
┌───┬───┬─────┬───┐
│ a │ b │ min │ d │
├───┼───┼─────┼───┤
│ 1 │ 2 │ 1 │ 1 │
│ 4 │ 3 │ 4 │ 2 │
└───┴───┴─────┴───┘
(2 rows)
> git --version git version 2.18.0This method did not work for me: Move files from one repository to another, preserving git history
> mkdir cloneA > cd cloneA/ > git clone git@github.com:<MY_TEAM>/connectmv.git > cd connectmv/ > git subtree split --prefix perl/ --branch my-subtree > git checkout my-subtree > git remote add repoA git@github.com::<MY_TEAM>/ss-sms-vas.git > git pull repoA main --allow-unrelated-histories > git push -u repoA my-subtree:main > cd ../../ > rm -rf cloneA/ > cd ss-sms-vas/ > git pull > git lol lib/MBQT/mod_perl/AbstractVas.pm * 72be224f (Thu Jan 7 18:32:47 2021 Jerome G) PLTBUGS-8700: exploded USSD CDR per process * 680a9ff2 (Thu Jan 7 13:51:45 2021 Jerome G) PLTBUGS-8700: removed unlock ...