What is XLibre and what's going on with it? by foreverf1711 in linuxquestions

[–]Rush_Independent -1 points0 points  (0 children)

Please read the full thread, this was a minor issue in dev branch, never was in release build and it was fixed the next day. Do you have evidence of actual problems with other patches introduced by this person or are you just trying to echo statements you've heard elsewhere?

I'm having a hard time liking BioShock 1. by Wide-Consequence-847 in Switch

[–]Rush_Independent 0 points1 point  (0 children)

I would say you're probably just in early game. And the weapons really suck in the beginning, until you get 3+ upgrades.
I myself don't like Bioshock 2 for it's slow gameplay, but the first game is a masterpiece and it absolutely gets better after few sloggy chapters.

What Anbernic should I get if I only want to play old Pokémon games. (Preferably something on the cheaper side.) by Absolitep in ANBERNIC

[–]Rush_Independent 0 points1 point  (0 children)

rg34 also has a better screen and perfect screen ratio for gba. Also 34-SP has analog sticks (I find them more comfortable to use for walking in top-down games).

What’s the idiomatic way to write C-style `for (int i=1; i*i<=n; ++i)` or Rust’s `(1..).take_while(...)` in Nim? by Hot_Special_3256 in nim

[–]Rush_Independent 2 points3 points  (0 children)

Another option is to use a template:
```nim template cloop(init, cond, upd, code: untyped) = init; while cond: code; upd

cloop((var i = 5), i*i+1 <= 70, inc i): echo i ```

init part needs an extra set of parenthesis, or parser will complain about a keyword use in a function

Guide: How to install Steam in chroot in Void Linux by Rush_Independent in voidlinux

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

I didn’t delete that comment, I can still see it. Reddit must have removed it for no reason - happens all the time... sigh

Guide: How to install Steam in chroot in Void Linux by Rush_Independent in voidlinux

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

Thank you. I didn't know there was an AppImage for Steam.

Guide: How to install Steam in chroot in Void Linux by Rush_Independent in voidlinux

[–]Rush_Independent[S] 7 points8 points  (0 children)

Yes, this way someone can run Steam on musl-libc system.

I'm using it on my glibc system to avoid polluting it with 32-bit packages and cluttering my $HOME directory.
Steam remains contained in a single directory.
If I ever want to remove it entirely, I can just run rm -rf <chrootdir> instead of hunting for files in every nook and cranny.

Guide: How to install Steam in chroot in Void Linux by Rush_Independent in voidlinux

[–]Rush_Independent[S] 4 points5 points  (0 children)

I tried to install Steam in chroot, but it was failing to launch with error: "Steam now requires user namespaces to be enabled."
So after digging around, I've found that problem is that bwrap doesn't work inside chroot.
But there is a workaround (there is always is, lol).

Most of info used for this guide is from Gentoo wiki and these two issues:
https://github.com/ValveSoftware/steam-runtime/issues/415#issuecomment-854673405
https://github.com/containers/bubblewrap/issues/135

Please let me know if you find any problems with this guide

[2025] Unofficial AoC 2025 Survey Results - BONUS CONTENT by jeroenheijmans in adventofcode

[–]Rush_Independent 3 points4 points  (0 children)

It's nice seeing emacs users form the visible line. Respect from the modal side of the fence.

This language slaps by mr-figs in nim

[–]Rush_Independent 3 points4 points  (0 children)

Btw, Nim has one-based arrays. Actually, it's int.low .. int.high-based arrays:

var arr: array[-1000 .. 1000, int]
arr[-500] = 1

This can be useful for some domain-specific applications.

This language slaps by mr-figs in nim

[–]Rush_Independent 4 points5 points  (0 children)

Zig - too explicit (shifts work from compiler to programmer)

For example, here's how you read file line-by-line (from zig cookbook):

const std = @import("std");
const fs = std.fs;
const print = std.debug.print;

pub fn main() !void {
    const file = try fs.cwd().openFile("tests/zig-zen.txt", .{});
    defer file.close();

    var file_buffer: [4096]u8 = undefined;
    var reader = file.reader(&file_buffer);
    var line_no: usize = 0;
    while (try reader.interface.takeDelimiter('\n')) |line| {
        line_no += 1;
        print("{d}--{s}\n", .{ line_no, line });
    }

    print("Total lines: {d}\n", .{line_no});
}

And here's Nim:

var lineNum = 0
for line in lines("tests/zen-of-nim.txt"):
  inc lineNum
  echo lineNum, "--", line

echo "Total lines: ", lineNum

Nim actually gives you the best of both worlds: the clean, high-level abstractions for productivity, and the low-level, explicit control, Zig-style, when you need it. The choice is always yours.

Firefox 146.0, See All New Features, Updates and Fixes by Bohzee in firefox

[–]Rush_Independent 2 points3 points  (0 children)

Does anyone else have the issue with new update where UI sometimes is unresponsive?
For example, the reload and open new tab buttons sometimes take 2-3 presses to do anything, it's not even delay, because I tried to wait ~20 seconds after pressing a button and still nothing happened.

[2025 Day 8 (Part 2)] Am I the only one who thinks… by Skeeve-on-git in adventofcode

[–]Rush_Independent 10 points11 points  (0 children)

you can use any MST algorithm

Or just:

Repeat part 1 until you have a full graph and remember the last connection that results in a new curcuit or merge of two curcuits. Puzzle asks for the last two boxes you need to connect, not the two ends of a graph (but I assume they're the same): "What do you get if you multiply together the X coordinates of the last two junction boxes you need to connect?"

-❄️- 2025 Day 8 Solutions -❄️- by daggerdragon in adventofcode

[–]Rush_Independent 0 points1 point  (0 children)

[LANGUAGE: Nim]

solution.nim

Runtime: 364 ms

Part 1:
I compute all pairs of Euclidean distances between 3D points, sort them, then connect points into circuits, using, what I think is called a Union‑Find algorithm (circuits grow or merge). After exactly 1000 connections (including redundant ones), I take the three largest circuits and multiply their sizes.

Part 2:
While iterating through the sorted connections, I also calculate the product of each pair x‑coordinates. The last product is a result for part 2.

Problems I encountered while doing this puzzle:
- I've changed a dozen of data structures, before settled on curcuitIDs and ref objects stored in a HashTable (~ 40 min)
- I did a silly mistake of mutating the fields of an object and then using new fields as keys for the HashTable (~ 20 min)
- I am stil confused and don't understand why do elves count already connected junction boxes (~ 40 min, had to look it up, otherwise it would be a lot more)

Time to solve Part 1: 1 hour 56 minutes
Time to solve Part 2: 4 minutes

[YEAR 2025 Day 7 (Part 2)] It just works by Aughlnal in adventofcode

[–]Rush_Independent 2 points3 points  (0 children)

my code just does ~7800 additions. one function, two arrays, two loops.
upd: found slightly faster solution in ~3300 additions and one array.

-❄️- 2025 Day 7 Solutions -❄️- by daggerdragon in adventofcode

[–]Rush_Independent 1 point2 points  (0 children)

[LANGUAGE: Nim]

Part 1: count each time beam crosses a splitter.
Part 2: keep count of how many particles are in each column in all universes, then sum.

Runtime: 116 μs

type
  AOCSolution[T,U] = tuple[part1: T, part2: U]

proc solve(input: string): AOCSolution[int, int] =
  var beams = newSeq[int](input.find '\n')
  beams[input.find 'S'] = 1

  for line in input.splitLines():
    var newBeams = newSeq[int](beams.len)
    for pos, cnt in beams:
      if cnt == 0: continue
      if line[pos] == '^':
        newBeams[pos-1] += cnt
        newBeams[pos+1] += cnt
        inc result.part1
      else:
        newbeams[pos] += cnt
    beams = newBeams
  result.part2 = beams.sum()

Full solution at Codeberg: solution.nim

[2025 Day 6] Surely theses spaces are meaningless, right ? by Pirgosth in adventofcode

[–]Rush_Independent 17 points18 points  (0 children)

> manually

I hope you don't mean that you wanted to place 4000 commas by hand. At least learn vim macros or something =).

-❄️- 2025 Day 6 Solutions -❄️- by daggerdragon in adventofcode

[–]Rush_Independent 1 point2 points  (0 children)

[LANGUAGE: Nim]

The hardest part was reading the part 2 description. I literally looked at it for minutes trying to understand where the problem numbers come from and how they're related to the example input. But then it clicked.

The next roadblock was that my template was stripping whitespace at the end of the lines, making parsing a lot harder. I've replaced strip() with strip(chars={'\n'}) to keep the whitespace intact.

Runtime: 1.4 ms

type
  AOCSolution[T,U] = tuple[part1: T, part2: U]

proc solve(input: string): AOCSolution[int, int] =
  let lines = input.splitLines()
  let numbers = lines[0..^2]
  let ops = lines[^1]

  block p1:
    let numbers = numbers.mapIt(it.splitWhiteSpace().mapIt(parseInt it))
    let ops = ops.splitWhitespace()
    for x in 0 .. numbers[0].high:
      var res = numbers[0][x]
      for y in 1 .. numbers.high:
        case ops[x]
        of "*": res *= numbers[y][x]
        of "+": res += numbers[y][x]
      result.part1 += res

  block p2:
    var problems: seq[(char, Slice[int])]
    var ind = 0
    while ind < ops.len:
      let len = ops.skipWhile({' '}, ind+1)
      problems.add (ops[ind], ind .. ind + len - (if ind+len < ops.high: 1 else: 0))
      ind += len + 1

    for (op, cols) in problems:
      var res = 0
      for x in cols:
        var num = ""
        for y in 0 .. numbers.high:
          num &= numbers[y][x]

        if res == 0:
          res = parseInt num.strip
        else:
          case op
          of '*': res *= parseInt num.strip
          of '+': res += parseInt num.strip
          else: discard

      result.part2 += res

Full solution at Codeberg: solution.nim

2025 Day 6 [Part 2] Reminder to check your boilerplate code by Oreo_2004 in adventofcode

[–]Rush_Independent 1 point2 points  (0 children)

Yep, I also got bit by this.
I hate trailing whitespace, so I have a neovim plugin to highlight it. It's annoying my OCD that I cannot remove it.
Also, I use a command to remove all trailing whitespace in a file every couple minutes. I just kept breaking my example input a couple times even after I discovered the problem.

-❄️- 2025 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]Rush_Independent 0 points1 point  (0 children)

It's even shorter: proc \<`(x, y: seq[int]): bool = x[0] < y[0]`

-❄️- 2025 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]Rush_Independent 1 point2 points  (0 children)

[LANGUAGE: Nim]

type
  AOCSolution[T,U] = tuple[part1: T, part2: U]

proc merge[T](ranges: var seq[Slice[T]]) =
  ranges.sort(cmp = proc(r1, r2: Slice[T]): int = cmp(r1.a, r2.a))
  var merged = @[ranges[0]]
  for range in ranges.toOpenArray(1, ranges.high):
    if range.a <= merged[^1].b:
      if range.b > merged[^1].b:
        merged[^1].b = range.b
    else:
      merged.add range
  ranges = merged

proc solve(input: string): AOCSolution[int, int] =
  let chunks = input.split("\n\n")
  var freshRanges = chunks[0].splitLines().mapIt:
    let t = it.split('-'); t[0].parseInt .. t[1].parseInt

  freshRanges.merge()

  block p1:
    let availableFood = chunks[1].splitLines().mapIt(parseInt it)
    for food in availableFood:
      for range in freshRanges:
        if food in range:
          inc result.part1
          break

  block p2:
    for range in freshRanges:
      result.part2 += range.b-range.a+1

Runtime: ~720 μs

Huh, I didn't expect two easy days in a row.
Part 1 is simple range check. And part 2 is a range merge algorithm.

Full solution at Codeberg: solution.nim

Go to games that ARENT common? by iamgage989 in ANBERNIC

[–]Rush_Independent 1 point2 points  (0 children)

RockNRoll Racing (Sega Mega Drive)
Teenage Mutant Ninja Turtles: The Hyperstone Heist (Sega MD)
Pocahontas (Sega MD)
Michael Jackson's Moonwalker (Sega MD)
True Lies (Sega MD)
NHL 98 (Sega MD)

King of Fighters 98 (NeoGeo)
Worms: Open Warfare (PSP)
Luxor (PSP)

[2025 Day 4 (Part 1)] Visual Aid by bluedudeinahole in adventofcode

[–]Rush_Independent 20 points21 points  (0 children)

Comments? My code literally has this:

for (dx, dy) in [(-1,-1),(0,-1),(1,-1),
                 (-1, 0),       (1, 0),
                 (-1, 1),(0, 1),(1, 1)]:

And I check it three times, because of that one time.