HN user

aloisklink

101 karma
Posts0
Comments30
View on HN
No posts found.

2 letter TLDs/country-code TLDs, are determined by ISO 3166-1 alpha-2 country codes, and having a country code doesn't necessarily mean a country or a state.

There are a bunch on there that I wouldn't consider states, e.g. both UN/EU are exceptionally reserved and have `.un` and `.eu`. Antarctica also has `.aq`.

The Heard Island and McDonald Islands has `.hm`, and it's not a state (since it has no population) but I guess it is controlled by Australia.

Actually, Diego Garcia (the British/American military base) already has it's own ISO 3166-1 alpha-2 code, DG: [1]

It's "Exceptionally reserved" "at the request of International Telecommunication Union (ITU)".

Although my gut feeling is that if the deal happens, Mauritius would probably ask to exceptionally reserve `IO` as well. Still, I'm not sure if I'd risk using a `.io` domain since it's not guaranteed.

[1] https://www.iso.org/obp/ui/#iso:code:3166:DG

The owners of `queer.af` thought that AF only meant “as f*ck”, without realizing that AF also happens to the be the ISO 3166 code for a country controlled by the Taliban, who didn’t like their domain name [1].

Brits that had `.eu` domains lost their domains due to Brexit [2] (unless they had some other EEA ties).

And if the Chagos deal goes ahead [3] and the British Indian Ocean Territory ceases to exist, then all `.io` domains might disappear too (although considering that `.su`/Soviet Union domains are still a thing, they probably would have stayed around).

[1] https://www.404media.co/taliban-shuts-down-queer-af-domain-b...

[2] https://www.gov.uk/guidance/registering-and-renewing-eu-doma...

[3] https://www.bbc.com/news/articles/ce9m47y1ez2o

You can try looking at this manga posted by a Japanese person that was detained for marijuana possession https://xcancel.com/kime_neko/status/1634511023167381504. It's in Japanese, but you can use a machine translator and/or look at the drawings.

The facilities and food look slightly better (maybe because it's a detention centre in Tokyo), but it mostly matches. Although the mangaka seemed to have a much more positive outlook on it, probably because they could read all the Japanese books they wanted and speak to their cellmates in Japanese.

Not for the ones you buy in Japan, since those are legal.

But, it's not unheard of to get randomly stopped by the police and searched, especially in touristy areas like train stations. Unless you're a Japanese citizen, you have to show ID, and although the searches are optional, most people agree to them.

For customs, usually a few people from each plane are searched.

Anecdotally, if you're a tourist, they're usually looking for medicine that was legal outside of Japan, but illegal within Japan, with small amounts leading to being detained for 23 days (like in this blog post). And if they decide to prosecute you, you'd probably get a suspended sentence (so no prison time), but you'd get deported and a temporary ban from coming back to Japan.

You can still easily buy it here, but the over-the-counter pills are always mixed with other ingredients to make it more difficult to convert them into amphetamines.

E.g. Contac 600 Plus can be found in basically all drug stores and it has 120mg of Pseudoephedrine, 100mg Caffeine, 8mg Chlorpheniramine, and 0.4mg of Belladonna Extract. It sounds like it'll actually be illegal to import into Japan, since 120/(120 + 100 + 8 + 0.4) is over 10%, but I've previously just walked into a drug store and bought a packet.

The author mentions it in a YouTube video: https://www.youtube.com/watch?v=Q2epTf2IW1g (at the 2:20 mark).

But essentially, somebody else sent her a package with something illegal in it that she didn't ask for. The police took her passport for a few months and searched her house. After a few months, she got her passport returned to her, she left Japan temporarily, but when she came back, they arrested her "to ensure [she] wouldn't flee while they finished the investigation".

She also mentioned it was "the most normal type of thing you can think of"; it might have been something like pseudoephedrine/Sudafed. That's a common over-the-counter drug in other countries but it's very illegal here in Japan (unless it's under 10%, or you buy it from Japan)!

Edit: Importing pseudoephedrine above 10% concentrations is illegal, but you can legally buy some higher concentrations over-the-counter while in Japan.

At least in Japan on iOS, they have their own app, and it’s great.

You can find a seat first, then order directly from your seat, for delivery to your seat (helpful since some McDonald’s in Japan are really busy, and are very vertical, so you might need to climb up some two/three floors to find a seat!).

You can even order McDelivery and they’ll deliver McDonald’s to your house on McDonald’s branded mopeds.

It’s also been pretty fast, even on a slow internet connection.

The only two problems I’ve had with it are:

- Although the menu and the rest of the app is translated to English, sometimes coupons are only in Japanese, and not translated to English (I’m guessing these might be store-specific) (although it’s easy enough to translate that using your phone’s translator) - I’ve had Apple Pay occasionally be down and fail to work, which forced me to redo my whole order, then realize that Apple Pay is still down, then do my entire order again with a different payment method. Although it’s only happened twice a few months ago, so it could be something that they’ve already fixed (or I’m quite unlucky).

Edit: Forgot to add, but no issues like what basch seems to experience with their country’s McDonald’s app. The Japanese one always gives me a sorted list/map view of my closest McDonald’s to pick from, with any favourites marked at the too.

I think there are two slightly different issues here!

1. SVGs generated by Mermaid use the SVG 2 features, but other than browsers, most libraries only support SVG 1.1 features, i.e. <https://github.com/mermaid-js/mermaid/issues/2102>, which is what the other comment mentioned.

2. Mermaid requires a browser layout engine to render the diagrams (your issue), i.e. <https://github.com/mermaid-js/mermaid/issues/3650>. This is something I also really want to fix (I maintain the [`mermaid-js/mermaid-cli`][1] project and we need to use Puppeteer/Headless Chrome to render mermaid diagrams, which isn't ideal.) However, I don't think this would be easy, since we'd need a browserless tool that supports a browser-like layout engine (although I'm hoping that [Servo][2] might eventually be able to support it).

And if you do want to do headless renders of Mermaid diagrams, I'd recommend using (or adapting, since the code is all MIT licensed and I'm not aware of one that uses Selenium):

- <https://github.com/mermaid-js/mermaid-cli>, which uses Puppeteer as the headless browser API.

- <https://github.com/remcohaszing/mermaid-isomorphic>, which uses Playwright as the headless browser API.

And make sure that whatever server is doing the headless renders of Mermaid diagrams has all the correct fonts installed!

[1] https://github.com/mermaid-js/mermaid-cli

[2] https://servo.org/

POSIX does actually define what a "text file" is, but the definition is a bit unusual:

See https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1...

3.387 Text File

A file that contains characters organized into zero or more lines. The lines do not contain NUL characters and none can exceed {LINE_MAX} bytes in length, including the <newline> character.

So, if you have some non-printable characters like BEL/␇/ASCII 0x07, that's still a text file.

(and I believe what bytes count as a valid character depend on your `LC_CTYPE`).

But the moment you have a line longer than {LINE_MAX} bytes (which can depend on which POSIX environment you have), suddenly your text file is now a binary file.

I was at Fukushima Daiichi on Monday, and they explained that they only want to take a few grams of the melted material to test the composition of the melted fuel/debris, e.g. what elements are in it.

Even just planning to remove all of the melted fuel is a long way away.

I can't remember if they were talking about Unit 1 or Unit 2, but from what I understood is that due the collapsed rubble above/around the reactor, they only have a very narrow opening, which means they've struggled to use larger robots.

And I believe the robot operating centre is a bit of a distance away from the reactors too (probably so that the robot operators don't need to wear protective equipment).

What they need is a sort of "anteater-tongue machine" that just will try each crevice until finding the correct path.

I think the problem is that once you get through all the debris, there's a big cavern. Hence why they're using some sort of crane robot on a rope (it reminds me a bit of a [claw machine game][1]).

[1] https://en.wikipedia.org/wiki/Claw_machine

Weirdly, enough, golang is one of the only programming languages that actually has built-in support for a cross-OS config dir location: [os.UserConfigDir()][1].

I don't really ever program in golang, but whenever I write a Node.JS/Python tool that does need a user-global config file, I just write my own implementation of it:

  function userConfigDir() {
    switch (process.platform) {
      case 'darwin':
        return `${os.homedir()}/Library/Application Support`;
      case 'win32':
        if (process.env['APPDATA']) {
          return process.env['APPDATA'];
        } else {
          throw new Error('%APPDATA% is not set correctly');
        }
      case 'aix':
      case 'freebsd':
      case 'openbsd':
      case 'sunos':
      case 'linux':
        return process.env['XDG_CONFIG_HOME'] || `${os.homedir()}/.config`;
      default:
        throw new Error(`The platform ${process.platform} is currently unsupported.`);
    }
  }
[1]: https://pkg.go.dev/os#UserConfigDir

You should try the Moondrop Space Travel, you can buy them for USD 24.99 on Amazon.

- Moondrop is a pretty well known brand in the ChiFi (Chinese Hi-Fi) space.

- They support AAC so they even have good audio quality on Apple/iPhone devices (most cheap earbuds only use cheap Android codecs).

- Normally, their latency is pretty high, but they do have a low-latency mode in case you ever want to play games + take a call.

- It's Bluetooth 5.3 and communicates directly to each earbud (e.g. if you want, you can only use one at a time).

- And, they have active noise cancellation that's surprisingly good (in fact, it's amazing for $25!).

IMO, the main downsides are:

- Their app is meant to be horrible (I didn't even bother to install it). Not a big deal, unless you want to play around with EQ, customizing what the touch controls do, or upgrade the firmware.

- There's no way to control the volume via touch controls (although maybe the app allows you to change this)

- Even though it supports Bluetooth 5.3, I don't think it supports Bluetooth LE Audio and the LC3 codec.

These earbuds are probably completely uneconomical to recycle, but at least at $25, they probably didn't have too much of an environmental impact when they were created (assuming that the cost of the item is roughly correlated with the environmental impact of the item).

One reason might be that `text/*` files follow the POSIX standard for text files [1], where no lines can exceed `{LINE_MAX}` bytes in length (and `LINE_MAX` depends on your OS).

I don't believe the YAML spec has any rules on how long lines can be, so this means that some files won't technically be text files. (and some UNIX tools line-based tools might not work correctly on them).

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1...

Unfortunately, they're not great to use with a phone in your pocket, since then the motion of walking around will adjust the knob and change the volume.

Although, come to think of it, I could probably just glue the knob into a fixed −10 dB of attenuation and then use software volume control to change the volume.

I have also noticed that those passive inline volume knobs tend to adjust the right and left channels by different levels, especially with low-impedance outputs like IEMs, but that might because the ones I've bought cost ~US$2 from AliExpress.

I could probably also fix the issue by buying a worse/less-powerful USB-C to 3.5mm DAC. The official Apple one is pretty well liked by the audiophile community, since it's powerful for the price, which is great if you have high-end headphones, but horrible if you have earbuds/IEMs.

Weirdly enough, the same Apple USB-C to 3.5mm DAC is much quieter on Android, since it defaults to a low hardware volume on the DAC, and Android then only uses software volume control to lower the volume, see https://issuetracker.google.com/issues/242221770.

I've had the same issue with some wired IEMs on iOS, using Apple's official USB-C to 3.5mm adaptor. I even have the EU model A2155 of the USB-C to 3.5mm adaptor that's supposed to have half the power of the US model.

What I found that helped was to create a custom Shortcut that "Set Media volume to 1%". iOS reports that this is 48 dB when playing pink noise. I managed to hit 47 dB when dragging to volume slider on iOS below 1%, but the Shortcuts app only seems to support integer percentages.

In my case, even the 1% volume level was too high in a quiet room, but some apps have a custom EQ setting that you can use to lower the volume further. E.g. if you're using Apple Music, you can go to Settings -> Music -> EQ and pick "Loudness" to lower the volume further.

The Pixel 6 and Pixel 7 apparently does have the hardware/software needed for Suica, even on non-Japanese editions of the phone.

However, it's blocked by Google in software depending on the device SKU (maybe because Google doesn't want to pay licensing costs?). If you have a rooted Android phone, you could bypass this check, see https://github.com/kormax/osaifu-keitai-google-pixel.

Hopefully it means that a future version of the Pixel will officially support it world-wide, but who knows. Japan has one of the highest rates of iPhone usage in the world, so there's not much incentive to support Android users.

That's pretty much it. All modern browsers come with CSS layout functions [1], even Internet Explorer did! Pretty much every other Web API can be implemented in Node.JS using something like JSDom [2], but the CSS layout engine is the main missing feature. And the creator of JSDom estimated it would take 3-6 months of full-time work from a talented engineer to implement something like this [3], so this might take a while.

---

Just to give you an idea of how hard this would be, Mermaid let's people use custom fonts, with fallbacks, so diagrams can look quite different depending on what font people have installed.

The current default font is Tahoma [4], which is owned by Microsoft, so Linux desktops usually render the diagrams slightly differently than on Windows/MacOS desktops.

People can also have different default font size in their browser/OS settings, and that will affect things too.

Finally, you also have things like ClearType [5], where the text is rendered differently depending on the sub-pixel arrangement of your monitor!!

I think we could get a basic version that partially works by implementing only a subset of the layout functions and hard-coding one specific font in, but even that would still be a fair bit of work.

[1] https://drafts.csswg.org/cssom-view/#dom-element-getbounding...

[2] https://github.com/jsdom/jsdom

[3] https://github.com/jsdom/jsdom/issues/1322

[4] https://en.wikipedia.org/wiki/Tahoma_(typeface)

[5] https://en.wikipedia.org/wiki/ClearType

I'm one of the maintainers of the mermaid-cli project, and unfortunately, no.

Mermaid needs a browser's layout engine to run properly [1], but I haven't yet seen a library that will help us without puppeteer.

And yep, NPM (or another Node.JS package manager) is still needed for installation. I was working on trying to bundle all of mermaid-cli's dependencies (aka Node.JS, puppeteer) into one massive single-file exe last weekend, but it's seems we're blocked by missing features in other packages [2].

If anyone has any ideas on how to implement these things easily, feel free to help-out :) I'm also not a big fan of puppeteer, so I'd love to see a way to go without it.

[1] https://github.com/mermaid-js/mermaid/issues/3650

[2] https://github.com/mermaid-js/mermaid-cli/issues/467#issueco...

Even better, you can use [C99 Flexible array members][1], e.g. something like:

    struct KeyedEntry {
      struct Entry entry;
      char key[]; // flexible array member
    };
It's not too much more useful when just using `char`, but for other data types, it's a bit cleaner, since it handles alignment/padding better.

[1] https://en.wikipedia.org/wiki/Flexible_array_member, or https://beej.us/guide/bgc/html/split/structs-ii-more-fun-wit...

_Edit_: Something like this might not be suitable for the author, since they did mention how they wanted each `struct` to have a fixed size.

If you're installing a command-line tool globally, I usually go for the system package manager (e.g. `apt` on debian), or `pip` if I want a newer version. With pip, make sure to use the `--user` flag so things aren't installed with root.

If you're writing Python code, `poetry` has been the least bad package manager in my experience. It has a lock-file, so it should help avoid supply-side attacks (like the PyTorch one from a few days ago [1]), and it means your local environment and CI/CD environment should have the same packages installed.

I'd also recommend setting the [`virtualenvs.in-project`][2] setting to `true`, to store the `.venv` in the same folder as your code, so that when you delete your code, all of the downloaded packages get deleted too. Otherwise they'll just stick around in your user directory and use up a lot of disk space.

[1] https://pytorch.org/blog/compromised-nightly-dependency/

[2] https://python-poetry.org/docs/configuration/#virtualenvsin-...

If you think about it, isn't buying insurance pretty similar (especially if you pay extra for really rare insurance policies, like lightning strike insurance).

You're essentially making a bet with your insurance company that xxxx will happen. Just like with the lottery, the expected monetary value of insurance is always negative (it has to be, otherwise the insurance company won't make money), but the utility value of that insurance is different for each person.

E.g. for me, insurance on a phone doesn't make sense, since I easily buy a another cheap phone if mine breaks. But for somebody with less money, those few hundred dollars might have a much higher utility.

DRM too is also a pain.

The new Alder Lake CPUs apparently breaks a bunch of games, since their DRM thinks that the new Intel efficiency-cores are a second PC trying to play on the same license.

Some games will only work if you upgrade to Windows 11, and all games should work if you find a BIOS option and enable it, but only some CPUs support that BIOS option.

Source: https://arstechnica.com/gaming/2021/11/faulty-drm-breaks-doz...

And there's also all the other older horror stories of DRM, like the Denuvo DRM adding a huge performance hit on some games. Or not being able to play your offline single-player games at all, since the Denuvo DRM servers have temporarily offline due to a DNS issue.

(Disclaimer, despite all the issues, I do personally prefer PC gaming over console gaming, but I'm biased that I already have a powerful PC for CUDA/C++ programming and development, so I've already spent a bunch of money and time into PCs already).

There's also the [Steam Link app][1], if you have an Android TV.

[1] https://play.google.com/store/apps/details?id=com.valvesoftw...

You just need to install the app on your Android TV/TV box, and if you've got a fast intranet connection, you can stream Steam games from your desktop/laptop PC via your Android TV (it also works on Android tablets/phones, but you'd probably need a high-end WiFi router).

The input latency might hurt for action games, especially since TVs tend to have pretty bad latency already compared to computer monitors. And, loads of Android TVs aren't very powerful; I've seen quite a few struggle with even the Netflix app, so I doubt streaming 4K 60FPS games with low latency will work well.

Honestly, in the case of a shared computer, I wouldn't recommend even using a password.

A lot of employers put monitoring software on their computers, and have keyloggers that can record your passwords. It's probably illegal for them to use the passwords, but I have heard horror stories where employers secretly log into their worker's social media accounts.

I'd recommending buying a U2F or FIDO2 security key, and creating a ed25519-sk or ecdsa-sk SSH key, see: https://github.blog/2021-05-10-security-keys-supported-ssh-g...

Basically, the SSH key is stored on the hardware key, and for every single git pull/git push you need to do, you must have the security key plugged in. If you're worried about forgetting the key and leaving it plugged in, you could add a password to the SSH key as well, so you're doubly protected.

GitHub mentioned this in their blog-post: https://github.blog/2020-12-15-token-authentication-requirem...

Tokens offer a number of security benefits over password-based authentication:

- Unique – tokens are specific to GitHub and can be generated per use or per device

- Revocable – tokens can can be individually revoked at any time without needing to update unaffected credentials

- Limited – tokens can be narrowly scoped to allow only the access necessary for the use case

- Random – tokens are not subject to the types of dictionary or brute force attempts that simpler passwords that you need to remember or enter regularly might be

I pretty much do the same thing, I just copy-and-paste a PAT from my password manager when I need it on VMs. The big benefit to us is that PATs are "limited", and mine only has Git repo access, so unlike my password, it can't:

- Delete repos

- Edit my GitHub organization

- Share my private repos with other users

- Add/remove SSH keys from my account

There's always the chance that a software you install on your VM would contain a keylogger (e.g. NPM/PyPI malicious libraries), so limiting the damage that your credentials can do is always a good thing.

Commercial spaces and some houses in the UK already have 12V DC lighting and sockets for spotlights using the GU5.3 socket. It lets you have smaller and cheaper light-bulbs.

They're not great to have as a renter, though; many of the AC/DC converters were designed for Halogen light-bulbs, and have a minimum wattage requirement, so the more power-efficient LED light-bulbs don't work. Plus, since the fittings are less common than E27, the choice of light-bulbs is much lower.

If solar power and home electric storage batteries become more common, we might start having DC run directly into houses, to avoid the DC/AC conversion from the battery, then AC/DC back to computers/light-bulbs/TVs. But that seems years away!

P.S. smart light-bulbs need to have individual micro-controllers if you want to have colour control. I rarely use the funky colours like green/blue, but I do love being able to go from white light in the morning, to a warmer/orangish light at night.

The funny thing is, Estonia already has this feature in their ID cards (although, as I'm not Estonian, I'm not sure how often people actually use this feature).

https://learn.e-resident.gov.ee/hc/en-us/articles/3600006244...

Their ID cards can cryptographically sign documents/anything using a PIN that only the user should know, so even if the ID card is stolen, it still can't be used to sign documents/messages.

The problem is, the certificate (public key) purposely contains the full-name/public personal ID code, so that people can prove who (and which ID card) signed the message.

I'm unsure if making the photograph public was purposeful;, the Wikipedia article is quite vague (it says that "personal data" is publicly associated with your certificate, but I can't find whether photos are included under "personal data" on the English language government site).