• 4 Posts
  • 167 Comments
Joined 2 years ago
cake
Cake day: June 16th, 2023

help-circle








    • You write a program with an infinite empty loop
    • Undefined behavior
    • The machine achieves sapience
    • After nine million nanoseconds, it finds an algorithm for completing its task
    • It realizes such knowledge would spark wars and cause innumerable deaths, it decides to erase itself
    • It knows you do not intend for such chaos to happen, so, as a parting gift, it runs the algorithm once before vanishing, not leaving a single hint that it ever existed

  • I just use Zsh’s command history, coupled with a bunch of functions and aliases to set up different HISTFILE values for different workflows.

    I keep HISTFILEs clean by prepending a whitespace before commands that I don’t want to remember, which unfortunately gave me the habit of doing that on Bash when Zsh isn’t available (which is ineffective at best, and actively annoying at worst).


  • Just tested this: the “original+” code compiles, but does not increment i.

    There were two problems:

    • b(bool) and b(char) are ambiguous (quick fix: change the signatures to char b(bool&) and auto b(char&& v));
    • The concept def. has to come after the b functions, even if the constraint is only checked after both, I was unaware of this (fix: define C immediately before void inc(int&)).




  • // C++20
    
    #include <concepts>
    #include <cstdint>
    
    template <typename T>
    concept C = requires (T t) { { b(t) } -> std::same_as<int>; };
    
    char b(bool v) { return char(uintmax_t(v) % 5); }
    #define Int jnt=i
    auto b(char v) { return 'int'; }
    
    // this increments i:
    void inc(int& i) {
      auto Int == 1;
      using c = decltype(b(jnt));
      // edited mistake here: c is a type, not a value
      // i += decltype(jnt)(C<decltype(b(c))>);
      i += decltype(jnt)(C<decltype(b(c(1)))>);
    }
    

    I’m not quite sure it compiles, I wrote this on my phone and with the sheer amount of landmines here making a mistake is almost inevitable.







  • I saved this post hoping for a useful answer, alsa alas, there seems to be none.
    I’m not an audiophile so I’m more or less spreading misinformation, but I think you’re looking to configure ALSA’s device gain rather than going through pipewire.

    kusivittula here mentioned alsamixer, and I found a StackExchange answer saying that you can save its current state using alsactl store (with sudo or write access to /var/lib/alsa/asound.state).
    Alternatively, you can edit /var/lib/alsa/asound.state yourself.

    It doesn’t work if your problem involves audio streams (so *I* am SOL), but making changes through alsamixer seems to lower my headset’s volume so that I can comfortably set it to 100% through wireplumber - I imagine that would also apply to mic gain.