• 0 Posts
  • 30 Comments
Joined 1 year ago
cake
Cake day: August 23rd, 2023

help-circle

  • sudo@programming.devtoProgramming@programming.devWhy is my tmux borked?
    link
    fedilink
    arrow-up
    5
    arrow-down
    2
    ·
    edit-2
    2 months ago

    Unironically try turning your computer off and on again.

    Tmux settings are global and persistent. Just deleting your config files is insufficient. You have to kill the server and restart it. Uninstalling and reinstalling will not kill a running tmux server. tmux kill-server should work too.

    Now if it persists across reboots, then there must be a file still lingering somewhere. If you are sure your home directory is clean you can try searching whatever you installed in /etc.

    This is all assuming you’re trying to go back to a clean slate and failing. If the borked status bar is the result of your current .tmux.conf, then you’ll have to post that.


  • I spent like a week on this last month. Usually you use enumeration, but I wanted to allow client code to define their own strategies. I tried the Box<dyn MyTrait> pattern because some of my strategies were composed of other strategies, and I wanted to clamp down on generic types. But I kept running into weirder and weirder compiler errors. Always asking for an additional restriction on the base trait. X, must be Copy, must be Send, must be Sized, must be 'static. On and on. My experience is if I’m getting a bunch of those then I’m off the Golden Path. So I just embraced the verbosity of using generics and its easy. Yes its more code but its better code.








  • I’m very suspicious of the uses cases for this. If the compiled bash code is unreadable then what’s the point of compiling to bash instead of machine code like normal? It might be nice if you’re using it as your daily shell but if someone sent me “compiled” bash code I wouldn’t touch it. My general philosophy is if your bash script gets too long, move it to python.

    The only example I can think of is for generating massive install.sh



  • Very standard use case for a fold or reduce function with an immutable Map as the accumulator

    val ints = List(1, 2, 2, 3, 3, 3)
    val sum = ints.foldLeft(0)(_ + _) // 14
    val counts = ints.foldLeft(Map.empty[Int, Int])((c, x) => {
      c.updated(x , c.getOrElse(x, 0) + 1)
    })
    

    foldLeft is a classic higher order function. Every functional programming language will have this plus multiple variants of it in their standard library. Newer non-functional programing languages will have it too. Writing implementations of foldLeft and foldRight is standard for learning recursive functions.

    The lambda is applied to the initial value (0 or Map.empty[Int, Int]) and the first item in the list. The return type of the lambda must be the same type as the initial value. It then repeats the processes on the second value in the list, but using the previous result, and so on until theres no more items.

    In the example above, c will change like you’d expect a mutable solution would but its a new Map each time. This might sound inefficient but its not really. Because each Map is immutable it can be optimized to share memory of the past Maps it was constructed from. Thats something you absolutely cannot do if your structures are mutable.







  • Did you somehow miss the video Ansar Allah released of seizing the glalxy leader? Did you miss the big Palestinian flag on the back of the helicopter? Did you miss the Yemeni operator announcing why they are seizing the ship?

    Like what are you trying to suggest Ansar Allah’s alternative motives are? Simple piracy? They’ve only captured one ship and are mostly scaring others off. Seems like bad tactics for piracy but good blockade tactics.

    Galaxy Leader is owned by a company co-owned by an Israeli. They said any connection to Israel will get you attacked. I’m sure theres more tenous connections. But I also dont really care. They can shut down the Red Sea entirely for all I care. Getting all nitpicky on how someone is trying to stop a genocide is in service of the genocide. If you dont like what Ansar Allah is doing you can call your rep and tell them to stop sponsoring genocide. Have some fucking priorities.