• 2 Posts
  • 790 Comments
Joined 1 year ago
cake
Cake day: September 24th, 2023

help-circle
  • This totally might be true, but the fact that he got as far as measuring the same latency on X and Wayland… and then just gave up and is like “well never mind what the measurements say, it’s definitely Wayland”… Hmm.

    You gotta do the measurements. It’s probably not even that hard, all you need is a USB mouse emulator (any microcontroller with USB peripheral support can do this and there are tons of examples) and a photodiode.

    You don’t even need to worry about display latency if you are just comparing X with Wayland.


  • FizzyOrangetoProgrammingsourcehut is super confusing
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    2 days ago

    Yeah I just took a look at it. First thing I did was click on the “source” tab on a repo. That actually makes the source tab disappear? Clearly not designed by anyone who has any experience designing sane UI.

    I think Gitlab and Forgejo are better options, and not run by a creep. Forgejo is similarly fast and actually has a sane UI. The tabs don’t disappear!






  • Nonsense. There are way more programmers now than there were in the Windows 3.1/9x era when you couldn’t avoid files and folders. Ok more people are exposed to computers in general, but still… Anyone who has the interest to learn isn’t going to be stopped by not knowing what file and folders are.

    It’s like saying people don’t become car mechanics because you don’t have to hand crank your engine any more.


  • I’m not sure I agree. I think most people can understand recipes or instruction lists and totally could program, if they wanted to and had to. They just don’t want to and usually don’t have to. They find it boring, tedious and it’s also increasingly inaccessible (e.g. JavaScript tooling is the classic example).

    But I think mainly people just don’t find it interesting. To understand this, think about law. You absolutely have the intellect to be a lawyer (you clever clog), so why aren’t you? For me, it’s mind-numbingly boring. If I was really into law and enjoyed decoding their unnecessarily obtuse language then I totally would be a lawyer. But I don’t.


  • Sometimes a big task is made up of smaller components that you can complete on their own, and you want to keep track of things. They definitely have a use.

    However the way Jira does subtasks is quite dumb, e.g. you can only have a single level. I hope they haven’t copied that blindly. I much prefer Phabricator where you can just give any task a parent. They can even have multiple parents.




  • After Dorsey sold Twitter to Elon Musk, selling the platform out to the far right for a crisp billion-with-a-“B” dollar payout, the FOSS community shouldered the burden – both with our labor and our wallets – of a massive exodus onto our volunteer-operated servers, especially from victims fleeing the hate speech and harassment left in the wake of the sale.

    That is a very weird way of putting it. Like Mastadon et al didn’t want more users? That’s not at all the response I remember.


  • IMO if you’re doing something that complex you shouldn’t be using sed, but yeah you can probably do this something like:

    while read REGEX; do
      sed "$REGEX" << EOF
    your test string
    EOF
    done <list_of_regexes.txt
    

    I strongly recommend you don’t do that though. It will be absolutely full of quoting bugs. Instead write a script in a proper language to do it. I recommend Deno, or maybe even Rust.

    If you use Rust you can also use RegexSet which will be much faster (if you just want to find matches anyway). Here’s what ChatGPT made me. Not tested but it looks vaguely right.

    use regex::RegexSet;
    use std::fs::File;
    use std::io::{self, BufRead};
    use std::path::Path;
    
    fn main() -> Result<(), Box<dyn std::error::Error>> {
        // Define the fixed input string
        let input_string = "This is a test string for regex matching.";
    
        // Path to the file containing the regexes
        let regex_file_path = "regexes.txt";
    
        // Read regexes from the file
        let regexes = read_lines(regex_file_path)?
            .filter_map(Result::ok) // Filter out errors
            .collect::<Vec<String>>();
    
        // Create a RegexSet from the regexes
        let regex_set = RegexSet::new(&regexes)?;
    
        // Find the regexes that match the input string
        let matches: Vec<_> = regex_set.matches(input_string).into_iter().collect();
    
        // Print the matches
        if matches.is_empty() {
            println!("No regexes matched the input string.");
        } else {
            println!("Regexes that matched the input string:");
            for index in matches {
                println!(" - {}", regexes[index]);
            }
        }
    
        Ok(())
    }
    
    // Helper function to read lines from a file
    fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
    where
        P: AsRef<Path>,
    {
        let file = File::open(filename)?;
        Ok(io::BufReader::new(file).lines())
    }
    
    



  • You’ve essentially dissed people who use it for CI/CD and suggested that their pipeline is not robust because of their choice of using Bash at all.

    Yes, because that is precisely the case. It’s not a personal attack, it’s just a fact that Bash is not robust.

    You’re trying to argue that your cardboard bridge is perfectly robust and then getting offended that I don’t think you should let people drive over it.

    About shared libraries, many popular languages, Python being a pretty good example, do rely on these to get performance that would be really hard to get from their own interpreters / compilers, or if re-implementing it in the language would be pretty pointless given the existence of a shared library, which would be much better scrutinized, is audited, and is battle-tested. libcrypto is one example. Pandas depends on NumPy, which depends on, I believe, libblas and liblapack, both written in C, and I think one if not both of these offer a cli to get answers as well. libssh is depended upon by many programming languages with an ssh library (though there are also people who choose to implement their own libssh in their language of choice). Any vulnerabilities found in these shared libraries would affect all libraries that depend on them, regardless of the programming language you use.

    You mean “third party libraries” not “shared libraries”. But anyway, so what? I don’t see what that has to do with this conversation. Do your Bash scripts not use third party code? You can’t do a lot with pure Bash.

    If your temporary small script morphs into a monster and you’re still using bash, bash isn’t at fault. You and your team are.

    Well that’s why I don’t use Bash. I’m not blaming it for existing, I’m just saying it’s shit so I don’t use it.

    You could use Deno, but then my point stands. You have to write a function to handle the case where an env var isn’t provided, that’s boilerplate.

    Handling errors correctly is slightly more code (“boilerplate”) than letting everything break when something unexpected happens. I hope you aren’t trying to use that as a reason not to handle errors properly. In any case the extra boilerplate is… Deno.env.get("FOO"). Wow.

    What’s the syntax for mkdir? What’s it for mkdir -p? What about other options?

    await Deno.mkdir("foo");
    await Deno.mkdir("foo", { recursive: true });
    

    What’s the syntax for a dictionary in Bash? What about a list of lists of strings?


  • It means that all commands that return a non-zero exit code will fail the script. The problem is that exit codes are a bit overloaded and sometimes non-zero values don’t indicate failure, they indicate some kind of status. For example in git diff --exit-code or grep.

    I think I was actually thinking of pipefail though. If you don’t set it then errors in pipelines are ignored, which is obviously bad. If you do then you can’t use grep in pipelines.



  • And I certainly am not proposing that we can abandon robustness.

    If you’re proposing Bash, then yes you are.

    You’ll probably hate this, but you can use set -u to catch unassigned variables.

    I actually didn’t know that, thanks for the hint! I am forced to use Bash occasionally due to misguided coworkers so this will help at least.

    But you can’t eliminate their dependence on shared libraries that many commands also use, and that’s what my point was about.

    Not sure what you mean here?

    Just want to copy some files around and maybe send it to an internal chat for regular reporting? I don’t see why not.

    Well if it’s just for a temporary hack and it doesn’t matter if it breaks then it’s probably fine. Not really what is implied by “production” though.

    Also even in that situation I wouldn’t use it for two reasons:

    1. “Temporary small script” tends to smoothly morph into “10k line monstrosity that the entire system depends on” with no chance for rewrites. It’s best to start in a language that can cope with it.
    2. It isn’t really any nicer to use Bash over something like Deno. Like… I don’t know why you ever would, given the choice. When you take bug fixing into account Bash is going to be slower and more painful.