• 32 Posts
  • 466 Comments
Joined 1 year ago
cake
Cake day: June 10th, 2023

help-circle



  • Leeches are such cool creatures. I had a run-in with them while canoeing in Manitoba. Just one or two latched on. It’s really incredible how they can move their bodies around in the water yet maintain the exact texture and fluidity of the water itself. You’d never be able to feel one if it brushed up against you.

    Also crazy how well whatever numbing chemical they produce works.

    If you want to safely observe one up close, you can get them to latch on to your finger nail where they can’t do any damage.



  • ch00f@lemmy.worldtoMicroblog Memes@lemmy.worldThe moon
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 days ago

    Best explanation I’ve seen is that humans judge distance and size assuming a relatively flat surface (a dozen miles or so in any direction is fairly flat even though the Earth is round).

    Things far along the horizon tend to be small because they’re far away. This isn’t the case for the Moon. So our brains assume it’s far away, but it’s the same apparent size, ergo, it must be massive.

    Like we know Mt Rainier is massive and far away, so given this photo, we might assume the moon is massive.

    Higher in the sky, there’s no real point of reference. Also, you might visually process the sky as a flat layer above the ground, so the same parallax trick applies. I.e. the sky above you is closer than the sky/ground at the horizon. Therefore Moon is “closer” and appears smaller.





  • Not an Elon fan, but this kind of story hurts the public perception of EVs which bothers me.

    This is not unique to Teslas or even EVs.

    You can get stuck in a stock Corvette since 2005

    That was after 3 seconds of googling. There are plenty of cars that are difficult to escape or enter with a dead battery. Some consider electronic door controls as a luxury feature. They will fail to function with no power. Hate them if you like.

    For Teslas in particular, there is a mechanical latch for the doors on the inside. Learn where they are. On the outside, there are terminals near the tow hook that when given 9V will pop the frunk. Then you can access the 12V battery to jump it.









  • I believe the optimization came because the denominator was a power of two. In my memory, the function counted up all of the bytes being sent and checked to see that the sum was a power of 16 (I think 16 bytes made a single USB endpoint or something; I still don’t fully understand USB).

    For starters, you can split up a larger modulo into smaller ones:

    X = (A + B); X % n = (A % n + B % n) % n

    So our 16 bit number X can be split into an upper and lower byte:

    X = (X & 0xFF) + (X >> 8)

    so

    X % 16 = ((X & 0xFF) % 16 + (X >>8) % 16) % 16

    This is probably what the compiler was doing in the background anyway, but the real magic came from this neat trick:

    x % 2^n = x & (2^n - 1).

    so

    x % 16 = x & 15

    So a 16 bit modulo just became three bitwise ANDs.

    Edit: and before anybody thinks I’m good a math, I’m pretty sure I found a forum post where someone was solving exactly my problem, and I just copy/pasted it in.

    Edit2: I’m pretty sure I left it here, but I think you can further optimize by just ignoring the upper byte entirely. Again, only because 16 is a power of 2 and works nicely with bitwise arithmatic.