Advanced Search
Search Results
30 total results found
Frameworks
A collection of tutorials for some frameworks I often use.
Basics
The basics of Rust.
Actix-Web
actix-web is a framework for writting web applications and REST APIs. Installation # To install: cargo add actix-web # Recommended for validation cargo add validator actix-web-validator Simple example #[get("/hello") async fn hello() -> Response { ...
Tracing
Tracing is a library for logging. It consists of multiple libraries. You need at least tracing, which is the base of the logging system, and tracing_subscriber, which defines the subscriber of the tracing messages. # To install cargo add tracing tracing_subs...
TypeScript
Patterns
Exhaustive patterns In this case, exhaustive means "It covers all cases", e.g. for an enum, so when a new entry is added, it causes an error until this case is considered everywhere. Example with never: enum Status { Open, InProgress, Done, } ...
Tricks
Allow everything what can be a str reference fn do_something<S: AsRef<str>>(input: S) { let input_str = input.as_ref(); println!("This is a &str: {}", input_str); } do_something("Hello World"); do_something("Hello World".to_string());
Serde
Serde (Serialize and Deserialize) is a library to serialize and deserialize data to or from a struct. This is usually used with language based crates like serde_json for JSON or serde_yaml for YAML. To use it, install it, and then you can use the derives on y...
Cross compilation
You can cross compile your Rust code using the target specifier. For example: cargo build --target x86_64-unknown-linux-gnu --release You can list all targets using rustup target list and add the targets you need. But often you need an environment with the c...
Check open ports
If you want to check open ports on your Linux device, you can use the ss command (socket statistics). Older versions may use netstat. ss Example: ss -tulpen Flags: -t → TCP -u → UDP -l → nur listening sockets -p → Prozess anzeigen -e → erweiterte In...
ffmpeg
Modify Images
Resize ffmpeg -i input.jpg -vf "scale=1920:-1" output.jpg Change quality ffmpeg -i input.jpg -q:v 5 output.jpg Quality goes from 2 (best) to 31 (worst). 2-5 High quality 6-10 Good compression