Related to the Elixirforum topic "Streaming lines from an enum of chunks"
You can find this 4.4M file at this url: https://poeticoding-data.sfo2.digitaloceanspaces.com/httpstream/numbers_small.txt
mix deps.get to download the dependencies (benchee)
Related to the Elixirforum topic "Streaming lines from an enum of chunks"
You can find this 4.4M file at this url: https://poeticoding-data.sfo2.digitaloceanspaces.com/httpstream/numbers_small.txt
mix deps.get to download the dependencies (benchee)
| lines = File.stream!("file_path") | |
| chunks = File.stream!("file_path",[],2_048) | |
| hash_fun = fn enum -> | |
| enum | |
| |> Enum.reduce(:crypto.hash_init(:sha),&(:crypto.hash_update(&2, &1))) | |
| |> :crypto.hash_final() | |
| |> Base.encode16() | |
| end |
| /* to add to assets/css/app.css */ | |
| .thumb-selected { | |
| border: 4px solid #0069d9; | |
| } | |
| .thumb-unselected { | |
| opacity: 0.5; | |
| } |
| IO.puts("I'm here! Sleeping for 2 seconds") | |
| Process.sleep 2_000 # waiting for the other node | |
| nodes = MapSet.new([:app@app1, :app@app2]) | |
| other_node = | |
| nodes | |
| |> MapSet.delete(Node.self()) | |
| |> MapSet.to_list() | |
| |> List.first() |
| # AoC 2022 in Elixir |