It's so satisfying if you have so tricky C construct and you find a way to map it to idiomatic Rust.
With that you can switch scenes, adjust scenes items and all kinda sorts of stuff directly from #rust (all the heavy lifting done by obs-websocket though, this is a client library for it).
You can listen for events (created by user interactions) as well.
So I finally made my log file based ip blocker, called Veto, available on GitHub. It's similar to fail2ban but more focused on web server logs and performance.
Sorry @musicmatze for waiting so long, hope you like it and maybe even give it a try.
So I installed #fail2ban the other day on my small vps and during a load test I found out that it takes up more than 60% of the CPU during high load. I use(d) it to block annoying attempts to open random php admin pages (I don't even use PHP).
Figured out it's written in python and actually expected such a popular basic tool to be written in C for best performance...
So I started writing a mini clone in #rust and it can handle 300,000 lines/sec on 1 cpu core in first tests.
Rewrote my #adventofcode day 6 challenge in #rust from building an object tree with Rc + RefCell to a much simpler version that only uses a string to string mapping for the tree traversal.
Also threw in FNV as HashMap hasher for an extra speed bump. The difference is huge.
Part 1 is 61% faster (598 μs down to 233 μs).
Part 2 is 97% faster (40 ms down to 1 ms).
Everything worked in the end, but sharing mutable references in rust is quite a messy thing. Now my type definition looks like
And my code is full of
I wonder if there is a cleaner way 🤔...
Nice, Tokio 0.2.0. Gonna play around with #rust async/await soon.
Was doing my first work with #rust's procedural macros last week. Awesome AST manipulation techniques and actually quite easy to use.
Despite its high learning curve, it's a breeze to work with, unlike in other languages (looking at you Java and your annotation processors).
🦀 Rust, 🐹 Go and 🍵 Kotlin enthusiast
This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!