HN user

nousermane

1,311 karma
Posts0
Comments227
View on HN
No posts found.

writing "return condition" instead of "if condition then return true else return false end"

using the conditional-value ("ternary") operator in any capacity

Looks like author of some code I had to comb through recently, maybe had that among guidelines. Said code was replete with:

  if(function_that_returns_boolean()){
    return true;
  }else{
    return false;
  }
...and...
  if(foo()){
    return true;
  }else{
    if(bar()){
      return true;
    }else{
      return false;
    }
  }
Fascination of Awk 3 years ago

That is quite nifty implementation of reverse HTML escaping. But in python that could be done with much less work:

  import html
  print(html.unescape(foo))
And the best part - you don't need to debug/update the (g)sub list every time you stumble upon new weird &whatever; too. And there are a lot of those out there:

https://www.freeformatter.com/html-entities.html

tried qemu, and spent many days trying to figure out the correct set of parameters

It's really not that hard, once you get used to it. Or, if you rather not spend that precious time, there is a GUI tool that would configure those parameters for you:

https://virt-manager.org/

Bonus: once started with virt-manager, run "ps ax | grep qemu", et voila - you have your qemu parameters, ready to copy-paste, should you wish to run exact same VM later from a script, or something...

Unlike RAM, where you always get exact power-of-2 number of bits per chip, modern flash storage normally ships with defects, plus error-correction codes to deal with those.

Number of defects vary. Chips coming from the same factory, even same batch, are likely to have different number of defects, and will be binned accordingly.

Devices with larger (but manageable) number of defects will simply have larger ECC region reserved - leaving smaller space to show to host computer. OP's new USB stick is like that, that's it, I reckon.

In addition to tax-dodging, or selling off-the-books, there is one other, small legitimate reason for a vendor, to avoid card payments:

Most banks/payment processors would charge a fixed amount per small transaction. Amount varies a fair bit, but as an order of magnitute, say - €0.15 or something like that. This means customer that bought cup of coffee for €1.50 and insists on paying with a card, will cost vendor whooping 10% extra (it is not allowed for vendor to pass on card transaction cost to customer).

For a larger purchase, €30, €60, and more - transaction charge is negligible, naturally.

You're right, but I'd argue this problem is already here.

Thanks to glaciers melting, earth rotation is (temporarily) accelerating. Because of that, positive leap seconds, regular before, didn't happen since 2017 - so there could very well be (recent) software out there that has that code-path broken, and nobody noticed yet.

And due to exact same geophysical effect we might see a negative leap second - something that never ever happened before. What are the odds that every single piece of software gets that one right?

TAI - atomic clock, ignores earth rotation.

UT1 - based on Earth's rotation only, strictly 86400 seconds per day; length of each second varies; takes a heck of a lot of effort (and time) to measure accurately.

UTC - has same length of a second as TAI, but (for now) tracks UT1 to a precision of +/- 1 second. To achieve that, can have days that are 86399, or 86400, or 86401 seconds long.

None of 3 is planned for scrapping. The only change discussed in TFA is to fix UTC day to 86400 seconds (at cost of letting it drift further away from UT1).

Very misleading article indeed.

I have to add that GPS messages include TAI-UTC offset. That means that user of even old, non-internet-connected GPS receiver that didn't have any software updates in a decade, will still read out exact UTC time with cumulative leap seconds correctly applied.

Also, typical lead-free solders oxidize in air at their soldering temperature much more readily than near-eutectic Pb-Sn at its respective soldering temp.

That oxide film tends to interfere pretty badly with wetting of surfaces being soldered. In other words - it's much easier to end up with a "dry" joint - even with adequately increased temperature - unless better and/or more flux is used.

Perl has some weird quirks - dollar-variables vs. percent-variables vs. at-variables (and sometimes you can "cast" one into other), round-brackets where most others have squiggly (and vice-versa)...

But once you get over that, it's a great language. First-class regex, -pine options. A lot to love about it.

Ah, yes. The classic "all our customers are morons" approach, with no opt-out for those 0.1% who, in fact, are not. Very typical among ISPs/Telcos.

Where I am, we used to have a different, "nerdy" ISP [0], where customer was allowed to bring their own modem; they also provided real IPv4/v6 dual-stack since forever, easy to request a /29, tech-support that's realistic to reach, and staffed with people who know what they are talking about, no bulk-firewalling port-25, etc... All for a modest 2x price increase over market average. Alas, they're out of business now.

[0] https://en.wikipedia.org/wiki/Xs4all

Is it actually in stock at this price? Where I am, local price tracker, tweakers.net, also shows some listings for ~100 euro, but if you click through to the seller's website, it says there "not in stock, delivery date unknown". If you limit to what you can actually buy, it's ~200 euros, and even that - often with a week or two of lead-time.

[OTR] would probably be a goto for encrypting instant messages. But both that & PGP require a 3rd-party client (pidgin/adium/etc...), if user wants to retain at least some usability.

And nowadays, every popular IM network wants 3rd-party clients off their net at all costs. Signal is on the better side of the spectrum here. While they explicitly say they don't support non-official clients connecting to the official network, this isn't rigorously enforced. WA, on the other hand, would permaban your whole account if you even so much as try to use 3rd-party client.

[] https://en.wikipedia.org/wiki/Off-the-Record_Messaging

plenty of people run a modern Bash out of their home

Ah, got it. Another failure mode. There is a /bin/bash, but it's an ancient, crummy thing, that is difficult to upgrade. MacOSX does this, so users paper this over by installing a private copy as ~/bin/bash. Thank you.

Driver in question is cfg80211. Majority of popular wireless cards use it.

DoS is the only publicly known exploit, right now. There is understanding that RCE is possible with additional specialist work.

Local packet injection is an implementation detail of the first public PoC. There are other implementations of the same exploit, that deliver packets over the air instead. Including one that runs on ESP32, and attacks unmodified Linux nearby:

https://github.com/jo-m/linux-wifi-ota-crash

I'm not a fan of rust either, not by a long mile. But current kernel approach to memory safety is a complete, utter, demonstrated failure. Look at last week's CVE-2022-41674:

https://seclists.org/oss-sec/2022/q4/23

This is a catastrophic bug, that (after some work on developing an actual RCE) lets anybody within wifi range to get root on your laptop (or phone, or access point). And all it took is this one line:

https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wir...

We've all been repeating the "1000 eyes - all bugs are shallow" mantra for far too long. This one was in the mainline for more than 3 years, and nobody noticed. How many more are lurking there?