• 5 Posts
  • 38 Comments
Joined 2 years ago
cake
Cake day: July 23rd, 2023

help-circle
  • poettering is an absolute good guy here

    Agreed. But he’s also an abrasive know-it-all. A modicum of social skills and respect goes a long way towards making others accept your pet projects.

    pulesaudio protocol is used within pipewire and it works just fine.

    I wasn’t talking about the protocol, I was talking about the implementation: PulseAudio is a crashy, unstable POS. I can’t count the number of hours this turd made me waste, until PipeWire came along.


  • I totally agree. I used to hate systemd for breaking the traditional Unix philosophy, but the reality is that a tight init and service-tracking integration tool really was required. I work with and appreciate systemd every day now. It certainly didn’t make things simplier and easier to debug, but it goes a long way towards making a Linux system predictable and consistent.

    Poettering can go fuck himself though - and for PulseAudio too. I suspect half of the hate systemd attracted over the years was really because of this idiot.



  • I fail to see Discord as anything other than IRC with too many emojis and primary colors for the short of attention span, implemented as a humongous pile of Web 2.0 nonsense, with Big Data surveillance built in.

    Privacy and resource comsumption issues notwithstanding, the few times I’ve had to use it to connect with people in certain communities that could basically only be found on Discord, it was unbearable to this gen-Xer: it’s just as fast and as shallow as IRC, but somehow I feel the extra symbolic and color overload would have triggered a seizure if I was epileptic. It’s maddering.

    Oh well, maybe I’m old.








  • But what is an example of where I can use it?

    Aside from operations on bitfields, a bitwise operator can be useful in several “non bits” cases. For instance:

    value & 1 evaluates to 1 if value is odd (and will evaluate to True in an if statement)
    value >> 1 divides value by 2 (integer division)

    But usually bitwise operators are for when you want to manipulate bits in values. For instance:

    value | 5 returns value with bits 1 and 3 set to True
    value & 0xffff returns the 16 least-significant bits in value (usually you do this to make sure it will fit in 2 bytes in memory for example)
    value & (0xffff ^ 5) returns the lower 16 bits of value with bits 1 and 3 set to False

    Etc.


  • Much to unpack here…

    coin == 25 | 10 | 5

    …will evaluate as True if coin is equal to the bitwise OR of 25, 10 and 5 - i.e. 31. In other word, it’s equivalent to coin == 31. That’s because the bitwise OR has precedence over the == operator. See operator precedence in Python.

    If I replace the ‘|’ with ‘or’ the code runs just fine.

    It probably doesn’t. If you replace | with or, you have the statement coin == 25 or 10 or 5 which is always True in the if statement because it’s evaluated as (coin == 25) or (not 0) or (not 0) in an if statement.

    coin == 25 | coin == 10 | coin == 5

    …will evaluate as coin == (25 | coin) == (10 | coin) == 5. Again, operator precedence.

    What you want to do is this:

    if coin in [25, 10, 5]:

    or

    if coin in (25, 10, 5):

    or simply

    if coin == 25 or coin == 10 or coin == 5:

    Don’t create problems and confusion for the next guy who reads your code for nothing. Simple and readable are your friends 🙂










  • I use Terminator. It’s nothing fancy but it works fine.

    If I work locally, I usually stick several Terminator windows side-by-side and up-and-down in i3 tiles and that’s good enough.

    If I work remotely through SSH though - which is 75% of what I do in a terminal, I’ll run tmux so I can have several shells in one terminal of course, but mostly so that I don’t lose what I’m doing if the internet goes down.