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)
| # AoC 2022 in Elixir | 
| 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() | 
| /* to add to assets/css/app.css */ | |
| .thumb-selected { | |
| border: 4px solid #0069d9; | |
| } | |
| .thumb-unselected { | |
| opacity: 0.5; | |
| } | 
| 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 | 
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)
| defmodule Example do | |
| use GenServer | |
| def start_link(_) do | |
| GenServer.start_link __MODULE__, :ok, [] | |
| end | |
| def init(:ok) do | |
| {:ok, []} | |
| end | 
| docker container run -p 8000:80 nginx | 
| lazy_csv_fn = fn -> | |
| File.stream!("large.csv") | |
| |> Stream.map(&String.trim(&1)) | |
| |> Stream.map(&String.split(&1, ",")) | |
| |> Stream.filter(fn | |
| ["Timestamp" | _] -> false | |
| [_, "NaN" | _] -> false | |
| [timestamp | _] -> | |
| true | |
| end) |> Enum.find(fn | 
| defmodule Coinbase.Client do | |
| use WebSockex | |
| @url "wss://ws-feed.pro.coinbase.com" | |
| def start_link(products \\ []) do | |
| {:ok, pid} = WebSockex.start_link(@url, __MODULE__, %{}) | |
| subscribe(pid, products) | |
| {:ok, pid} | |
| end | 
| .site-header { | |
| background: white !important; | |
| background-color: white !important; | |
| } |