hello

  • 1 Post
  • 137 Comments
Joined 1Y ago
cake
Cake day: Jul 01, 2023

help-circle
rss





just for simple tasks, where i need something between the simplicity of bash and the type safety of rust. its just my personal preference when it comes to scripting, although i do believe it should be the first consideration for choosing a user friendly but powerful embedded or config language, like for neovim, especially if performance is a concern, but it will ofc not always be the best option. the 1 index is certainly annoying though, but i would personally rather that than anything to do with python, especially whitespace. the if...then and for...do is the same as bash, so i dont think its that bad


i would say lua if possible, but python has more libraries


i love how well this joke works


:) no problem! i would assume resizing the image might be a little slower, because it creates a clone of the image, but if you use FilterType::NearestNeighbor, the speed is negligable in my opinion


i read through the code, and i have some tips, which you may find helpful (or not):

  • argument parsing: if --color is not the first argument, it will try to open a file named --color, which i assume is unintended. i would suggest checking out the clap crate to easily parse args
  • i’m quite sure why you used ‘clusters’ instead of resizing the image to the terminal width? if it is purely as a programming exercise, or for performance reasons, then that’s great! but otherwise, calling image.resize() is easier
  • .len() on a string returns length in bytes, not characters, so could break with non-ascii text. in the context of this program, the text will always be ascii, so it is of course not a problem, but it’s worth to keep in mind. to get character length, use .chars().count()
  • in my testing, the width of the image is always affected by the width of the terminal, always being less than the maximum possible width, causing the image to be stretched vertically. i’m not sure why this is happening
  • in get_brightness_of_cluster, pushing to a Vec and then calling .sum() can be replaced with a loop which increments a mutable u32 variable. this is a nitpick, but it can avoid unnecessary memory allocation

check out this example. sorry if this comes off as rude or a nitpick, i’m just trying to provide some advice :)



just have a tub of water rigged above the server


why would you be against 4th of July and children?


haskell is an intricately designed laser gun that you cant shoot it without a learning group theory and lambda calculus


however, it is still used and endorsed by every army



if your desktop environment uses alt+f4 to quit 💀


should have used Rust instead. that way you never talk to a friend in the first place


this is a common misconception, although the may ramble a bit, they are very classy


i think its just a bad analogy for how a normal function returns to where it was called


if (new Date().getDay() % 2) {
    runCode();
}


i agree, tho keep in mind that while your average cop may have the computer literacy of a 5yo, many federal agencies are quite compentent with technology. not that i believe the feds are going to hack your computer for piracy (other reasons perhaps)





i agree. haskell is worth learning because its cool, and the skills/concepts are transferrable, not because the language is in demand


the loop or match statement could possibly be extracted to another function, depending on the situation. rustc will most likely inline it so its zero cost


i agree. python only be used if absolutely necessary, such as machine learning and what not. and only because of its popularity and libraries. scripting? try bash or lua. making a cli/tui? try rust or c or something. web backend? god have mercy if you decide to use python for that.





this is why i cp the workspace before running any git command




i agree, but the website is annoying to use imo


same but then i get sent to captcha hell


indexes in memory can be thought of as the address of the leftmost bit in a byte (container)