HNHacker News
TopNewBestAskShowJobs

sirn

3,953 karma · joined October 25, 2009

Contact: sirn@ogsite.net

Software developer living in Tokyo, Japan

Work: Oozou (BKK), Omise (BKK→TYO), Varnish Software (TYO), EnergyRoute Japan (TYO)

I run a small consulting business in Japan; feel free to email.

submissionscomments
sirn··on Show HN: We open sourced our new Mac developer setup script
I've worked on a project where its build script is reliant on the existence of Homebrew when a simple command -v would suffice. They have library paths, and everything hard-coded to Homebrew prefix. It has been such a colossal pain to modify all these scripts that I ended up installing macOS in a VM to build the project.
sirn··on Show HN: We open sourced our new Mac developer setup script
Ha, I also have something similar[1], but I use a mix of profiles and flavors. I have two profiles: pkg for installing packages and user for configuring user profiles. Profiles are then broken down further with flavors: dev for development packages, desktop for desktop packages and configurations, and so on.

I found it highly amusing that we're taking similar approaches for a lot of things: a wrapper function for sudo and fetch, and OS detection (especially the appending WSL suffix part). Mine is not as idempotent as yours, and having a per-package definition is still in my TODO list, though.

[1]: https://github.com/sirn/dotfiles

sirn··on Fixing the Logitech MX Ergo Trackball Mouse Buttons
I'm also using the MX Ergo, but I replaced D2FC-F (made in China) with D2F-01F (made in Japan). So far, it has been working great, and I love how it feels compared to the stock switch. The video linked in the article also mentioned (in the description) that D2F-01F may last longer electrically since it's micro-load rated (1mA instead of 100mA), so I guess I'm safe for a while (although it's only rated 1M mechanically).
sirn··on Why is Control Center on Monterey listening on ports?
I don't think IANA explicitly reserved .dev. It was made popular as a local dev domain by Basecamp's Pow[1] and Laravel Valet[2]. IANA only defines .test, .example, .invalid, .local, and .localhost as reserved (with .onion being the latest addition in 2015[3])

Though in this list, only .test and .example are marked as non-special and must be resolved normally by RFC 6761, and .local is reserved for mDNS by RFC 6762. In this list, .test would have been the most appropriate for Pow to use.

CydeWeys (Tech Lead of Google Registry) has commented on HN in the past that they did not anticipated people weren't following the best practices[4], which makes me think IANA should have given .dev the same treatment as .onion: by explicitly reserving them (but this is another topic to discuss).

[1]: https://github.com/basecamp/pow

[2]: https://github.com/laravel/valet

[3]: https://www.rfc-editor.org/rfc/rfc7686.html

[4]: https://news.ycombinator.com/item?id=24606714

sirn··on Why is Control Center on Monterey listening on ports?
> Though they don't provide additional citations

It's in their gTLD application for .dev[1]

> The mission of this gTLD, .dev, is to provide a dedicated domain space in which Google can enact second-level domains specific to its projects in development. Specifically, the new gTLD will provide Google with greater ability to create a custom portal for employees to manage products and services in development.

> Charleston Road Registry believes that given its intended use by Google, the .dev gTLD will best add value to the gTLD space by remaining completely closed for the sole use of Google.

[1]: https://gtldresult.icann.org/applicationstatus/applicationde...

sirn··on Please Shrink the Trackpad
For a(n easier?) comparison, the size of trackpad on MacBook Pro 16" (2021) is larger than iPhone 13 Pro Max (iPhone is few millimetre taller) and slightly smaller than Kindle Paperwhite (2019) or a Nintendo Switch non-OLED sans JoyCon. It's huge enough that they could almost fit the display of an old iPad mini on it.
sirn··on The Metal Age of Thailand and Ricardo's Law of Comparative Advantage
In the old model of metal age, metals are developed by a society that is hierarchical or militaristic (as development of metal is a very complex process with specialized knowledge and tooling). This old model cannot be applied to an archaeological site in Thailand (Ban Chiang / Ban Non Wat / etc.) due to evidences demonstrating absence of control over metal production in the region.

The research paper suggested that the region developed its metal age by trading rather than by any ruling entity, by applying Ricardo's Law to the distribution of metal artifact in the region.

sirn··on Tokyo’s 7-Elevens and convenience stores
There's a small village on a top of a mountain in Northern Thailand called Santi Khiri. Most Thai probably never have heard of its name or known of its existence (it has a very interesting history related to Kuomintang). There was no buses or whatsoever.

But of course, there's a 7-11 there.

sirn··on CSAM Detection Technical Summary [pdf]
You're right, the iCloud Photo is actually encrypted on transit and on the server, but the server has the decryption key[1]. However they've been doing server-side scan for iCloud since quite some times ago[2], which is why I think this technique in the article plus End-to-End Encryption could be better for privacy than the status quo.

[1]: https://support.apple.com/en-us/HT202303

[2]: https://www.forbes.com/sites/thomasbrewster/2020/02/11/how-a...

sirn··on CSAM Detection Technical Summary [pdf]
I can't edit anymore but I misunderstood the second layer. The second layer contains a single Secret Share (that can be used to reconstruct a decryption key after certain threshold) and an encrypted image information. User must upload multiple photos matching the initial CSAM database past certain threshold for any of them to be decryptable at all.
sirn··on CSAM Detection Technical Summary [pdf]
> Also, Apple is quite vague about whether the claim "Apple manually reviews all reports" means Apple employees can view all triggering content, even if it was never uploaded to Apple servers. (How would that work?)

From a quick read of the PDF, my impression is this Safety Voucher is more of an additional metadata generated before a photo is uploaded to iCloud Photo (as oppose to scan photo library to see if it matches and notify Apple narrative). The Safety Voucher is designed in a way that they could decide on the server-side if a photo is CSAM without requiring iCloud to have an ability to decrypt all photos. Safety Voucher comes in three layers:

- The first layer is generating a NeuralHash for a photo and derive a cryptographic header from it based on blind hash provisioned by Apple from a known CSAM NeuralHash (e.g. Apple pre-compute this table for each device). First layer is decryptable if the generated NeuralHash is a known CSAM. (Is it going to be a random data if NeuralHash doesn't exists in the table?)

- The second layer uses Secret Sharing[1] scheme (where a content is decryptable only if >n keys are present) using NeuralHash of a visual derivative as a secret share. Multiple visual derivative is generated for each photo, and certain amount of shares is required to decrypt the layer.

- After the second layer is decrypted, the file is readable.

One thing that doesn't makes sense is iCloud Photos are not currently End-to-End Encrypted, so Apple already have access to all photos. This scheme would only makes sense if they plan to introduce End-to-End Encryption for iCloud Photos (& iCloud Backups?) in the future.

In my opinion, if they were to enable E2EE for photos, this scheme would be slightly better for privacy than Apple having an ability to scan all photos on the cloud (e.g. they can't retroactively decrypt a photo that already has Safety Voucher uploaded to iCloud if the matching NeuralHash doesn't exists at the time of blind hash table generation), but significantly less than having E2EE and not having this system in the first place.

(As someone from a country that is known to abuse this sort of power, I'm not happy about this system existing.)

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

sirn··on A critique of Safari's influence on the web
I got a little curious on the statuses of these standards and went on a bit of searching.

- CSS contain (CSS Containment Module Level 2) - Editor's Draft[1]. First published in 2019. Not supported by Safari/WebKit.

- CSS offset-path (Motion Path Module Level 1) - Editor's Draft[2]. First published in 2015. Not supported by Safari/WebKit.

- CSS overflow-anchor (CSS Scroll Anchoring Module Level 1) - Editor's Draft[3]. First published in 2020. Not supported by Safari/WebKit.

- Resolution media queries (dppx) - W3C Recommendation since 2012[4]. Not supported by Safari/WebKit.

- :focus-visible (Selectors Level 4) - Editor's Draft[5]. First published in 2011. Not supported by Safari/WebKit.

- Touch Events - W3C Recommendation since 2013[6]. Supported by Safari/WebKit since 2010 (iOS 3.2). I assume the author meant Pointer Events[7] which became W3C recommendation since 2019, and supported since 2019 (iOS 13.2).

- BroadcastChannel - WHATWG Living Standard[8]. Blocked by privacy concern on WebKit side since 2020[9]. Initial support landed on WebKit trunk as of 2021-07[10].

- beforeprint/afterprint - WHATWG Living Standard[11]. Supported by Safari/WebKit since 2019 (iOS 13).

- Regex Lookbehind - ECMAScript 2018[12]. Not supported by Safari/WebKit.

- scrollIntoView (CSSOM View Module) - Editor's Draft[13]. First introduced as an update to CSSOM View Module in 2011. Not supported by Safari/WebKit.

- Screen Orientation API - W3C Working Draft[14]. First committed in wc3/screen-orientation in 2012. Not supported by Safari/WebKit.

- Date and time input types - WHATWG Living Standard[15], partial support by Safari/WebKit since 2012 (iOS 5) but no week/min/max.

- Service Workers - W3C Candidate Recommendation since 2019[16]. Supported by Safari/WebKit since 2018 (iOS 14.5).

- AbortSignal - WHATWG Living Standard[17]. Supported by Safari/WebKit since 2018 (iOS 11.3)

- Intersection Observer - W3C Working Draft[18]. First published in 2017. Supported by Safari/WebKit since 2019 (iOS 12.2).

- Client-side form validation - WHATWG Living Standard[19]. Supported by Safari/WebKit since 2017 (iOS 10.3).

[1]: https://drafts.csswg.org/css-contain/#contain-property

[2]: https://drafts.fxtf.org/motion/#offset-path-property

[3]: https://drafts.csswg.org/css-scroll-anchoring/#exclusion-api

[4]: https://www.w3.org/TR/css3-mediaqueries/#resolution

[5]: https://drafts.csswg.org/selectors-4/#the-focus-visible-pseu...

[6]: https://www.w3.org/TR/touch-events/

[7]: https://www.w3.org/TR/pointerevents/

[8]: https://html.spec.whatwg.org/multipage/web-messaging.html#br...

[9]: https://github.com/whatwg/html/issues/5803

[10]: https://bugs.webkit.org/show_bug.cgi?id=227924

[11]: https://html.spec.whatwg.org/multipage/timers-and-user-promp...

[12]: https://262.ecma-international.org/9.0/

[13]: https://drafts.csswg.org/cssom-view/#dom-element-scrollintov...

[14]: https://www.w3.org/TR/screen-orientation/

[15]: https://html.spec.whatwg.org/multipage/input.html#date-state...

[16]: https://www.w3.org/TR/service-workers/

[17]: https://dom.spec.whatwg.org/#abortsignal

[18]: https://www.w3.org/TR/intersection-observer/

[19]: https://html.spec.whatwg.org/multipage/forms.html#client-sid...

sirn··on About Godot4, Vulkan, GLES3 and GLES2
Vulkan on Godot on the Mac is using MoltenVK[1]

[1]: https://twitter.com/reduzio/status/1215284328390889474

sirn··on Sriracha hit revenue of $150M a year with no sales team or ad spend
Even though the origin of Sri Racha sauce is debated (even in Thailand), it was the recipe used by a small shop named "Sriraja Panich" that became known as the Sri Racha sauce in Thailand. The popularity of Sriraja Panich's recipe inspired other brands in Thailand to make a sauce with similar ingredients and taste. Only after then it became known as a type of a sauce.

Today, even though every sauce brand in Thailand has started producing a Sri Racha-type sauce, many Thais still only considered Sriraja Panich's sauce to be the authentic one.

sirn··on Bash PS1 Generator
I think that might be `git symbolic-ref` which doesn't work in detached HEAD state (e.g. when checking out a commit) whereas `git rev-parse --abbrev-ref` will print "HEAD". On the other hand, `git name-rev` will try to find the nearest named ref (including tags) and how far HEAD is from that named ref (e.g. master~1).

Internally, symbolic-ref resolve the ref in the same way as git branch, just without handling detached HEAD. __git_ps1 use a combination of rev-parse, symbolic-ref and git describe to provide a more interesting output for displaying state of the working directory.

To have the similar output for detached HEAD as git-status (e.g. "HEAD detached at fa0c4e1") then probably `git rev-parse --abbrev-rev` and `git rev-parse --short` should be used together. Unfortunately, while rev-parse can print multiple output in a single command, abbrev-rev and short cannot be used together. In such case, parsing `git status` might indeed be more suitable as it spawn only one executable instead of two.

Some porcelain commands do have --porcelain flag to ensure the stability of the interface, though (e.g. `git status --porcelain=v1`).

sirn··on Bash PS1 Generator
tput query a terminfo database and return an escape code suitable for that $TERM. sgr0 is the name for "reset" (e.g. "\033[0;10m" in ANSI). Using tput instead of escape code directly is better in a lot of ways. For example, it allows the shell script to be adaptive to the type of TERM it runs on (e.g. not outputting color codes at all if TERM doesn't support colors).

You can see what each tput commands are doing by running infocmp. Most TERM implement ANSI-compatible escape codes, but may prefer other escape codes for the same effect (e.g. try comparing `infocmp -1 ansi` and `infocmp -1 xterm` and `infocmp -1 screen`). You can see the entire list of these commands in terminfo(5) (`man 5 terminfo`) in Predefined Capabilities section.

sirn··on Bash PS1 Generator
You might want to use `git rev-parse --abbrev-ref HEAD` or `git name-rev --name-only HEAD` instead of `git branch`. Plumbing commands (such as rev-parse or name-ref) are generally more interface-stable to use in a script than porcelain commands (such as git branch) which are designed for interactive use where output may change depending on user environment and configuration.
sirn··on Where is the source code for the actual bootloader shipped with the Prusa Mini+?
I wonder if it's entirely unfair in this case. Custom firmware for 3D printers do not only brick the hardware, but can do real environmental damage (such as burning down the house[1][2]), so I don't think this approach is entirely unreasonable. It's not that uncommon to see someone modifying firmware to print material such as PEEK which requires 400c nozzle temperature, so this appendix could even be their legal protection for such cases (IANAL).

[1]: The most popular firmware, Marlin, has a feature called Thermal Runaway Protection which turned off the printer when it detected temperature has reached certain threshold. Prusa printers have TRP enabled by default, but some manufacture doesn't.

[2]: https://www.reddit.com/r/3Dprinting/comments/8ah96r/anet_a8_... this is about ANET A8, but flashing custom firmware with TRP disabled or with higher temperature limit may result in the similar situation (ANET A8 stock firmware don't have TRP enabled)

sirn··on Safari 15 on Mac OS, a user interface mess
They do use theme-color and only fallback to either page background color or header background color when theme-color is not present[1][2]

[1]: https://files.grid.in.th/z3ox7o.jpg

[2]: https://developer.apple.com/videos/play/wwdc2021/10029/

sirn··on Apple brings Safari web browser extensions to iPhone and iPad with iOS 15
Hmm, how did you do this? AFAIK, Safari extension on a Mac required to be bundled with a macOS application, and there's no way to install Mac apps on iOS. The one listed in the "More Extensions" link in Settings right now are the one that uses Action Extension which has been available for a very long time (and not the new Web Extension support).

(On the other hand, I've seen 1Password people got their Web Extension version working on iPadOS, and it looks amazing[1])

[1]: https://twitter.com/firebeyer/status/1402085111424708612

sirn··on Apple, Mozilla, Google, Microsoft form group to standardize browser plug-ins
Plugin historically referred to NPAPI (Netscape Plugin API), and later PPAPI (Pepper Plugin API) which were used for Flash, Silverlight and such. This historical reason was what distinguished between plugin and extension. The practice still continues today with H264 and Widevine even though they no longer uses NPAPI/PPAPI.
sirn··on Firefox Release 89.0
https://files.grid.in.th/vKeXJQ.png

It looks close, but details and behavior are a bit off. For example:

- Firefox context menu does not respect system's dark mode

- Different horizontal and vertical margins between items

- Different font rendering (e.g. text looks bolder)

- Different right caret icon

For behavior difference, for example: when navigating sub-menu items, macOS uses cursor velocity and cursor direction to determine if user is trying to go to submenu and immediately dismiss it if user is not. Firefox context menu uses a delay to archive similar effect. (To test this: open a sub-menu in a context menu, then move the cursor up. macOS native menu dismiss immediately, where old Firefox has a small delay before it is dismissed.)

sirn··on Phacility is winding down, Phabricator no longer actively maintained
It's similar, but Phabricator patches are submitted via API to Differential instead of to a mailing list. Phabricator provides Arcanist (arc) to interact with its API from command-line, but some projects has their own tooling around it (e.g. Mozilla uses moz-phab as a wrapper around Arcanist).

Though I think the main selling point of Phabricator is its issue tracker (Maniphest). It is very, very, very nice. May be even the best in class. The company I'm working for switched to JIRA and we still miss Phabricator's.

sirn··on Apple Music Announces Spatial Audio and Lossless Audio
Second about this. I thought Plex would be overkill at first, but Plex is fantastic for streaming personal music library over internet (especially with Plexamp). One of its best feature IMO is you can make it automatically transcode music to Opus when streaming over cellular or download them locally as-is, saving all headaches of syncing to iDevices.
sirn··on Apple Design Resources
License agreements from the package:

> Your use of Symbols obtained from Apple’s SF Font is limited to creating mock-ups of user interfaces for software products running on Apple’s iOS, iPadOS, macOS and tvOS operating systems and your use of Symbols obtained from Apple’s SF Compact Font is limited to creating mock-ups of user interfaces for software products running on Apple’s iOS, iPadOS, macOS, tvOS and watchOS operating systems.

So likely not.

sirn··on Praise for Alpine Linux
It depends on the level of familiarity you have with Linux distros. Alpine is simple, but it might be a bit hard to understand without first understand what each component does (e.g., initramfs, GRUB). In that case, installing a Linux distro via chroot method and get it up running as a desktop might be a better place to start. Alpine simplicity would makes sense after then.

Otherwise, I'd recommend installing Alpine in a VM and play with it for a week. On a lower level, alpine-base[1], alpha-baselayout[2], and alpine-conf[3] might be a point of interest. alpine-conf contains several scripts for bootstrapping the entire system (e.g. setup-disk/setup-bootable/update-kernel). Following what these scripts does can get very far into understanding how a distro is put together.

[1]: https://git.alpinelinux.org/aports/tree/main/alpine-base/APK...

[2]: https://git.alpinelinux.org/aports/tree/main/alpine-baselayo...

[3]: https://git.alpinelinux.org/alpine-conf/tree/

sirn··on Praise for Alpine Linux
Alpine can load an overlay tarball (apkovl.tar.gz) on boot, of which it may contain a script to bootstrap a system (e.g., /etc/local.d/00_bootstrap.start) or an /etc/apk/world file that indicate a package to install on boot. The requirement is to be able to put a file named hostname.apkovl.tar.gz in one of the mounted disk(s) (can also be placed in the same disk as the boot disk itself). [1][2]

[1]: https://wiki.alpinelinux.org/wiki/Alpine_local_backup

[2]: https://wiki.alpinelinux.org/wiki/Qemu#Live_mode (would be similar to this)

sirn··on Deep Diving into the Strengths of FreeBSD
On the nativeness, as I understands:

ZFS relies heavily on Solaris VFS API, which is inherently different from both Linux's VFS and FreeBSD's VFS implementation (e.g., behavior of vnode[1]). Both FreeBSD and Linux implements this VFS API with a layer called Solaris Porting Layer (SPL).

In the original Illumos-based FreeBSD ZFS, this SPL layer was implemented as a kernel module (opensolaris.ko). OpenZFS originally maintain this shim in other repo, but later incorporate this shim into its codebase. FreeBSD port of OpenZFS involved importing SPL layer from FreeBSD tree into OpenZFS. On this part, there's not much difference in nativeness of the port.

However, this SPL layer also serve the purpose of adding one degree of separation between GPL code and CDDL code in order to comply with GPL in order to prevent ZFS code from becoming a derivative of the Linux kernel. The shim in OpenZFS is in three licenses; the Linux part of SPL is GPLv2, the FreeBSD part is 2-BSD, and the part that interacts directly with ZFS code is CDDL.

This is the area where FreeBSD can be more native with regarding to ZFS. Since CDDL is compatible with BSD license, FreeBSD kernel and its userland can integrate directly with ZFS without any licensing issue, e.g., FreeBSD bootloader can simply linked against ZFS, whereas GRUB2 must reimplement a part of ZFS in order to do probing.

[1]: https://wiki.freebsd.org/AndriyGapon/AvgVfsSolarisVsFreeBSD

sirn··on Deep Diving into the Strengths of FreeBSD
GRUB2 works fine with /boot on ZFS, however GRUB cannot detect ZFS dataset with native ZFS encryption (see bug[1]). The best KB right now is probably OpenZFS documentation[2] and Arch Wiki[3].

I've been using ZBM since its inclusion in void-packages. It already does everything I wanted it to, but I don't think its usage is widespread outside Void Linux community just yet. Being dependent on Dracut might be one of the reason why (I believe Arch is still using mkinitcpio). There's installation instruction for Void and Debian Buster on ZBM GitHub[4]. I used to have a separate ZBM root for void-musl and void-glibc which worked quite well (though I'm now running only void-glibc due to Nvidia).

[1]: https://savannah.gnu.org/bugs/?func=detailitem&item_id=58270

[2]: https://openzfs.github.io/openzfs-docs/Getting%20Started/ind...

[3]: https://wiki.archlinux.org/title/Install_Arch_Linux_on_ZFS

[4]: https://github.com/zbm-dev/zfsbootmenu/wiki

sirn··on Deep Diving into the Strengths of FreeBSD
I used Linux as a daily driver until the end of 2020 (Void Linux + ZFS + ZBM), but now running M1 Mac as a primary machine. I'm still using Linux regularly though (gaming via Proton, which is why I'm not running FreeBSD on a desktop yet).
← PreviousPage 4 of 29Next →