There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

jimmy90 , in I Will Fucking Piledrive You if You mention AI Again

this is a fucking masterpiece

where_am_i , in I Will Fucking Piledrive You if You mention AI Again

Read the article. This hit home too close.

passepartout , in Bored of the MIT and GPL Licenses? Switch From That Lame Old Legalese to One of These 10 Awesome Licenses!

Where hot potato license?

HOT POTATO LICENSE Version 2, September 2021 All rights reserved by the last person to commit a change to this repository, except for the right to commit changes to this repository, which is hereby granted to all inhabitants of the Milky Way Galaxy for the purpose of committing changes to this repository.

Diplomjodler3 ,

Sad Andromedan noises…

s12 , in How to write Hello World

Umm… someone explain this code please?

magic_lobster_party , (edited )

Bit shift magic.

My guess is that all the individual characters of Hello World are found inside the 0xC894 number. Every 4 bits of x shows where in this number we can find the characters for Hello World.

You can read x right to left. (Skip the rightmost 0 as it’s immediately bit shifted away in first iteration)

3 becomes H
2 becomes e
1 becomes l
5 becomes o

etc.

I guess when we’ve exhausted all bits of x only 0 will be remaining for one final iteration, which translates to !

CanadaPlus , (edited )

Too readable. You’ve gotta encode the characters as the solutions of a polynomial over a finite field, implemented with linear feedback on the bit shifts. /s

s12 ,

I understand that the characters are probably encoded into that number, but I’m struggling to understand that C/C++ code.

EmptySlime ,

<span style="color:#323232;">#include <stdio.h>
</span><span style="color:#323232;">
</span><span style="color:#323232;">int main() {
</span><span style="color:#323232;">
</span><span style="color:#323232;">Long long x = 0x7165498511230;
</span><span style="color:#323232;">
</span><span style="color:#323232;">while (x) putchar(32 + ((0xC894A7875116601 >> ((x >>= 4) & 15) * 7) & 0x7F));
</span><span style="color:#323232;">
</span><span style="color:#323232;">return 0;
</span><span style="color:#323232;">}
</span>

Might be wrong on a few things here as I haven’t done C++ in a while, but my understanding is this. I’m sure you can guess that this is just a very cheekily written while loop to print the characters of “Hello, World!” but how does it work? So first off, all ASCII characters have an integer value. That 32 there is the value for the space character. So depending on what ((0xC894A7875116601 >> ((x >>= 4) & 15) * 7) & 0x7F)) evaluates down into you’ll get different characters. The value for “H” for example is 72 so that first iteration we know that term somehow evaluated to the number 40 as 72 - 32 = 40.

So how do we get there? That big number, 0xC894A7875116601 is getting shifted right some number of bits. Let’s start evaluating the parenthesis. (X >>= 4) means set x to be itself after bit shifting it right by 4 bits then whatever that number is we bitwise AND it with 15 or 1111 in binary. This essentially just means each iteration we discard the rightmost digit of 0x7165498511230, then pull out the new right most digit. So the first iteration the ((x >>= 4) & 15) term will evaluate to 3, then 2, then 1, then 1, etc until we run out of digits and the loop ends since effectively we’re just looking for x to be 0.

Next we take that number and multiply it by 7. Simple enough, now for that first iteration we have 21. So we shift that 0xC894A7875116601 right 21 bits, then bitwise AND that against 0x7F or 0111 1111 in binary. Just like the last time this means we’re just pulling out the last 7 bits of whatever that ends up being. Meaning our final value for that expression is gonna be some number between 0 and 127 that is finally added to 32 to tell us our character to print.

There are only 10 unique characters in “Hello, World!” So they just assigned each one a digit 0-9, making 0x7165498511230 essentially “0xdlroW ,olleH!” The first assignment happens before the first read, and the loop has a final iteration with x = 0 before it terminates. Which is how the “!” gets from one end to the other. So they took the decimal values for all those ASCII characters, subtracted 32 then smushed them all together in 7 bit chunks to make 0xC894A7875116601 the space is kinda hidden in the encoding since it was assigned 9 putting it right at the end which with the expression being 32 + stuff makes it 0 and there’s an infinitely assumed parade of 0s to the left of the C.

s12 ,

Thank you.

barsoap ,

32 is ASCII space, the highest number you need is 114 for r (or 122 for z if you want to be generic), that’s a range of 82 or 90 values.

The target string has 13 characters, a long long has 8 bytes or 16 nibbles – 13 fits into 16 so nibbles (the (x >>= 4) & 15) it is. Also the initial x happens to have 13 nibbles in it so that makes sense. But a nibble only has 16 values, not 82, so you need some kind of compression and that’s the rest of the math, no idea how it was derived.

If I were to write that thing I’d throw PAQ at it it can probably spit out an arithmetic coding that works, and look even more arcane as you wouldn’t have the obvious nibble steps. Or, wait, throw NEAT at it: Train it to, given a specific initial seed, produce a second seed and a character, score by edit distance. The problem space is small enough for the approach to be feasible even though it’s actually a terrible use of the technique, but using evolution will produce something that’s utterly, utterly inscrutable.

Rentlar , in Someone escaped the Matrix
haulyard ,
@haulyard@lemmy.world avatar

Wait is he still on the Azure Performance team?

TrickDacy ,

Nope. If he hadn’t quit, it would say “present” instead of July 2024

ArcaneSlime ,

But…it says “august 2017-present” on the screenshot I’m looking at? Right? Also, isn’t July 2024 like, next month?

tyler ,

It says 2023, not 24. Commenter typo’d. and the top number is correct. Bottom one is probably custom filled out, not based on actual work history.

SqueakyBeaver ,

Look under “Principal Software Development Engineer.” It says “2017-present”

TrickDacy ,

That’s the basis for my claim actually. The other position has a date not the word “present”. Which I now realize includes 2023 not this year, so I don’t know what the original question was getting at.

Rentlar ,

Azure needs him to care for Microsoft’s Golden Goose at his farm.

missphant , in It's easier to remember the IPs of good DNSes, too.
@missphant@lemmy.blahaj.zone avatar

Ha I can remember the ipv6 of cloudflare DNS just fine! It’s uh… something : something : something :: 1111

Morphit , (edited )
@Morphit@feddit.uk avatar

2606:4700:4700::1111

Hmm, maybe Google is easier:
2001:4860:4860::8888

Quad9 is 2620:fe::fe or 2620:fe::9

I don’t understand why they can’t get better addresses than that. Like surely 1::1 would be valid?

Edit: So IANA only control addresses 2001:: and up and there are quite a few IETF reservations within that. I don’t know why they picked such a high number to start at. Everything else seems IETF reserved with a little space allocated for special purposes (link-local, multicast, etc.).

Thiakil ,

Address space is so huge that iirc the only global addresses in use are 2xxx::

Its so huge that it’s not needed to use anything else is the goal as far as I see. If it starts with 2, it’s global.

Thiakil ,

Also for routing table reasons. Ipv6 needs to use prefixes to do link aggregation or it just gets too bjg

Morphit ,
@Morphit@feddit.uk avatar

I can see that, but surely there wouldn’t be much difference matching the first 4bits (0x2XXX, 0xfXXX) vs the first 16 (0x0001)?
0:: is presumably all for loopback-type stuff, but I don’t see a reason not to use 1:: through 1fff:: and they would be much easier to type/remember/validate for public DNS servers which are needed before name resolution is available.

Thiakil ,

Not sure on the history of that. It would make things like that easier

JohnEdwa ,

IPv6 is big enough to give 10 billion unique addresses for every grain of sand on earth and still have some left over. Just in case we need to, I guess.

dan ,
@dan@upvote.au avatar

It’s great that the address space is so large. When designing a new system, you want to make sure it’ll hopefully never encounter the same issue as the old system, to ensure you don’t have to migrate yet again.

JohnEdwa ,

Sure. But the IPv6 implementation is a bit like if we went “you know the y2038 problem of 32 bit numbers, and how goin under 1970 is sometimes hard? Lets solve it by making it start from the big bang and store time as a 256 bit integer so we don’t run out until year 3.1 x 10^69”.

IPv6 is big enough for 340,282,366,920,938,463,463,374,607,431,768,211,456 unique addresses. Are we expecting to create an universe consuming army of exponentially replicating paper clip converting robots that each need an IPv6 address or something?

dan ,
@dan@upvote.au avatar

Having a large range has a number of benefits though. Companies that have dozens of IPv4 ranges may be fine with a single IPv6 range, which simplifies routing rules.

A lot of features in IPv6 take advantage of the fact that networks have at least a /64 range (at least if they’re built correctly according to RFC4291 and newer specs). SLAAC is a major one: Devices can auto-configure IP addresses without having to use something like a stateful DHCP server.

Morphit ,
@Morphit@feddit.uk avatar

Why start at 0x2001 though? Why not 0x0001? Then we could have addresses like 1:1:1::1 or 1:2:3::4.

lambalicious OP ,

1.1.1.1? :p

mexicancartel , in Someone escaped the Matrix

I wondered why I was getting notification from that repo after pretty long time. At least 3 people commented after this post

pleb_maximus , in It's easier to remember the IPs of good DNSes, too.

You can still NAT IPv6

gratux ,
@gratux@lemmy.blahaj.zone avatar

Yes, but why would you want to? We have enough addresses for the foreseeable future.

Brkdncr ,

So you don’t need to change your network if your isp changes.

mholiv ,

You shouldn’t have to?? Maybe you might need to change the mask in your firewall settings if the ipv6 allocation block size changes but that should be it.

Everything else should just work as normal.

r00ty Admin ,
r00ty avatar

You should only assign static ipv6 to servers, in theory you could just define a host id and use a prefix too. But, most people at home really aren't running enough servers to make that worthwhile. Everything else should just pick up new addresses fine using ND.

frezik ,

There ought to be more servers.

Will the app for the smart thermostat be updated three years from now and still be useful? If it was instead a web server app on a routable IP, it wouldn’t matter provided they didn’t fuck up the authentication and access control.

r00ty Admin ,
r00ty avatar

Yeah, but they're not. That's the modern world. But also even if it was a web server there's usually ways to advertise the IP for the app to connect to. I've seen other stuff do that. So getting an IP is easy. Once the app knows the IP and if you really want to allow connections from outside to your IOT devices (I wouldn't) it could remember the IP and allow that.

You really don't need to give a fixed IP to everything. I think I've given 1 or 2 things fixed IPv6 IPs. Everything else is fine with what it assigns itself.

frezik ,

The other app off the top of my head is VoIP. You should be able to “dial” a number directly. Most solutions go through the company’s data center first in order to pierce through NAT. Which makes it more expensive, less reliable, slower, and more susceptible to snooping.

There’s a “if you build it, they will come” effect here. Once you can address hosts directly, a whole bunch of things become better, and new ideas that were infeasible are now feasible. They don’t exist now because they can’t.

vzq ,

The solution to that is to buy a net block. IPV6 address space is very affordable.

dan ,
@dan@upvote.au avatar

You can use ULAs (unique local addresses) or that purpose. Your devices can have a ULA IPv6 address that’s constant, and a public IPv6 that changes. Both can be assigned using SLAAC (no manual config required).

I do this because the /56 IPv6 range provided by my ISP is dynamic, and periodically changes.

Brkdncr ,

Yes but you’d still be performing NAT. It’s at least 1:1.

You’ll need to deal with firewall rules regardless, and drop IPs into policies. IPv6 doesn’t remove any of those chores but gets rid of having to maintain tables to deal with many-to-one NAT.

dan ,
@dan@upvote.au avatar

You wouldn’t need NAT. The ULA is used on the internal network, and the public IP is for internet access. Neither of those need NAT.

Brkdncr ,

If you use a single shared public ip then you’re using some amount of address translation.

If you’re using an external ip address that’s different than an internal ip address but both are assigned to a single host the you’re doing 1:1 NAT.

At least that’s how I understand ipv4 and I don’t think ipv6 is much different.

dan , (edited )
@dan@upvote.au avatar

If you use a single shared public ip then you’re using some amount of address translation

This is practically never the case with IPv6. Usually, each device gets its own public IP. This is how the IPv4 internet used to work in the old days (one IP = one device), and it solves so many problems. No need for NAT traversal since there’s no NAT. No need for split horizon DNS since the same IP works both inside and outside your network.

There’s still a firewall on the router, of course.

At least that’s how I understand ipv4 and I don’t think ipv6 is much different.

With IPv6, each network device can have multiple IPs. If you have an internal IP for whatever reason, it’s in addition to your public IP, not instead of it.

IPs are often allocated using SLAAC (stateless address auto config). The router tells the client "I have a network you can use; its IP range is 2001:whatever/64, and the client auto-generates an IP in that range, either based on the MAC address (always the same) or random, depending on if privacy extensions are enabled - usually on for client systems and off for servers.

Brkdncr ,

Just like ipv4 though, you wouldn’t use external addresses internally because your external IPs might change, such as when moving between ISPs. You would NAT a hosts external address to its internal address.

dan ,
@dan@upvote.au avatar

your external IPs might change, such as when moving between ISPs

This is true

You would NAT a hosts external address to its internal address.

This is usually not true.

If you’re worried about your external IP changing (like if you’re hosting a server on it), you’d solve it the same way you solve it with IPv4: Using dynamic DNS. The main difference is that you run the DDNS client on the computer rather than the router. If there’s multiple systems you want to be able to access externally, you’d habe multiple DDNS hostnames.

Brkdncr ,

DNS doesn’t propagate fast enough.

Brkdncr ,

What translates the public ip to the internal ip? Aren’t they different?

dan ,
@dan@upvote.au avatar

There’s no translation between them. With IPv6, one network interface can have multiple IPs. A ULA (internal IP) is only used on your local network. Any internet-connected devices will also have a public IPv6 address.

ULAs aren’t too common. A lot of IPv6-enabled systems only have one IP: The private one.

lambalicious OP ,

That’s what they thought for IPv4… and for 2-year digits… and for…

flying_sheep ,
@flying_sheep@lemmy.ml avatar

I haven’t read anything this cursed in a while

r00ty Admin ,
r00ty avatar

Only if you're a masochist.

learningduck , in I Will Fucking Piledrive You if You mention AI Again

A lot of spicy quotes I could steal.

I’m going to ask ChatGPT how to prepare a garotte and then I am going to strangle you with it, and you will simply have to pray that I roll the 10% chance that it freaks out and tells me that a garotte should consist entirely of paper mache and malice.

RickyWars , in I Will Fucking Piledrive You if You mention AI Again

Great read. Even in STEM research as a grad student I’m very tired of every saying “let’s try machine learning on this problem” to get something that works marginally better than some conventional models but requiring huge amounts of computation and data.

xmunk ,

I work professionally with actually useful ML stuff (we parse a lot of weird ass files and it’s extremely powerful in that context) - we’ve looked at integrating gpt3 and it scored much worse on accuracy than the model we trained in-house. We’re also investigating adding front-end AI bullshit to placate the CEO. Even at the good shops, you’ll probably get buried in this bullshit - but there are good opportunities out there!

JCreazy , in Someone escaped the Matrix

As I get older, farming seems more enjoyable than dealing with technology. Sometimes it’s nice to just slow down.

azertyfun ,

The kind of farming that makes any money isn’t slow work.

It is, however, tangible work with tangible results. Unlike spending months changing the polarity of nanoscopic silicon structure for the non-appreciation of an utterly clueless salesperson whose braindead ideas will have left the world in a worse state than you found it despite anyone’s best efforts.

I should seriously get into woodworking. Kidding. Sorta.

match ,
@match@pawb.social avatar

remember when you would type a few lines of code and then a widget would appear immediately and you’d feel a tiny spark of emotion?

Okami_No_Rei , in Someone escaped the Matrix
@Okami_No_Rei@lemmy.world avatar

Farming? Really? Man of your talents?

Tetsuo ,

Seriously, some people are that good that you know they could do almost anything very well in a matter of days.

So why not ? I always have a lot of respect for someone that is willing to drastically change their lives in order to improve.

snooggums ,
@snooggums@midwest.social avatar

Huh, my first thought was that they went to the farm upstate where everyone’s pets end up.

ggppjj , (edited )

It’s a quote from a Star Wars show movie.

ech ,

*movie

ggppjj ,

Ah gee dang, you’re right. Thanks!

ech ,

Np!

MetaCubed ,

Its a quote from Rogue One if I’m not mistaken

9point6 ,

You don’t need to be skilled in something to get enjoyment out of it

Likewise you don’t necessarily get enjoyment out of something just because you’re skilled in it.

dustyData ,

It’s a peaceful life.

fibojoly ,

My entire career is based on “yeah but you’re good with computers and programming!” I just wanted to do fine arts and paint for fuck sake. And I could have made a career out of it, as history as since shown! Ah well. Maybe my kids will fare better, we’ll see.

kshade ,
@kshade@lemmy.world avatar

It’s never too late, especially if you can combine the two!

WhiskyTangoFoxtrot ,

Dirt cleans off a lot easier than blood.

geography082 , in It's easier to remember the IPs of good DNSes, too.

I can remember an up, but would never an ipv6

call_me_xale , (edited ) in How to write Hello World

As long as I don’t have to maintain it.

(Who tf downvoted this? The “legacy code” lobby?)

Darkraisisi , in Who lives in a Pineapple in the Algorithms Library for C? SpongeBob BinaryTreePants!
@Darkraisisi@feddit.nl avatar

Look at this guy not putting on pants because HIS last branch (toes) prevents him. You think the cops will believe that story?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines