288 private links
About using C code:
- there obviously the potential bugs and vulnerabilities in the C code itself and in the code wrapping the C code.
- specific C toolchains, which makes things hard when you do cross compilation.
- you (sometimes) need to deploy the dynamically-linked C library (OpenSSL). It prevents you from using secure FROM scratch container images.
- can't compile it for WebAssembly.
- maintenance! it's hard to review a 2000 line implementation of an encryption algorithm
Pure Rust cryptography is usually around 10-25% slower than an ultra optimized C or assembly code.
Différent ways to handle errors in Rust.
In favor of the clap crate that allows delevopers to build quickly in Rust.
The naive Rust implémentation is 10 times faster than the python one.
It remains 6 times faster than the optimized one.
The Python has a collections.Counter class that is approximately as fast as the naive Rust version.
It does not work on my Raspberry Pi yet.
I get a:
atuin: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.39' not found (required by atuin)
rustup target add armv7-unknown-linux-gnueabihf
sudo apt-get install gcc-arm-linux-gnueabihf libgcc-13-dev-armhf-cross
- In
~/.cargo/config.toml
:[target.armv7-unknown-linux-gnueabihf] linker = "arm-linux-gnueabihf-gcc"
cargo install --target=armv7-unknown-linux-gnueabihf --target-dir=$(pwd) --root=$(pwd) BINARY
- Upload the binray to the raspberry pi, i.e.
/usr/local/bin
After a first successful installation, only 4. and 5. are of course required.
Magisk is a suite of open source software for customizing Android, supporting devices higher than Android 6.0.
The native
part is written in Rust.
A joke about rust infrastructure. It becomes obsolete as time goes.
- avoid uneccessary default features
- use specialized lighter crates
I have the same idea for a node js backend serving a fancy UI :)
It would be better to split the UI and the server while developing to benefit from hot reloading.
Example: https://git.sr.ht/~pyrossh/rust-embed/tree/master/item/examples/axum-spa/main.rs
- relying on shared mutation
- treat the compiler as something trying to help
- ignoring proper module organization
You have to unlearn a few habits.
- Writing Rust code like other languages
- Neglecting the most important 20% of Rust. Trying to learn everything at once: you don't need to learn all at once. Focus on the 20% that gives the 80%.
- Being a productive procrastinator: watch a video or read a blog post.
- Thinking you can vibe code Rust like JS...
Hands on practice! The programmer has to internalize the concepts of Rust. Getting a grasp is not enough.
Replace the standard DefaultHasher
to ahash::{AHashMap, AHashSet}
to gain 18% improvements.
I don't understand some things here
- gen blocks: similar to python generators as far as I understand. They are lightweight compared to the classic Iterator pattern
- default field values (and avoid new() for it)
- inner structs
- never type
- try expressions
The ability to run scripts is also a great feature imho.
Create a type similar to another existing type :O