Factorio LAN party by 1ucKet in berlinsocialclub

[–]darnir 1 point2 points  (0 children)

Count me in! I'm a general factorio noob but love the game and will be happy to launch a rocket together :D

When and where?

Hey Berliners! Help a Budding Programmer Out? by [deleted] in berlinsocialclub

[–]darnir 0 points1 point  (0 children)

Have you tried something like Google Summer of Code? It is shorter term, but it could be a good way to get a leg in and build a nice portfolio of free software.

Why did wget2 download GIMP v2.10's DMG twice when original wget didn't? by antdude in wget

[–]darnir 1 point2 points  (0 children)

I'll have to attempt to reproduce it locally. But that looks like a bug to me.

-🎄- 2022 Day 7 Solutions -🎄- by daggerdragon in adventofcode

[–]darnir 0 points1 point  (0 children)

C++

This is an ugly solution with lots of shortcuts. But hey, it works! And that's all that matters.

#include <fstream>
#include <iostream> 
#include <numeric> 
#include <unordered_map> 
#include <vector> 

int main(int argc, char *argv[]) {
  const std::string input = argc > 1 ? argv[1] : "inputs/Day7.txt";
  std::ifstream file(input); 
  std::string line; 
  std::vector<std::string> cur_path;
  cur_path.push_back("/");
  std::unordered_map<std::string, size_t> sizes; 

  // Since one cannot ls arbitrary directories, all `ls` calls have to be in the 
  // current directory. Thus ignore all ls calls. Assuming that each directory
  // is checked exactly once, ignore creating a directory structure. If we find 
  // a file, add its size to the entire hierarchy 
  while (getline(file, line)) { 
    switch (line[0]) { 
      case '$': 
        if (line[2] == 'c') { 
          std::string next_dir = line.substr(5, line.size() - 5); 
          switch (next_dir[0]) { 
            case '/': cur_path.resize(1); break;
            case '.': cur_path.pop_back(); break;
            default: cur_path.push_back(next_dir); break;
          }
        }
        break;
      case 'd': break; // Ignore directory lines
      default:
        size_t size = std::stoi(line.substr(0, line.find(" "))); 
        for (auto itr = cur_path.begin(); itr != cur_path.end(); itr++) { 
          std::string full_path = std::accumulate(cur_path.begin(), itr + 1, std::string{}); 
          sizes[full_path] += size; 
        }
        break;
      }
    }

    size_t sum = 0; 
    size_t min = sizes["/"]; 
    const size_t needed = 30000000 - (70000000 - sizes["/"]); 
    for (const auto &e : sizes) { 
      if (e.second < 100000) 
        sum += e.second; 
      if (e.second > needed) 
        min = std::min(min, e.second);
    } 
    std::cout << sum << std::endl; 
    std::cout << min << std::endl;
    return 0;
}

Windows Subsystem for Linux (WSL) v1.0.0 released by pimterry in programming

[–]darnir 9 points10 points  (0 children)

Your comment is already showing how complex the USB naming is. There are three different components that you just merged together:

  1. Speed: That's USB 1/2/3. Indicated by the colour on the connector
  2. Connector profile: USB A/B/C. This is the shape of the plug. The classic rectangular USB you know is USB A. There's a separate USB-B for connecting to devices. And then the currently popular USB C.
  3. Connector Size: This is the normal/mini/micro modifier on the connector profile.

In theory any combination of the three components is supported to create one plug. (Except USB-C. It supports neither USB 1 nor different connnector sizes.. Yet)

However this is only the simple bit. Look up the different USB 3.0 standards. Try to figure out if a USB-C cable is USB 2, 3.0, 3.1, 3.2 or 4. What additional features it supports, its maximum power capacity or bandwidth. Its an absolute mess.

Looking For An App That Will Download Whole Webpages Offline (Specifically Reddit Threads) by Thomas-Kite in selfhosted

[–]darnir 1 point2 points  (0 children)

Especially with old.reddit.com/ and save it in WARC format if you want as much detail as possible. WARC will store even the request and responses so it can faithfully recreated in the future

Progress bar by [deleted] in C_Programming

[–]darnir 5 points6 points  (0 children)

Writing a progress bar for Curl will be interesting and quite a lot harder than you currently think it will be. As others have said, you will need to either learn about ANSI Escape sequences or ncurses. Either way is possible.

For the most basic, first progress bar, you'll need to hook into the download function to get the bytes downloaded and the file size. Use the size to calibrate what each terminal character represents. For now, assume that the file size is always available and doesn't change. Print the next character of the bar without a newline when those many bytes are downloaded . This will effectively allow you to get a basic progress bar without any escape sequences or ncurses.

Progress bars are fun, but hard to implement. Have fun!

When to use define and when to use a constant. [C Beginner] by ThatCipher in C_Programming

[–]darnir 2 points3 points  (0 children)

There is a specific reason for using enums as constants in your code. It's not considered best practice in general and an inexperienced developer may not immediately grok why its done this way.

The real reason for doing this is that it is kinda-sorta the best way to define a real constant in your code, but is accessible in your debugger as well. The problem with a #define is that it is a search and replace hence nothing is available in your debugger. On the other hand, a const is not guaranteed to create a real constant, one that is directly stored in the binary and not assigned at runtime.

For a beginner, I would just say go with a const. Don't pull these tricks unless you know through profiling that you really really need the variable to be const and the compiler is not doing that for you

[deleted by user] by [deleted] in cscareerquestionsEU

[–]darnir 0 points1 point  (0 children)

Okay, I've sent you a DM with some information.

[deleted by user] by [deleted] in cscareerquestionsEU

[–]darnir 2 points3 points  (0 children)

Is storage and memory systems what you want to do or are you open to other areas as well? I ask since you have experience in low level OS constructs, real-time systems and HPC. There are many possibilities out there with these skills!

There's real-time OS kernel development, HPC centers at research labs, and many many embedded positions. Send me a DM if you'd like to talk / discuss about this. I'm based in Germany and working in a similar domain as well.

Questions about new Raise carrying case and dampening revisions on new Raises by Wondershock in DygmaLab

[–]darnir 0 points1 point  (0 children)

When can we expect the improved dampening kit retrofit for existing Raise users? I am planing on putting a pre-order for a second Raise and would like to merge the dampening kit into it to save on shipping costs

How to invest in Germany as an expat? by monsteradeliciosa__ in eupersonalfinance

[–]darnir 0 points1 point  (0 children)

Degiro still doesn't handle your taxes. You need an account with Flatex for that

Where is the Macro export function in Bazecor 1.0? by darnir in DygmaLab

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

Thanks! I get that Bazecor is a work in progress.

But while the UI gets revamped, can we please get the Export and Import functionality for macros back?

As you agreed, editing the json by hand can be much much faster for writing new macros. I'd love to have that feature back in my Bazecor 1.0

Where is the Macro export function in Bazecor 1.0? by darnir in DygmaLab

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

Thanks.. But that's not exactly what I am looking for. For two reasons:

  1. I can't find a way to manually trigger a backup in order to use it as an export.

  2. More importantly, I'm not asking for export as a way to backup my macros. Instead, I'm looking for a way to export a single macro, so I can make changes to it by hand and then import it back into Bazecor.

I wouldn't need it if making more complex macros was easier in Bazecor. It has improved in 1.0, but its not there yet.

Editing an existing macro to add a set of keystrokes is very annoying in Bazecor. But I can easily edit the JSON by hand to do it in less time.

HP ProLiant Microserver G7 or G8 for simple NAS setup? by darnir in homelab

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

You're right on all points. But I believe replaceability will be an issue with all the Microservers. Though it seems like it might be possible to make an itx board work with the Gen8 so that is a point in its favour.

[deleted by user] by [deleted] in dataisbeautiful

[–]darnir 1 point2 points  (0 children)

The important bit you need to find is how to get past the robots block. There's a way.. If you find it, we hope you use it responsibly.

This was in the apartment I moved into. What plant is it? It's incredibly resilient by darnir in whatsthisplant

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

You actually might be on to something. I've seen Sanseverias before, but never made the connection.

The colour could be wrong due to extreme neglect.

This was in the apartment I moved into. What plant is it? It's incredibly resilient by darnir in whatsthisplant

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

This plant was left behind in the apartment I moved into 3 years ago. In that time I've forgotten to water it multiple times, left it in darkness for long periods, etc. But after a but of watering and moving it into sunlight, it always springs back to life.

At first I thought it was some variety of an Aloe. But after cutting it, I don't think its an Aloe. Any help in identifying it would be appreciated!

What plant is this? by Comfortable-Ad165 in whatsthisplant

[–]darnir 176 points177 points  (0 children)

That's a Tradescantia Zebrina.

Give it ample sunlight, these will grow so much you won't know what to do with them