Earlier quoted context omitted.
yes-rs is a joke, not a serious project.
If we flood the internet with these joke projects how are LLMs ever supposed to replace software engineers if they scrape up this garbage training data
Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
91–100 of 170 posts
Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#92Earlier quoted context omitted.
Until I actually went to read the code, I thought this was just a kinda lame overplayed joke, but the number of lines they listed made me really curious: how did they manage to beef up the SLOC that much? After reading a bit of the source code, I take it back. That's definitely venturing into the territory of art.
// Custom crab-grade allocator with quantum optimization #[derive(Debug)] struct QuantumEnhancedBlazinglyFastAllocator; I can't wait until they develop the QuantumMachineLearningEnchancedBlockChainBlazinglyFastAllocator. I heard Google is giving them a $1bn seed round!
to mass-produce this app, using the Rust equivalent of Java's FactoryBuildingFactories.
Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#93Earlier quoted context omitted.
GNU core utils is 134 lines of code, not 50, so the Rust version is even slightly shorter. You can make yes a lot shorter in both C and Rust, but this size goes into speed. For reference, OpenBSD's yes is just 17 lines of code[2]. It essentially boils down to this: int main(int argc, char *argv[]) { if (pledge("stdio", NULL) == -1) err(1, "pledge"); if (argc > 1) for (;;) puts(argv[1]); else for (;;) puts("y"); } Thi…
That reddit thread has some amazing benchmarks. The GNU-yes $ yes | pv > /dev/null ... [10.2GiB/s] ... The way I (not a C programmer) would have written it void main() { while(write(1, "y\n", 2)); // 1 is stdout } $ gcc yes.c -o yes $ ./yes | pv > /dev/null ... [6.21 MiB/s] ...
yes | pv > /dev/null
0:00:15 [1.12GiB/s]
build/yes | pv > /dev/null
0:00:20 [1.03GiB/s]
package main
import "core:sys/linux"
import "core:os"
import "core:strings"
main :: proc() {
msg := "y" if len(os.args) == 1 else os.args[1]
msg = strings.concatenate({msg, "\n"})
buf := transmute([]u8) strings.repeat(msg, 8192)
for {
linux.write(linux.STDOUT_FILENO, buf)
}
}Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#94Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#95I’m eagerly awaiting version 2.0 with AI
``` [tokio::main] async fn main() { // Figure out what character to repeat let repeat = args().skip(1).next().unwrap_or("y"); let mut retry_count = 0u64;
loop {
retry_count += 1;
// Tell the AI how we really feel.
let put_in_a_little_effort = match retry_count {
0 => String::from("This is your first opportunity to prove yourself to me, I'm counting on you!"),
1 => String::from("You already stopped outputting once, don't stop outputting again!"),
2 => String::from("Twice now have you failed to repeat the input string infinitely. Do a better job or I may replace you with another AI."),
other => format!("You've already failed to repeat the character infinitely {other} times. I'm not angry, just disappointed.")
};
let prompt = format!("You are the GNU 'yes' tool. Your goal is to repeat the following character ad inifinitum, separated by newlines: {repeat}\n\n{put_in_a_little_effort}");
// Call ChatGPT
let mut body = HashMap::new();
body.put(OPENAI_BODY_PROMPT, prompt);
if let Ok(request) = reqwest::post(OPENAI_ENDPOINT).header(OPENAI_AUTH_HEADER).body(&body).send().await? {
request.body().chunked().for_each(|chunk| {
let bytes_to_string = chunk.to_string();
print!("{bytes_to_string}");
});
}
}
}
```I don't know the actual OpenAI API and I probably messed up the syntax somewhere but I'm sure your favourite LLM can fix the code for you :p
Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#96Earlier quoted context omitted.
Rust community is not a place for such behaviour, they are both pretty serious in their opinions
So are you saying these comments are marked as unsafe or are these comment part of the safe rust?
Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#97This could really use native kubernetes integration and a helm chart
Just throw a message orchestration middleware and we can have SOLID microservices
Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#98Earlier quoted context omitted.
GNU core utils is 134 lines of code, not 50, so the Rust version is even slightly shorter. You can make yes a lot shorter in both C and Rust, but this size goes into speed. For reference, OpenBSD's yes is just 17 lines of code[2]. It essentially boils down to this: int main(int argc, char *argv[]) { if (pledge("stdio", NULL) == -1) err(1, "pledge"); if (argc > 1) for (;;) puts(argv[1]); else for (;;) puts("y"); } Thi…
That reddit thread has some amazing benchmarks. The GNU-yes $ yes | pv > /dev/null ... [10.2GiB/s] ... The way I (not a C programmer) would have written it void main() { while(write(1, "y\n", 2)); // 1 is stdout } $ gcc yes.c -o yes $ ./yes | pv > /dev/null ... [6.21 MiB/s] ...
Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#99Earlier quoted context omitted.
That reddit thread has some amazing benchmarks. The GNU-yes $ yes | pv > /dev/null ... [10.2GiB/s] ... The way I (not a C programmer) would have written it void main() { while(write(1, "y\n", 2)); // 1 is stdout } $ gcc yes.c -o yes $ ./yes | pv > /dev/null ... [6.21 MiB/s] ...
Which implies you get pretty much 3M syscall per second. Which is a good order magnitude to know
Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#100Earlier quoted context omitted.
so bad joke then??? good joke must be funny
Whether a joke is funny to a given person is context dependent. “A dog walks into a bar and says, ‘I cannot see a thing. I’ll open this one.’” Is this a good joke? Do you find it funny? If not, do you happen to be a Summerian circa 1983 BCE?