• Activity
  • Votes
  • Comments
  • New
  • All activity
    1. Is my kernel ready for CGroups V2?

      So I am reading the cgroups manpage because I want to learn about... cgroups. It tells me that for CGroups V1, if I want to use specific features, my kernel needs to be configured. Either I missed...

      So I am reading the cgroups manpage because I want to learn about... cgroups. It tells me that for CGroups V1, if I want to use specific features, my kernel needs to be configured. Either I missed a section or it isn't there, because I don't see much mention of kernel requirements for CGroups V2.

      So, my question is, is my kernel ready for CGroups, or should I recompile? Should I be able to support both V1 and V2? The manpage says V1 was a heap, so I was thinking I might continue without it... ... ...

      CONFIG_CGROUPS=y

      # CONFIG_BLK_CGROUP is not set

      CONFIG_CGROUP_SCHED=y

      # CONFIG_CGROUP_PIDS is not set

      # CONFIG_CGROUP_RDMA is not set

      CONFIG_CGROUP_FREEZER=y

      # CONFIG_CGROUP_HUGETLB is not set

      # CONFIG_CGROUP_DEVICE is not set

      CONFIG_CGROUP_CPUACCT=y

      # CONFIG_CGROUP_PERF is not set

      # CONFIG_CGROUP_DEBUG is not set

      # CONFIG_NET_CLS_CGROUP is not set

      # CONFIG_CGROUP_NET_PRIO is not set

      # CONFIG_CGROUP_NET_CLASSID is not set

      edit: wowie markdown fix

      4 votes
    2. How do I hack makefiles?

      If you have built from source, then you know the relief when nothing interesting comes out of ./configure && make && make install. In fact, the less interesting the output of these commands, the...

      If you have built from source, then you know the relief when nothing interesting comes out of ./configure && make && make install. In fact, the less interesting the output of these commands, the better.

      But occasionally, the source build process is so horrifying that you end up having to modify the configure script or makefile yourself.

      So far I have only been able to do this when I was lucky enough to find some poor, destitute stranger who had pretty much the same problem as me ( most recent I can think of is GNUTLS, where I had to adjust the version requirements for nettle ) and that is a problem -- there must be some way to learn this myself.

      Is this just something that comes with time and experience, or does anyone have a reliable guide or resource for modifying makefiles and configure scripts? I would appreciate advice / discussion: I am tired of "getting lucky" with these!

      15 votes
    3. Linux from Scratch is one of the best things I ever did.

      If you have never built one, you should -- it gives an in depth look at how different parts of linux interact with each other. Some of the methods used are outdated to be sure, but the first...

      If you have never built one, you should -- it gives an in depth look at how different parts of linux interact with each other. Some of the methods used are outdated to be sure, but the first system is meant to be minimal, and a good base on which to build. I am lately working on a 'BLFS', and I'm learning even more.

      Now, if I could just nail down networking ... ... ...

      Any LFS experiences?

      23 votes
    4. Best 120mm fans for a desktop?

      I was looking for preferences on 120/140mm case fans. RGB is a want, but not at the expense of quality fans. I'm pretty new to the topic and not super familiar with the technical side. So open to...

      I was looking for preferences on 120/140mm case fans. RGB is a want, but not at the expense of quality fans.

      I'm pretty new to the topic and not super familiar with the technical side. So open to reading more in depth too.

      Thanks!

      7 votes
    5. What does your desktop look like? What tools do you swear by?

      Between the recent discussions on the Useful Shell Scripts thread, and some of the tangents on the Desktop Usability thread, I thought it might be an interesting idea to have a desktop screenshot...

      Between the recent discussions on the Useful Shell Scripts thread, and some of the tangents on the Desktop Usability thread, I thought it might be an interesting idea to have a desktop screenshot sharing / unixporn thread where we talk about our setups, preferred applications, and share some pointers. This doesn't specifically have to be a Unix circlejerk though. If you have a Windows/Android/ChromeOS/TempleOS setup with some novel innovations, you're more than welcome to share too.

      34 votes
    6. Programming Challenge - It's raining!

      Hi everyone, it's been 12 days since last programming challenge. So here's another one. The task is to make an algorithm that'll count how long would it take to fill system of lakes with water....

      Hi everyone, it's been 12 days since last programming challenge. So here's another one. The task is to make an algorithm that'll count how long would it take to fill system of lakes with water.

      It's raining in the forest. The forest is full of lakes, which are close to each other. Every lake is below the previous one (so 1st lake is higher than 2nd lake, which is higher than 3rd lake). Lakes are empty at the beginning, and they're filling at rate of 1l/h. Once a lake is full, all water that'd normally fall into the lake will flow to the next lake.

      For example, you have lakes A, B, and C. Lake A can hold 1 l of water, lake B can hold 3 l of water and lake C can hold 5 l of water. How long would it take to fill all the lakes?
      After one hour, the lakes would be: A (1/1), B (1/3), C(1/5). After two hours, the lakes would be: A(1/1), B(3/3), C(2/5) (because this hour, B received 2l/h - 1l/h from the rain and 1l/h from lake A). After three hours, the lakes would be: A(1/1), B(3/3), C(5/5). So the answer is 3. Please note, that the answer can be any rational number. For example if lake C could hold only 4l instead of 5, the answer would be 2.66666....

      Hour 0:

      
      \            /
        ----(A)----
                             \                /
                              \              /
                               \            /
                                ----(B)----
                                                   \           /
                                                    \         /
                                                     \       /
                                                     |       |
                                                     |       |
                                                      --(C)--
      

      Hour 1:

      
      \============/
        ----(A)----
                             \                /
                              \              /
                               \============/
                                ----(B)----
                                                   \           /
                                                    \         /
                                                     \       /
                                                     |       |
                                                     |=======|
                                                      --(C)--
      

      Hour 2:

                  ==============
      \============/           |
        ----(A)----            |
                             \================/
                              \==============/
                               \============/
                                ----(B)----
                                                   \           /
                                                    \         /
                                                     \       /
                                                     |=======|
                                                     |=======|
                                                      --(C)--
      

      Hour 3:

                  ==============
      \============/           |
        ----(A)----            |             ========
                             \================/       |
                              \==============/        |
                               \============/         |
                                ----(B)----           |
                                                   \===========/
                                                    \=========/
                                                     \=======/
                                                     |=======|
                                                     |=======|
                                                      --(C)--
      

      Good luck everyone! Tell me if you need clarification or a hint. I already have a solution, but it sometimes doesn't work, so I'm really interested in seeing yours :-)

      21 votes
    7. Share your useful shell scripts!

      Disclaimer: Don't run scripts offered to you by randos unless you trust them or review it yourself I use this constantly, it just plays music by file name, specifically matching *NAME* with...

      Disclaimer: Don't run scripts offered to you by randos unless you trust them or review it yourself

      I use this constantly, it just plays music by file name, specifically matching *NAME* with case-insensitivity. Requires bash 4.something.

      # play -ln SONGS ...
      # -l don't shuffle
      # -n dry run
      mpv_args="--no-audio-display --no-resume-playback \
                --msg-level=all=status --term-osd-bar"
      shopt -s globstar nullglob nocaseglob
      
      shuffle=true
      dry=false
      while [[ "$1" == -* ]]; do
          if [[ "$1" == "-l" ]]; then 
              shuffle=false
          elif [[ "$1" == "-n" ]]; then
              dry=true
          fi
      
          shift 1
      done
      
      if [[ "$shuffle" == true ]]; then
          mpv_args="--shuffle $mpv_args"
      fi
      
      songs=()
      while [[ "$#" != 0 ]]; do
          songs+=( ~/music/**/**/*"$1"*.* ) # change this to match your music directory layout
          shift 1                                               # could probably use find instead
      done
      
      if [[ "$dry" == true ]]; then
          if [[ "$shuffle" == true ]]; then
              printf "Shuffle mode is on\n"
          fi
      
          for song in "${songs[@]}"; do
              printf "$song\n"
          done
        
          exit
      fi
      
      if [[ ${#songs[@]} != 0 ]]; then
          mpv $mpv_args "${songs[@]}"
      fi
      

      I make no claims to the quality of this but it works!

      36 votes
    8. Where would a beginner start with data compression? What are some good books for it?

      Mostly the title. I have experience with Python, and I was thinking of learning more about data compression. How should I proceed? And what are some good books I could read, both about specifics...

      Mostly the title. I have experience with Python, and I was thinking of learning more about data compression. How should I proceed? And what are some good books I could read, both about specifics and abstracts of data compression, data management, data in general.

      15 votes
    9. An Alternative Approach to Configuration Management

      Preface Different projects have different use cases that can ultimately result in common solutions not suiting your particular needs. Today I'm going to diverging a bit from my more abstract,...

      Preface

      Different projects have different use cases that can ultimately result in common solutions not suiting your particular needs. Today I'm going to diverging a bit from my more abstract, generalized topics on code quality and instead focus on a specific project structure example that I encountered.


      Background

      For a while now, I've found myself being continually frustrated with the state of my project configuration management. I had a single configuration file that would contain all of the configuration options for the various tools I've been using--database, API credentials, etc.--and I kept running into the problem of wanting to test these tools locally while not inadvertently committing and pushing sensitive credentials upstream. For me, part of my security process is ensuring that sensitive access credentials never make it into the repository and to limit access to these credentials to only people who need to be able to access them.


      Monolithic Files Cause Monolithic Pain

      The first thing I realized was that having a single monolithic configuration file was just terrible practice. There are going to be common configuration options that I want to have in there with default values, such as local database configuration pointing to a database instance running on the same VM as the application. These should always be in the repo, otherwise any dev who spins up an instance of the VM will need to manually tread documentation and copy-paste the missing options into the configuration. This would be incredibly time-consuming, inefficient, and stupid.

      I also use different tools which have different configuration options associated with them. Having to dig through a single file containing configuration options for all of these tools to find the ones I need to modify is cumbersome at best. On top of that, having those common configuration options living in the same place that sensitive access credentials do is just asking for a rogue git commit -A to violate the aforementioned security protocol.


      Same Problem, Different Structure

      My first approach to resolving this problem was breaking the configuration out into separate files, one for each distinct tool. In each file, a "skeleton" config was generated, i.e. each option was given a default empty value. The main config would then only contain config options that are common and shared across the application. To avoid having the sensitive credentials leaked, I then created rules in the .gitignore to exclude these files.

      This is where I ran into problem #2. I learned that this just doesn't work. You can either have a file in your repo and have all changes to that file tracked, have the file in your repo and make a local-only change to prevent changes from being tracked, or leave the file out of the repo completely. In my use case, I wanted to be able to leave the file in the repo, treat it as ignored by everyone, and only commit changes to that file when there was a new configuration option I wanted added to it. Git doesn't support this use case whatsoever.

      This problem turned out to be really common, but the solution suggested is to have two separate versions of your configuration--one for dev, and one for production--and to have a flag to switch between the two. Given the breaking up of my configuration, I would then need twice as many files to do this, and given my security practices, this would violate the no-upstream rule for sensitive credentials. Worse still, if I had several different kinds of environments with different configuration--local dev, staging, beta, production--then for m such environments and n configuration files, I would need to maintain n*m separate files for configuration alone. Finally, I would need to remember to include a prefix or postfix to each file name any time I needed to retrieve values from a new config file, which is itself an error-prone requirement. Overall, there would be a substantial increase in technical debt. In other words, this approach would not only not help, it would make matters worse!


      Borrowing From Linux

      After a lot of thought, an idea occurred to me: within Linux systems, there's an /etc/skel/ directory that contains common files that are copied into a new user's home directory when that user is created, e.g. .bashrc and .profile. You can make changes to these files and have them propagate to new users, or you can modify your own personal copy and leave all other new users unaffected. This sounds exactly like the kind of behavior I want to emulate!

      Following their example, I took my $APPHOME/config/ directory and placed a skel/ subdirectory inside, which then contained all of the config files with the empty default values within. My .gitignore then looked something like this:

      $APPHOME/config/*
      !$APPHOME/config/main.php
      !$APPHOME/config/skel/
      !$APPHOME/config/skel/*
      # This last one might not be necessary, but I don't care enough to test it without.
      

      Finally, on deploying my local environment, I simply include a snippet in my script that enters the new skel/ directory and copies any files inside into config/, as long as it doesn't already exist:

      cd $APPHOME/config/skel/
      for filename in *; do
          if [ ! -f "$APPHOME/config/$filename" ]; then
              cp "$filename" "$APPHOME/config/$filename"
          fi
      done
      

      (Note: production environments have a slightly different deployment procedure, as local copies of these config files are saved within a shared directory for all releases to point to via symlink.)

      All of these changes ensure that only config/main.php and the files contained within config/skel/ are whitelisted, while all others are ignored, i.e. our local copies that get stored within config/ won't be inadvertently committed and pushed upstream!


      Final Thoughts

      Common solutions to problems are typically common for a good reason. They're tested, proven, and predictable. But sometimes you find yourself running into cases where the common, well-accepted solution to the problem doesn't work for you. Standards exist to solve a certain class of problems, and sometimes your problem is just different enough for it to matter and for those standards to not apply. Standards are created to address most cases, but edge cases will always exist. In other words, standards are guidelines, not concrete rules.

      Sometimes you need to stop thinking about the problem in terms of the standard approach to solving it, and instead break it down into its most abstract, basic form and look for parallels in other solved problems for inspiration. Odds are the problem you're trying to solve isn't as novel as you think it is, and that someone has probably already solved a similar problem before. Parallels, in my experience, are usually a pretty good indicator that you're on the right track.

      More importantly, there's a delicate line to tread between needing to use a different approach to solving an edge case problem you have, and needing to restructure your project to eliminate the edge case and allow the standard solution to work. Being able to decide which is more appropriate can have long-lasting repercussions on your ability to manage technical debt.

      16 votes
    10. As someone with ADHD, I hate the "RTFM" motto

      I'm a student of software engineering. I'm not a programmer yet, but I use software that is common among this crowd, like i3wm, Neovim and Emacs. I know how to find and read documentation. I've...

      I'm a student of software engineering. I'm not a programmer yet, but I use software that is common among this crowd, like i3wm, Neovim and Emacs. I know how to find and read documentation. I've read the obnoxious How To Ask Questions the Smart Way. Every time I encounter an issue, I do my diligence. I go through the manuals, I google, I read the docs. My main editor, Emacs, has an extensive manual, with plenty of accurate details. I get that's a huge program (more like a platform, really), but let's just say that a black-and-white 650 pages PDF is not the most ADHD friendly thing in the world.

      I'm aware that I chose a career that requires plenty of reading, but I happen to like it a lot and it seems like I have some aptitude for it. I had similar issues in my previous activities anyway. But it's discouraging trying to understand programming and complex software, only to be repelled by people who think everyone has their ability for concentration. Sometimes I completely lose track of time. I can sit on my computer and hyperfocus for up to 48 hours with 20 Chrome tabs open non-stop and Netflix on the background. I may seem productive, but I'm not reading anything. Maybe I read one paragraph or two, and 30 seconds later I can't remember what I was doing. But I still have tasks to accomplish, and sometimes I need help to find useful information on a 700 pages manual.

      Luckily I have a great support and determination and have accomplished a lot, but my peers have no idea what I went through to get to where I am. What I don't have in natural born skills I compensate with a lot of raw effort. Everyone has their difficulties and I'm not seeking compassion, but I'd like to suggest people think twice before dismissing as "lazy" someone you know nothing about. That person might have a mental disorder, a reading disorder or even an intellectual disability. Do you wanna be the guy who told a dyslexic to just read the fucking manual?

      EDIT: of course I get that time and energy are limited commodities... my point is: don't be an asshole about it. Do what you can and you wanna do, but there's no need to use hostile buzzwords when you communicate with less knowledgeable people. You're not even forced to answer... I much prefer not getting an answer than getting a hostile one.

      26 votes
    11. Help! I'm indecisive and I want a keyboard.

      I know there are at least fifteen threads on ~comp alone about mechanical keyboards, but, this one is mine. I recently had a run in with tendinitis, which taught me the importance of ergonomics,...

      I know there are at least fifteen threads on ~comp alone about mechanical keyboards, but, this one is mine.

      I recently had a run in with tendinitis, which taught me the importance of ergonomics, but I still wanted the clickety clack of a mechanical keyboard, so I decided to consider buying an ergonomic mechanical keyboard.

      The first one that I looked at was the ErgoDox EZ (it was the first one I saw). It had a split layout, open source firmware, and a positive review from Linus Tech Tips.

      The second one was the Ultimate Hacking Keyboard (I saw the Hacker News thread). I was interested in it for the Trackball Module.

      These two keyboards are different enough from each other, so it's hard to compare them.

      In conclusion, why should I choose one over the other?

      14 votes
    12. Ask Tilde: How would you improve the ErgoDox

      The ErgoDox has been out for a few years now and spawned many, many new designs based off it. My question is how would you improve it? I've been trying to answer this question for a few weeks now...

      The ErgoDox has been out for a few years now and spawned many, many new designs based off it. My question is how would you improve it? I've been trying to answer this question for a few weeks now and would like to know what the community thinks. What is important in a keyboard for you?

      I've thrown my hat into the ring with Gergo which I think comes close. It uses SMD components, reducing the overall size and cost of the board, Removes the ProMicro for a TQFP Atmega32u4, moves the paddles in a tiny bit and removes the extra keys from the thumb cluster. It's meant to be used without a case (using rubbered standoffs to keep it off the desk/surface) and the back has some pretty designs. The hardest part for me to justify was loping off the number row, but seeing as many layouts use a modifier and the right hand pad as a ortho numpad I went with it. Worst case the default layout will have paddle + top row give numbers. In addition, for occasional mouse users, I designed a trackball that fits inside of a 1u key and can be mounted on the right hand side of the board (or a regular key if wanted). The idea being for small movements you have something other then QMKs mouse keys to work with. I've gone into a bit more detail on my blog on the design considerations

      The main thing I tried to optimize with Gergo was cost. Ergo keyboards need not be expensive and I think the price point on this board drives it home. With a cheap set of caps off Amazon and some Cherry clones, this board can be put together for under 100$ shipping included. Compared to a ErgoDox EZ with a starting price of 250$ before keys or shipping, I think I've done a decent job.

      As keyboards are highly personal devices, what do you look for in a keyboard?

      5 votes
    13. Meta Discussion: Is there interest in topics concerning code quality?

      I've posted a few lengthy topics here outside of programming challenges, and I've noticed that the ones that seem to have spurred the most interest and generated some discussion were ones that...

      I've posted a few lengthy topics here outside of programming challenges, and I've noticed that the ones that seem to have spurred the most interest and generated some discussion were ones that were directly related to code quality. To avoid falling for confirmation bias, though, I thought I would ask directly.

      Is there generally a greater interest in code quality discussions? If so, then what kind of things are you interested in seeing in those discussions? What do you prefer not to see? If not, then what kinds of programming-related discussions would you prefer to see more of? What about non-programming discussions?

      Also, is there any interest in an informal series of topics much like the programming challenges or the a layperson's introduction to... series (i.e. decentralized and available for anyone to participate whenever)? Personally, I'd be interested in seeing more on the subject from others!

      17 votes