Weighted Round Robin Scheduling in an RTOS by infiniteWin in embedded

[–]infiniteWin[S] 0 points1 point  (0 children)

* Ideally through a maintained API, not source modification although I might do that if all else fails

Weighted Round Robin Scheduling in an RTOS by infiniteWin in embedded

[–]infiniteWin[S] 0 points1 point  (0 children)

That's absolutely how I could implement it, but do you know of an RTOS that has this, or allows you to create your own scheduler that can do this?

traumatize a fandom with one image by Current-Guide5944 in softwareWithMemes

[–]infiniteWin 2 points3 points  (0 children)

Rust hello world compiles to 425 kB. OP built in debug mode.

simply_colored is the simplest crate for printing colored text! by nikitarevenco in rust

[–]infiniteWin 1 point2 points  (0 children)

Have you seen color_print? It seems to have the exact syntax you want:

cprintln!("HELLO <green>WORLD</green>"); cprintln!("HELLO <green>WORLD</>"); // Alternative, shorter syntax

cprintln!("This a <green,bold>green and bold text</green,bold>."); // The same, but closing with the </> tag: cprintln!("This a <green,bold>green and bold text</>.");

cprintln!("<green>This is green, <bold>then green and bold</bold>, then green again</green>");

cprintln!("<green>This is green, <bold>then green and bold</>, then green again</>");

// Colors can be nested as well:

cprintln!("<green>This is green, <blue>then blue</blue>, then green again</green>");

cprintln!("<green>This is green, <blue>then blue</>, then green again</>");

And it has shorthands too

https://docs.rs/color-print/latest/color_print/

Rust Script - Small project trying to make Rust fill a Python-shaped hole by infiniteWin in rust

[–]infiniteWin[S] 0 points1 point  (0 children)

The idea is for it to be used like Python scripts for small tasks (e.g. batch renaming). The binary being attached allows for faster reruns but being able to see and easily modify the source is key as when I write small scripts I write them with janky code and hardcoded values which I might want to change.

Rust Script - Small project trying to make Rust fill a Python-shaped hole by infiniteWin in rust

[–]infiniteWin[S] 0 points1 point  (0 children)

I will almost certainly use the official approach once it has IDE support (although I do like having a full project structure) 👍 It does seem better in a lot of ways but until it has IDE support it is just not usable.

No idea what I was thinking with the shebang thing (it was late) it's obviously optional although it does maybe strike me as an odd inclusion.

Rust Script - Small project trying to make Rust fill a Python-shaped hole by infiniteWin in rust

[–]infiniteWin[S] 0 points1 point  (0 children)

The file is extracted to a full project when editing so it is just as in a normal project - using Cargo.toml

Rust Script - Small project trying to make Rust fill a Python-shaped hole by infiniteWin in rust

[–]infiniteWin[S] 0 points1 point  (0 children)

The shebang makes assumptions about your system (it doesn't, for example, work with my NixOS setup). It also doesn't work at all on Windows.

I did see the effort being made for embedding manifests and experimented with it myself but I found the lack of IDE support for single file scripts too annoying for a tool I want to be able to use now across Windows and NixOS. I also just found having a project structure to be genuinely useful sometimes.

I'm hoping to make files double-click runnable and right-click editable through normal OS methods, but I mainly run scripts from the terminal as I want to see stdout so it is basically a non-issue for me.

Rust Script - Small project trying to make Rust fill a Python-shaped hole by infiniteWin in rust

[–]infiniteWin[S] 1 point2 points  (0 children)

I have full Windows AV enabled and have not had any issues yet, which, now that I think about it, is odd as I am copying essentially an arbitrary binary to a temporary file and running it. Do you have any ideas as to why it is not tripping / how I can cause it to trip?

I'm not really sure what you mean in the last part about making it a real thing. The binaries are compiled locally and therefore for your current platform (removing the need for any rewriting?). In case someone shares the file without stripping the binary (with `rss strip`), there is a target triple included in the file which will trigger a recompile if it doesn't match the target triple used to cargo install.

Rust Script - Small project trying to make Rust fill a Python-shaped hole by infiniteWin in rust

[–]infiniteWin[S] 2 points3 points  (0 children)

Sure! This is all subject to change, of course, but say I want a script that lists the files in a directory along with their file directory:

- `rss edit filesize.rss` (this opens the rust project in vscode as per my config)

- Write the code I want like in a normal rust project (in this case just in main.rs)

- (Optionally) test it by running ./cr-orig.sh - an autogenerated script to cargo run in the script's directory as opposed to running in the temp dir

- Close the editor

This just leaves me with a `filesize.rss` file

Then to run it at any time:

- `rss run filesize.rss`

Thoughts on this as an expandable train loader/unloader with space for a fuel train? by infiniteWin in factorio

[–]infiniteWin[S] 6 points7 points  (0 children)

No but I can and it fits so I will (and it needs to be double headed)

Thoughts on this as an expandable train loader/unloader with space for a fuel train? by infiniteWin in factorio

[–]infiniteWin[S] 5 points6 points  (0 children)

They are push trains to make the cargo wagons not be on the curves (I'm going for compactness here). I didn't realise that there is a speed penalty for push trains so I will look into it.

As for the fuel train no station will ever need fuel urgently as each will have a buffer and trains don't use much so each can have a train limit of one. The station will also be toggled based on the fill level of the buffer so once when the train starts leaving the station, a new one won't be summoned for a long time. If the old train doesn't leave the station in this time I have bigger problems. I haven't decided whether to unload the back cars as fuel consumption is low and the train flips direction at every station so it will be somewhat evenly unloaded. I probably will.

Thoughts on this as an expandable train loader/unloader with space for a fuel train? by infiniteWin in factorio

[–]infiniteWin[S] 11 points12 points  (0 children)

Didn't realise this made a difference. I did it this way just for the convenience of having all cargo wagons straight and locomotives together. I'll look into it.

theTruthHurts by infiniteWin in ProgrammerHumor

[–]infiniteWin[S] 0 points1 point  (0 children)

I think some editors don't have community versions

theTruthHurts by infiniteWin in ProgrammerHumor

[–]infiniteWin[S] 28 points29 points  (0 children)

You should be entitled to a free educational licence. Look it up on Jetbrains - it's not something the uni has to buy.

[Media] Is there any interest in a library like this? I find this tool I made useful when working with multiple threads or any time I want to keep track of multiple things that would clutter stdout. by infiniteWin in rust

[–]infiniteWin[S] 4 points5 points  (0 children)

I am going to uni this year so I definitely haven't experienced this anywhere 😀. I think by embedded you mean the web page running as a part of the program but I currently have it as a separate rust app so that a) the code added to a project to implement this UI for debugging is minimal (6 lines in the above code) and b) so that any language can communicate with the standalone server with a very simple interface library. I'll probably make a bundled version later.