Hi!

My previous/alt account is yetAnotherUser@feddit.de which will be abandoned soon.

  • 5 Posts
  • 305 Comments
Joined 2 years ago
cake
Cake day: June 1st, 2024

help-circle








  • Mein Problem ist es schnell und einfach HTML zu scrapen und parsen.

    Die Lösung? curl "$URL" | grep -E "$REGEX" | sed 's|"$OLD"|"$NEW"|' offensichtlich!

    (Keine Sorge, es ist etwas “schöner”. Hier ein wunderschöner Ausschnitt:)

    Äußerst legitime Anwendung von Regex die ich tatsächlich so eingebaut habe
    old_file=$(find . -maxdepth 1 -regextype egrep -regex '\./'"$filename"' [0-9]{4}-[0-9]{2}-[0-9]{2}\..*' -print | sort | tail -n1 | sed 's|\./||')
    

    Dokumentation wäre hierfür überflüssig.









  • Even though this isn’t C, but if we take from the C11 draft §6.8.5 point 6 (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf):

    An iteration statement whose controlling expression is not a constant expression, that performs no input/output operations, does not access volatile objects, and performs no synchronization or atomic operations in its body, controlling expression, or (in the case of a for statement) its expression-3, may be assumed by the implementation to terminate

    “new Random().nextInt()” might perform I/O though so it could still be defined behavior. Or the compiler does not assume this assumption.

    But an aggressive compiler could realize the loop would not terminate if x does not become 10 so x must be 10 because the loop can be assumed to terminate.