Skip to content

Instantly share code, notes, and snippets.

View krisutofu's full-sized avatar

Elmar krisutofu

View GitHub Profile
@krisutofu
krisutofu / Algorithm.md
Last active October 23, 2025 14:56
Taco Crawl Challenge (Sightseeing Optimization)

optimizing visited value per distance travelled (sightseeing, tourist problem):

  • is it possible to turn tastiness and distance into one weight?

    • weight w = (target tastiness / edge length, edge length)
    • (a, x) + (a, y) = (a, x + y)
    • (a, x) + (b, x) = ((a + b)/2 , 2x)
    • (a, x) + (b, y) = ((x·a + y·b)/(x+y), x+y) = (2x/(x+y) ·a, (x+y)/2) + (2y/(x+y) ·b, (x+y)/2)
    • weights are compared only in the first component
  • essential insights:

@krisutofu
krisutofu / .sh
Last active September 23, 2025 14:08
Script that safely updates Garuda with Pacman without crashes when using btrfs and snapper
#!/bin/bash
# This bash script bypasses the crashing problem when using BTRFS and Snapper with Pacman. Useful as long as the Pacman
# space computation bug is not fixed.
# This script expects only a single mountpoint to be updated, and only the root config of snapper to be used.
# `bc` (basic calculator) needs to be installed which did NOT come by default with my Garuda Plasma installation.
if [ $(id -u) != 0 ]; then
exec sudo -s "$0" "$@";
fi
# does not work, it will not show the dialog for unknown reason, same with send-notify