Skip Navigation

Search

93% of Paint Splatters are Valid Perl Programs

Source: https://0x2121.com/7/Lost_in_Translation/

Alt Text: (For searchability): 3 part comic, drawn in a simple style. The first, leftmost panel has one character yelling at another: "@+_$^P&%!. The second comic has them continue yelling, with their hands in an exasperated position: "$#*@F% $$#!". In the third comic, the character who was previously yelling has their hands on their head in frustration, to which the previously silent character responds: "Sorry, I don't speak Perl".

Also relevant: 93% of paint splatters are valid perl programs

3

My Technical Romance

26

Crowdstrike! Baby Crowdstrike!

[Alt text: GIF from the music video for “Love Shack” by the B-52s. The video depicts people dancing in a convertible, multiple people in suits and dresses dancing (visible from the waist down), martinis, a duck shaking its tail, and two men playing saxophones. The subtitles read:

The Crowdstrike is a kernel-space app that

has no testing process

Crowdstrike! Baby Crowdstrike!

Crowdstrike! Baby Crowdstrike!]

9

Writing documentation

Meme transcription [Gus Fring fixing his tie]:

> You don’t write documentation because you’re lazy. > > I don’t write documentation because I don’t want to find out how my app actually works > > We are not the same

0

Companies updating their websites

Meme transcription [Kid drowning in pool]

In the background a person plays with a kid in the pool. The person is labeled “Companies updating their website”. The kid is labeled “The company logo”.

In the foreground a kid seems to be drowning. It is labeled “Useful information”.

In a second panel a skeleton sits at the bottom of the pool. It is labeled “The copyright year”

17

Verification badge prices are too damn high

Context: After evaluating the DockerHub Verified Publisher Program and receiving a mail with "it costs as little as $5k per year" I have come to the conclusion that it's not worth it

10

Python is great, but stuff like this just drives me up the wall

Explanation: Python is a programming language. Numpy is a library for python that makes it possible to run large computations much faster than in native python. In order to make that possible, it needs to keep its own set of data types that are different from python's native datatypes, which means you now have two different bool types and two different sets of True and False. Lovely.

Mypy is a type checker for python (python supports static typing, but doesn't actually enforce it). Mypy treats numpy's bool_ and python's native bool as incompatible types, leading to the asinine error message above. Mypy is "technically" correct, since they are two completely different classes. But in practice, there is little functional difference between bool and bool_. So you have to do dumb workarounds like declaring every bool values as bool | np.bool_ or casting bool_ down to bool. Ugh. Both numpy and mypy declared this issue a WONTFIX. Lovely.

67

There's no place like ``

I bet all those people that got tattoos of "There's no place like 127.0.0.1" are so embarrassed now that IPv6 has been adopted globally.

23

Only \<SPAN>s

cross-posted from: https://lemmy.smeargle.fans/post/148236

> Only <SPAN>s > > HN Discussion

3

that ain't legal either

transcript

Screenshot of github showing part of the commit message of this commit with this text: ``` Remove the backdoor found in 5.6.0 and 5.6.1 (CVE-2024-3094).

While the backdoor was inactive (and thus harmless) without inserting a small trigger code into the build system when the source package was created, it's good to remove this anyway:

  • The executable payloads were embedded as binary blobs in the test files. This was a blatant violation of the Debian Free Software Guidelines.

  • On machines that see lots bots poking at the SSH port, the backdoor noticeably increased CPU load, resulting in degraded user experience and thus overwhelmingly negative user feedback.

  • The maintainer who added the backdoor has disappeared.

  • Backdoors are bad for security.

This reverts the following without making any other changes: ```

The sentence "This was a blatant violation of the Debian Free Software Guidelines" is highlighted.

Below the github screenshot is a frame of the 1998 film The Big Lebowski with the meme caption "What, are you a fucking park ranger now?" from the scene where that line was spoken.

65

Go cloud native they said...

40

Difference Between Nerd and Geek

Difference Between Nerd and Geek

Has anyone written a scientific treatise on the differences between nerd and geek?

On the one hand, I could instigate endless debate about the finer points of nerds.

On the other hand I could construct nerds with a 3-D meat printer.

@[email protected]

25

CSS Humor

!

16

When the Internet gets taken over by GPT

9

¯⁠\⁠_⁠(⁠ツ⁠)⁠_⁠/⁠¯

! !

32

tar -vczfx123 ought to do it

source

img title="I don't know what's worse--the fact that after 15 years of using tar I still can't keep the flags straight, or that after 15 years of technological advancement I'm still mucking with tar flags that were 15 years old when I started."

86

Whatever is Clever Public License

Whatever is Clever Public License

Do whatever is clever. Do as you wish with this product.

Do whatever is clever shall be the whole of the law.

https://codeberg.org/sugarbug/whatever-is-clever-public-license

@[email protected]

29

I only like pointers, not humans

we're not the same meme with the following text:

you like threesome I like leetcode.com/problems/3sum we're not the same

11

You gotta love these auto translations

Found in a python tutorial on guru99.com. For the non german speaking: The noun "research" translates to "Forschung" in german.

4

#Vim #Meme

68
carrot.py
  • @zarkanian @RampantParanoia2365

    That sounds like input sanitation to me...

  • Oh boy what a beautiful regex. I'm sure it does something logical and easy to understand.
  • By now, I have just one, so thanks for the assist. There's always that one (sometimes puzzling) downvote on anything factual.

    The pumping lemma, for anyone unfamiliar. It's a consequence of the fact an FSM is finite, so you can construct a repeatable y just by exhausting the FSM's ability to "remember" how much it's seen.

  • Oh boy what a beautiful regex. I'm sure it does something logical and easy to understand.
  • If the set of all strings of composite length is a regular language, you can use that to prove the set of all strings of prime length are also a regular language.

    But it's also easy to prove that the set of language of strings of prime length is not regular, and thus the language of strings of composite length also can't be regular.

    A more formal proof.

  • Oh boy what a beautiful regex. I'm sure it does something logical and easy to understand.
  • You got downvoted here but you're absolutely right. It's easy to prove that the set of strings with prime length is not a regular language using the pumping lemma for regular languages. And in typical StackExchange fashion, someone's already done it.

    Here's their proof.

    Claim 1: The language consisting of the character 1 repeated a prime number of times is not regular.

    A further argument to justify your claim—

    Claim 2: If the language described in Claim 1 is not regular, then the language consisting of the character 1 repeated a composite number of times is not regular.

    Proof: Suppose the language described in Claim 2 is regular if the language described in Claim 1 is not. Then there must exist a finite-state automaton A that recognises it. If we create a new finite-state automaton B which (1) checks whether the string has length 1 and rejects it, and (2) then passes the string to automaton A and rejects when automaton A accepts and accepts when automaton A rejects, then we can see that automaton B accepts the set of all strings of non-composite length that are not of length 1, i.e. the set of all strings of prime length. But since the language consisting of all strings of prime length is non-regular, there cannot exist such an automaton. Therefore, the assumption that the language described in Claim 2 being regular is false.

  • Trick OR Treat
  • So this is one of the cases where XOR is contextually meant by "or". Although people have been known to do trick anyway, and it's of course an empty threat most of the time, so more like treat CONST ~trick. Speaking of, where's my identity, implication, inhibition and null Halloweens?

    Trick XNOR treat is the definite chaotic option. Your house gets egged if and only if you give them candy.

  • Oh boy what a beautiful regex. I'm sure it does something logical and easy to understand.
  • "at least 2 characters repeated [at least] twice" implies the string's length is divisible by a number greater than 1.

  • Oh boy what a beautiful regex. I'm sure it does something logical and easy to understand.
  • The answer given in the spoiler tag is not quite correct!

    Test case

    According to the spoiler, this shouldn't match "abab", but it does.

    Corrected regex

    This will match what the spoiler says: ^.?$|^((.)\2+?)\1+$

    Full workup

    Any Perl-compatible regex can be parsed into a syntax tree using the Common Lisp package CL-PPCRE. So if you already know Common Lisp, you don't need to learn regex syntax too!

    So let's put the original regex into CL-PPCRE's parser. (Note, we have to add a backslash to escape the backslash in the string.) The parser will turn the regex notation into a nice pretty S-expression.

    > (cl-ppcre:parse-string "^.?$|^(..+?)\\1+$")
    (:ALTERNATION
     (:SEQUENCE :START-ANCHOR (:GREEDY-REPETITION 0 1 :EVERYTHING) :END-ANCHOR)
     (:SEQUENCE :START-ANCHOR
      (:REGISTER
       (:SEQUENCE :EVERYTHING (:NON-GREEDY-REPETITION 1 NIL :EVERYTHING)))
      (:GREEDY-REPETITION 1 NIL (:BACK-REFERENCE 1)) :END-ANCHOR))
    

    At which point we can tell it's tricky because there's a capturing register using a non-greedy repetition. (That's the \1 and the +? in the original.)

    The top level is an alternation (the | in the original) and the first branch is pretty simple: it's just zero or one of any character.

    The second branch is the fun one. It's looking for two or more repetitions of the captured group, which is itself two or more characters. So, for instance, "aaaa", or "abcabc", or "abbaabba", but not "aaaaa" or "abba".

    So strings that this matches will be of non-prime length: zero, one, or a multiple of two numbers 2 or greater.

    But it is not true that it matches only "any character repeated a non-prime number of times" because it also matches composite-length sequences formed by repeating a string of different characters, like "abcabc".

    If we actually want what the spoiler says — only non-prime repetitions of a single character — then we need to use a second capturing register inside the first. This gives us:

    ^.?$|^((.)\2+?)\1+$.

    Specifically, this replaces (..+?) with ((.)\2+?). The \2 matches the character captured by (.), so the whole regex now needs to see the same character throughout.

  • Trick OR Treat
  • Trick or treat is a threat. They can’t refuse you treats because of the implication.

  • cv2.imshow("Post", frame)
  • As an Indian, <sigh>...

    Man, tutorials kinda' suck, you know? I'm a documentation guy. Also an OOP enthusiast [ https://dataorienteddesign.com/dodbook ] kinda' guy.

  • 93% of Paint Splatters are Valid Perl Programs
  • I primarily use perl, and while I find its syntax easy to understand, I'll be the first to admit that its syntax and special use cases thereof does provide a way for some rather exotic symbol-garbage to be valid code.

    Normal perl code is simple enough. But abnormal code does happen, sometimes on purpose, sometimes by accident.

    I'll share with you this gem:
    Why is this program valid? I was trying to create a syntax error

  • When you're supposed to use Rust, but you only know Python...
  • From what I understand, it works like this:

    1. Rust compiler reads the pseudo-Python and tokenizes it according to Rust's rules.
    2. Macro code converts the tokens back to (now proper) Python, while filling in the captured variables. I believe, this is the code that does this.
    3. Python code is executed in an actual Python interpreter, via PyO3.