Better HN
topnewbestaskshowjobs
Log inSign up

plingbang

75 karma · joined Feb 13, 2021 (5y ago) · 36 submissions

Submissions

comment 3y ago · link · parent

Sounds like Selection sort[1]. It was probably the first sorting algorithm I ever implemented. I don't know why bubble sort is usually taught first. Selection sort seems more obvious. Perhaps the implementation is slightly harder due to the need to keep track of two indexes.

1. https://en.wikipedia.org/wiki/Selection_sort

comment 3y ago · link · parent

Combined with IP source address spoofing, it would probably help greatly with DDoS amplification attacks while only saving up <50% packets for good users.

If you care about time rather than packet count, you can send packets with all reasonable TTL values at once.

comment 3y ago · link · parent

Interestingly, Firefox records all your visits to a particular page, not just the latest visit. You could've changed the history sort order to "first visit" so that the list doesn't change when you revisit the page but that option simply isn't there in the UI.

comment 3y ago · link · parent

The plot looks a bit weird when I ping my server ;)

    gping ftlping.net

35.

Show HN: Ping Rfc6921.net (April Fools')

3 points · by plingbang · 3y ago · discuss

comment 4y ago · link · parent

A version that should confuse people not familiar with Haskell even more:

    primes = 2 : filter isPrime [3..]
    isPrime x = all (\p -> x `mod` p /= 0) $ takeWhile (\p -> p * p <= x) primes
primes is a list of prime numbers. It is defined as number 2 and numbers 3,4,5... for which isPrime is True.

isPrime is a function that checks that x is a prime number by taking numbers whose squares don't exceed x from... primes list... and then making sure they all divide x with a reminder.

It only works because isPrime never touches an unevaluated element of primes list. Otherwise, the program would loop.

12