mattbaker

mattbaker

Anyone else doing the Protohackers challenges?

I’m having so much fun working on the “Protohackers” challenges, I never got into Advent of Code much but this has been amazing. The challenges are all centered around protocols, so far they’ve all required you build a TCP server (gen_tcp makes it easy).

Also it’s an area Erlang/Elixir really excels at, so it’s fun to build lower level things that leverage all the great Erlang stuff, something I don’t think most of us get to do too often! Good opportunities to play with gen_tcp, messing with bits and bytes, and using binary pattern matching.

There’s an #elixir channel in the protohacker discord if you decide to jump in! :slight_smile:

Couple last things to mention:

  • ngrok doesn’t work, it seems to mess with TCP traffic, so I opened a port in my firewall and forwarded it to my laptop, then I provided that port along with my public IP. I liked that because I didn’t have to bother deploying my app to a VPS/Fly.io/etc. I just closed the port when I was done.
  • The Elixir intro actually has a section where you implement an echo server with gen_tcp, it’s perfect for getting started.

Most Liked

ahamez

ahamez

Hey! If anyone’s interested, here’s my solutions for problems to to 8: GitHub - ahamez/protohackers: Elixir solutions for https://protohackers.com.
It was a fun experience so far (except for problem 7, the specification lacks some details which nearly drove me nuts :crazy_face:).
Also, I’ve been able to use Nx for problem 8 by encoding the cipher as a matrix, it was very fun to do!

lud

lud

Okay, today I learnt :smiley: Thank you. I do not use ngrok but it seems that all commercial tunnel software will suffer from the same problem.

@mattbaker here is my last attempt https://github.com/lud/protohackers/blob/main/lib/proto/p0/smoke_test.ex .

jackharrhy

jackharrhy

I’ve been doing them! My question 2 (means to an end) solution needs work, but otherwise been having a blast so far.

NobbZ

NobbZ

I finished my attempt to the smoke_test yesterday and tinkered a bit with the repo setup over the day.

jackharrhy

jackharrhy

I’ve been cloning the repo to my server, and wrote a little script to book into an iex shell w/the application running ( protohackers/run-in-docker.sh at main · jackharrhy/protohackers · GitHub )

been working good so far!

Where Next?

Popular in Challenges Top

bjorng
This topic is about Day 17 of the Advent of Code 2020 . Thanks to @egze, we have a private leaderboard: https://adventofcode.com/2020/l...
New
Aetherus
This topic is about Day 3 of the Advent of Code 2020 . Thanks to @egze, we have a private leaderboard: https://adventofcode.com/2020/le...
New
bjorng
This topic is about Day 5 of the Advent of Code 2021. We have a private leaderboard (shared with users of Erlang Forums ): https://adve...
New
sukhmeetsd
All in all, from what I understand, it is better not to use GenServer.cast when we want some concurrent operations to happen for sure, be...
New
rugyoga
Fairly straightforward Dijkstra’s algorithm import AOC aoc 2023, 17 do def compute(input, candidates) do {{max_row, max_col}, ite...
New
bjorng
This topic is about Day 15 of the Advent of Code 2021. We have a private leaderboard (shared with users of Erlang Forums): https://adve...
New
Aetherus
Today’s problem is really tense. I don’t think I can do it without libgraph.
New
adamu
Probably not the most efficient implementation, because part 1 took >1 ms and part 2 >4ms, but the code was simple enough. def p...
New
cblavier
Hi, there :wave: Today, I felt it was way more challenging! I went through part2 thanks to Agent based memoization (without memoization ...
New
coen.bakker
Since I started using Elixir, I have benefited greatly from being able to study various open-source projects. The codebase of LiveBook, i...
New

Other popular topics Top

_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New

We're in Beta

About us Mission Statement