• 4 Posts
  • 496 Comments
Joined 11 months ago
cake
Cake day: July 22nd, 2023

help-circle




  • I like how you know enough to know that you’re cool for using that lmao and not cool enough to realize that Google speech to text is available on your device just as readily via setting>system>language.

    But by all means don’t let me stop you from browbeating and gatekeeping, you’re doing so well already! It is afterall, the only plausible reason for your comment in context.



  • Input your post text into CoPilot and it returned::


    Sure, you can use the fs module in Node.js to read the directory and get the metadata of the files. Here’s a simple example in JavaScript:

    javascript
    const fs = require('fs');
    const path = require('path');
    
    // Get the directory name
    const dir = './your-directory';
    
    // Read the directory
    fs.readdir(dir, (err, files) => {
      if (err) {
        console.error("Could not list the directory.", err);
        process.exit(1);
      } 
    
      // files object contains all files names
      // log them on console
      files.forEach((file, index) => {
        fs.stat(path.join(dir, file), function(err, stat) {
          if (err) {
            console.error("Error stating file.", err);
            return;
          }
    
          if (stat.isFile())
            console.log("'%s' is a file.", file);
          else if (stat.isDirectory())
            console.log("'%s' is a directory.", file);
    
          console.log("created at %s", stat.birthtime);
        });
      });
    });
    

    This will give you the creation time of each file in the directory. You can then sort the files based on the creation time and slice the array as needed.

    Please note that this is a simple example and you might need to adjust it according to your needs. Also, keep in mind that this code will run asynchronously. If you need to run it synchronously, you can use the synchronous versions of these functions (readdirSync, statSync).

    In TypeScript, you would just need to add the appropriate types to your variables. The rest of the code would remain the same. For example, const dir: string = './your-directory'; and so on. Remember to install the Node.js types with npm install @types/node --save-dev if you haven’t already.

    I hope this helps! Let me know if you have any other questions. 😊


  • I haven’t tried Bard for this, as I’ve had such success via Bing chat, but since they are built on similar tech, I expect they give similar answers. Might be worth trying big chat just to see if it has a slightly different answer though.

    I know people talk shit about LLMs and talk down to folk like me that use them ad a modern day search engine… but I swear they are super fucking useful in this kind of research.









  • Good Lemmy content heheh jk sorry

    Helium, although the audience here feels more likely to know this than “random human X”.

    I’ll ask AI to parody “rocket Man” by Elton John, to help teach you, in case you don’t know about this.


    **Helium Man**
    
    She packed my balloons and my party hat
    I'm not the kind of guy who likes to celebrate
    Oh no, no, no, I'm a helium man
    Helium man, burning out his gas up here alone
    
    And I think it's gonna be a long, long time
    Till we find a new source of helium
    I'm not the man they think I am at home
    Oh no, no, no, I'm a helium man
    Helium man, burning out his gas up here alone
    
    Helium is not the kind of gas you can make
    It's a rare element that comes from deep within the Earth
    And it's used for many things, like rockets and MRI
    But we're running out of it, and that's a big problem
    
    And I think it's gonna be a long, long time
    Till we find a new source of helium
    I'm not the man they think I am at home
    Oh no, no, no, I'm a helium man
    Helium man, burning out his gas up here alone
    
    The US has the largest supply of helium
    But they're selling it off to the private market
    And Russia had a big facility, but it caught on fire
    And now the world is facing a helium shortage
    
    And I think it's gonna be a long, long time
    Till we find a new source of helium
    I'm not the man they think I am at home
    Oh no, no, no, I'm a helium man
    Helium man, burning out his gas up here alone
    
    And I think it's gonna be a long, long time
    Till we find a new source of helium
    I'm not the man they think I am at home
    Oh no, no, no, I'm a helium man
    Helium man, burning out his gas up here alone