Post AlrrZKHMUiMxedKOCe by crepererum@mastodon.online
 (DIR) More posts by crepererum@mastodon.online
 (DIR) Post #AlrrZKHMUiMxedKOCe by crepererum@mastodon.online
       0 likes, 0 repeats
       
       Engineers may prefer scripting languages like #Python over compiled languages like #Rust because they think it's quicker. However I find that even during incidents, you can totally build compiled CLI helpers in #Rust. They are easier to get correct, they are faster, and you can easily ship small static binaries to servers where you have stable network connections.
       
 (DIR) Post #AlrrZL4HYpV86MDSSG by FSMaxB@mastodon.cloud
       0 likes, 1 repeats
       
       @crepererum Agreed. As weird as it sounds. Rust has become my scripting language of choice.It's a bit slower at first, but if I even have to do a few iterations on it, there comes an inflection point where the type system helps me more than it slows me down. Especially helpful is serde when it comes to ad-hoc data parsing for further processing.
       
 (DIR) Post #AlrrZMbzoy3ytCztdw by FSMaxB@mastodon.cloud
       0 likes, 0 repeats
       
       @crepererum What also helps with throwing things together very quickly is docs.rs together with the strong typing of APIs. I haven't encountered a language where I have had such a streamlined and fast process of finding a third party library for something and putting it into a one-off project.With most other languages, the time it takes to figure out where some project is documented and how to interpret the (often subpar) documentation is just longer than doing it in rust.
       
 (DIR) Post #AlrrZNZuEDz9t11k1Y by FSMaxB@mastodon.cloud
       0 likes, 0 repeats
       
       @crepererum Not that rust documentations are always great, but they are in the same place and follow the same format at least, so navigating it doesn't have to be learnt from scratch every time.And even though many libraries don't have any documentation whatsoever, just looking at the types is often enough to make things work (if it's not some stringly typed mess).
       
 (DIR) Post #AlrrdOnfcvwmpoNkY4 by pitbuster@lile.cl
       0 likes, 0 repeats
       
       @FSMaxB I even did a tech talk at my job about using Rust as a "scripting language" @crepererum
       
 (DIR) Post #AlsDtTdDd5oRRaZ69o by Psyhackological@mastodon.social
       0 likes, 0 repeats
       
       @pitbuster @FSMaxB @crepererum link please
       
 (DIR) Post #AlsHNqTTZ3yeq8BEwK by pitbuster@lile.cl
       0 likes, 0 repeats
       
       @Psyhackological sadly I cannot share, as it was designed to be internal only and taking the confidential stuff out would be harder than making a new presentation 😅  @FSMaxB @crepererum
       
 (DIR) Post #Alt05xiKPBbA19ySGW by Psyhackological@mastodon.social
       0 likes, 0 repeats
       
       @pitbuster @FSMaxB @crepererum shamee. Do you have anything to share though?
       
 (DIR) Post #Alvnfw63BE5tUqlzeK by pitbuster@lile.cl
       0 likes, 0 repeats
       
       @Psyhackological well, I basically just mentioned nice crates to work with:- `anyhow` for error handling- `camino` for nicer UTF-8 paths- `clap` for cli arguments- `serde` for data parsingand a little mention on `tokio` for async-ness@FSMaxB @crepererum
       
 (DIR) Post #Alvp7YmLZJCnExIDwW by Psyhackological@mastodon.social
       0 likes, 0 repeats
       
       @pitbuster @FSMaxB @crepererum does it also relate to this? https://rust-lang.github.io/rfcs/3424-cargo-script.html
       
 (DIR) Post #AlvpzVvuMhOU3GUakS by pitbuster@lile.cl
       0 likes, 0 repeats
       
       @Psyhackological yes and no, the use of script here was lax and meant any custom tool for a "small task". Definitely the `cargo-script` thing would make it easier to work that way, but you can definitely do without that @FSMaxB @crepererum
       
 (DIR) Post #AlvsgcAJGke1k0uNWa by crepererum@mastodon.online
       0 likes, 0 repeats
       
       @pitbuster @Psyhackological @FSMaxB I agree.FWIW: you can use cargo script in nightly already. I do that occasionally. The biggest issue there is that rust analyzer doesn't know how to handle it, so you have to live without autocompletion, which is somewhat of a show stopper when you try to hammer out something under time pressure.
       
 (DIR) Post #AlvzBFYXyjbsK3EiXI by Psyhackological@mastodon.social
       0 likes, 0 repeats
       
       @pitbuster @FSMaxB @crepererum I see. Could you list example use cases that it was very pragmatic in?
       
 (DIR) Post #Alw0u7khwKOH6XszPU by pitbuster@lile.cl
       0 likes, 0 repeats
       
       @Psyhackological the ones I can mention where: I needed to do some simple scrapping, but the urls of the images to download where inside some json data (and I wanted the downloads to happen in parallel). The other one was to generate some fake traffic so we had reports in an account meant for pentesting. I could have used basically any language for any of those, but I really think the nice type system helped reduce the number of iterations to almost none, while still having nice libraries.
       
 (DIR) Post #Alw2KPjDpNl0L7I64m by Psyhackological@mastodon.social
       0 likes, 0 repeats
       
       @pitbuster 1) what about using Bash with jq and parallel? You can go even further using https://github.com/01mf02/jaq2) I think this was a nice fit as you can control many things when comes to performance using Rust while more scripting like languages like Python and Bash don't especially most of coreutils are single threaded.Sometimes can't tell what's right - "hacking" already mature C tools in Bash, doing inefficient script in Python that "just works" or having something rock solid like Rust.
       
 (DIR) Post #Alw5SGANYwMirYQTvE by pitbuster@lile.cl
       0 likes, 0 repeats
       
       @Psyhackological I learned about `jq`/`jaq` afterwards, and yes, that would have worked, but in any case, doing even the most basic forms of data manipulation in bash is something I would avoid.
       
 (DIR) Post #AlwJhm0SrYZ1Jb52Yq by Psyhackological@mastodon.social
       0 likes, 0 repeats
       
       @pitbuster I see, why?