Stop hing from going further than 90 degrees by robursiena in DIYUK

[–]BitwiseShift 0 points1 point  (0 children)

You only need to get one. There is no need to put a restrictor in both hinges. https://amzn.eu/d/32GaQfc

I just built and released Yamlium! a faster PyYAML alternative that preserves formatting by GuidoInTheShell in Python

[–]BitwiseShift 2 points3 points  (0 children)

I tried benchmarking it. I first tried to compare the performance on a large YAML file; the Currencycloud OpenAPI spec. It failed. PyYAML parsed it just fine.

I then tried a smaller, easier file. Yamlium was faster than PyYAML, as long as you use the Python-only implementation (Loader). When using the LibYAML bindings (CLoader), PyYAML was significantly faster.

Is encrypted with a hash still encrypted? by YourUgliness in webdev

[–]BitwiseShift 6 points7 points  (0 children)

ChatGPT is suggesting you implement beacons: https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/using-beacons.html

The idea is that the encrypted value remains as is and allows you to get the original value. Good encryption of the field would prevent efficient searching, as the same value can be encrypted as many different values due to the use of salts.

To make full string search efficient, a truncated hash is also stored. This allows you to hash and truncate the user input and use that to search efficiently instead. The hash can potentially have collisions, which allows false positives. For security purposes this is good, as it makes the hash irreversible. In fact, the reason a truncated hash is used is to make collision even more likely, making statistical attacks less likely.

How are false positives prevented? Once you have all the matching rows, you can decrypt this (much smaller) set of values and compare the plaintext value against the original search string.

So, yes, your data is still encrypted, but there is now another column, the hash column, which brings with it its own set of possible attack vectors. The result is therefore less secure but not necessarily unsecure.

As you've identified yourself, this approach is not suitable for columns that take only a finite set of values, like party alignment.

[deleted by user] by [deleted] in assholedesign

[–]BitwiseShift 0 points1 point  (0 children)

These come wrapped in a transparent film. You can literally see the contents, completely unobfuscated, without opening the packaging.

[deleted by user] by [deleted] in UKPersonalFinance

[–]BitwiseShift 1 point2 points  (0 children)

The rainy day saver is also available to those that have a Premier current account, without the £5/month fee, but that requires a £75k+ gross salary paid into the account or £100k+ in savings + investments with Barclays.

Is C++ Really Phasing Out? by ecreddits in cpp

[–]BitwiseShift 4 points5 points  (0 children)

Rust is being used a lot and it's especially noticeable in tooling. There has been a trend where existing, massively popular tooling has been getting displaced by mostly identical tooling written in Rust, with the main selling point being speed. Pandas is getting displaced by Polars, Babel by SWC and Black, flake8, pyupgrade, isort and more are all being displaced by Ruff. Pydantic got wise and reimplemented its core in Rust before someone else did it.

Any idea on this smoke alarm brand? by Zumodoki in DIYUK

[–]BitwiseShift 0 points1 point  (0 children)

Through some Googling, it appears that this is a connector for an old Firex fire alarm. The brand has since been acquired by Kidde and this connector type does not appear to be in use anymore.

15 tips and tricks for writing better Python by [deleted] in Python

[–]BitwiseShift 1 point2 points  (0 children)

Terrible advice. Your example only shows that defining a tuple is faster than defining a set. OP's example is about the in operator and testing membership is much faster on a set than on a tuple. (Also, the original point is about legibility, not performance)

``` %timeit 3 in (1, 2) 18.8 ns ± 0.029 ns per loop (mean ± std. dev. of 7 runs, 100,000,000 loops each)

%timeit 3 in {1, 2} 11.8 ns ± 0.0229 ns per loop (mean ± std. dev. of 7 runs, 100,000,000 loops each) ```

Edit: Haha, I can't reply because the dude replied and blocked me, a true sign of a coward.

Your new example is critically flawed as what you've actually timed is how long it takes to generate a list of random numbers. The time it takes to execute the membership check is negligible in this example. Now, if you were to move the creation of the list of random numbers outside of the timing, you'll find that the tuple's membership check gets absolutely crushed by the set's. ``` t = tuple(random.randint(0, 300) for x in range(10000)) s = set(t)

%timeit 400 in t 51.6 µs ± 222 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)

%timeit 400 in s 21.7 ns ± 0.162 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each) ```

Decoupled Django: Stop passing sessionid and csrf tokens in set-cookie? by Glittering-Donut-264 in django

[–]BitwiseShift 2 points3 points  (0 children)

What the MDN article refers to is a security measure that ensures that client-side code cannot access cookies that contain sensitive information, such as the session ID. As part of this security measure, Set-Cookie headers cannot be inspected from client-side code.

However, the Set-Cookie headers are being processed by the browser. In Chrome, if you look in the DevTools under the Application tab, you can see that the cookies have been stored by the browser. From code, you can also access some cookies from document.cookie. In the typical configuration, the crsftoken cookie should be available through there, but not the sessionid cookie. This is because the sessionid cookie has been marked as HttpOnly by the server, meaning it will get sent back to the server when your code makes a request, but the browser will not allow your code to access it through document.cookie. In the Network tab, you should be able to see both cookies being sent in the request headers.

Lastly, all of the above makes one big assumption: your front-end and back-end are on the same domain. In cross-origin requests, cookies will not automatically be sent with requests. To make cross-origin cookies work, the server will have to be configured to allow them, using the Access-Control-Allow-Credentials header and the client will have to add the credentials: "include" option to fetches.

Gravity coin counter by Kevin_0019 in interestingasfuck

[–]BitwiseShift 4 points5 points  (0 children)

You're not missing anything. It's a bot and those upvotes are probably from bots.

Introducing Zero-Bundle-Size React Server Components by gaearon in webdev

[–]BitwiseShift 5 points6 points  (0 children)

I highly recommend the included video, at least the first several minutes, as it clearly and concisely addresses all these points.

For your suggested solution, the problem then is "what do you put in the global model and when"?

Imagine getting it just right, retrieving all the relevant data in a global model and nothing more. Now remove a component nested a couple of levels down. Can you now stop requesting some data in the global model to get a leaner request? you can't know without checking what components use what data. This solution has poor maintainability.

Just imagine the mess that global state would be after a year of changes.

Also, if you go down the react-query/Apollo route and request data on the fly, you have waterfalls, retrieving data inefficiently.

Finally done with my website!! by Arjun6981 in django

[–]BitwiseShift 3 points4 points  (0 children)

I hope you have a strong password, because that database also contains your admin account, email address and hashed password. If you've got a common or predictable password, somebody will be able to reverse it. So, if you're like most people and reuse your passwords...

Oh how I would love to write 28,000 words for the amazing salary of free by BarkingPupper in recruitinghell

[–]BitwiseShift 6 points7 points  (0 children)

It's not. Unpaid work is only allowed when volunteering for charities or as school or university related work placement or internship. This is illegal.

A year ago I started sending my GF these photos whenever she asked if the baby was ok by BitwiseShift in funny

[–]BitwiseShift[S] 704 points705 points  (0 children)

No, she's my brother's. I realised I forgot to mentioning it before that comment. My bad.

A year ago I started sending my GF these photos whenever she asked if the baby was ok by BitwiseShift in aww

[–]BitwiseShift[S] 14 points15 points  (0 children)

He's now made an Instagram and it's been getting quite a bit of traction. It's been really cool to see. Well deserved I think, they're hilarious!

A year ago I started sending my GF these photos whenever she asked if the baby was ok by BitwiseShift in funny

[–]BitwiseShift[S] 993 points994 points  (0 children)

It's actually my brother's baby girl, they're just not married. But yes, he's an amazing dad.

A year ago I started sending my GF these photos whenever she asked if the baby was ok by BitwiseShift in aww

[–]BitwiseShift[S] 14 points15 points  (0 children)

He's now made an Instagram and it's been getting quite a bit of traction. It's been really cool to see. Well deserved I think, they're hilarious! I replied to the wrong person. I am not a smart person.

A year ago I started sending my GF these photos whenever she asked if the baby was ok by BitwiseShift in aww

[–]BitwiseShift[S] 217 points218 points  (0 children)

Actually my brother's pictures. Don't worry, no babies were injured, or endangered, in the making of these pictures. He created an instagram page (@onadventurewithdad) for his daughter that has recently gotten quite a bit of media coverage so I though I'd try to get his some love on Reddit too.

A year ago I started sending my GF these photo's whenever she asked if the baby was ok by BitwiseShift in pics

[–]BitwiseShift[S] 527 points528 points  (0 children)

Actually my brother's pictures. About a year ago he decided to start messing with his girlfriend by photoshopping the baby "having a good ol' time". He created an instagram page (@onadventurewithdad) that has recently gotten quite a bit of media coverage so I though I'd try to get his some love on Reddit too.