HNHacker News
TopNewBestAskShowJobs

ekimekim

2,338 karma · joined November 9, 2012

Programmer, gamer, chaser of random interests. github: https://github.com/ekimekim
submissionscomments
ekimekim··on Go and my realization about what I'll call the 'Promises' pattern
It's been a while since I did much Go, but I think you can handle this cleanly by making one channel per task, and having an array of channels similar to the array of promises. Each channel takes that task's result, then closes. The caller waits on each channel in sequence.
ekimekim··on FCC wants all phones unlocked in sixty days, AT&T and T-Mobile aren't so keen
> You cannot go to a AT&T store to buy a phone and then use it on tmobile’s network.

Why not? You're paying them for the device. Why should they have a right to stop you using it how you want? Imagine if buying a car also came with a requirement to only use the dealership's petrol stations for the first year.

ekimekim··on Amazon tells employees to return to office five days a week
I joined a company in late 2020 that had gone remote at the start of the pandemic, and this crossed my mind. The deciding factor for me? The founders had since moved to different locations across the US. That put their money where their mouth was more than anything.
ekimekim··on We're not going to run out of new anatomy anytime soon
Well based on compiler bootstrapping techniques, it seems the solution is simple: Start by hand-assembling the most basic RNA life, then run each step of evolution in sequence. All you need is the DNA (and know the living conditions) of every single organism between single-celled organisms and a modern human.
ekimekim··on Don't defer Close() on writable files (2017)
Python handles this case by raising the new error but including a reference to the original error. By default, the formatted error shows both:

    >>> mylist = []
    >>> try:
    ...     first = mylist[0]
    ... finally:
    ...     inverse_length = 1.0 / len(mylist) # imagine this was something more complex
    ... 
    Traceback (most recent call last):
      File "<stdin>", line 2, in <module>
    IndexError: list index out of range
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<stdin>", line 4, in <module>
    ZeroDivisionError: float division by zero
ekimekim··on Writing a Rust compiler in C
This is one of the coolest things about these kinds of bootstrapping projects + reproducible builds IMO. One could imagine creating an incredibly simple computer directly out of discrete components. It would be big, inefficient and slow as molasses, but it could in theory conform to instruction set architecture, and you could use it to build these bootstrap programs, and you could then assert that you get the same result on your fully-understood bad computer as you get on not-fully-trusted modern hardware.
ekimekim··on Making database systems usable
This is changing. Postgres (as you noted) supports JSON, and it also has excellent native support for arrays, range types, and composite types. For example:

    CREATE TYPE number_with_unit (
        value DOUBLE PRECISION,
        unit TEXT
    );

    CREATE TABLE example (
        height number_with_unit, -- our composite type, eg. (6, 'ft') or (180, 'cm')
        known_aliases TEXT[], -- list of string
        active_times TSRANGE, -- time range, ie. (start, end) timestamp pair
    );

    SELECT height.unit,
           known_aliases[1] AS primary_alias,
           upper(active_times) - lower(active_times) AS time_active 
    FROM example;
ekimekim··on How good can you be at Codenames without knowing any words?
> word knowledge was intended by the game designers to be a part of the game

This is the most frustrating part of Scrabble to me. I consider my vocabulary to be pretty good. But frequently when I try to use an even slightly-esoteric word in scrabble, it turns out to not be in the official dictionary. And conversely, the official dictionary is full of words I've never heard or seen used by real people and often has some definition like "18th century slang for <word>". I then lose to people who know all these weird words (especially the very short ones, which they've memorized) and who admit they have never heard these words outside a scrabble context either.

In short, the English the players speak and the English defined by the official dictionary are different enough languages that it seems only useful as a way to learn "Scrabble English" and not modern English.

ekimekim··on IRC Will Never Die (2021)
Yes, their chat is still compatible with IRC, albeit with lots of extensions (which you can opt into using IRCv3 capabilitiy negotiation). More recently they've been adding UI elements on the main site that are web API powered instead of chat though (eg. polls, sending bits).
ekimekim··on NASA says Boeing Starliner astronauts may fly home on SpaceX in 2025
The issue is that you don't normally let humans on them until you've proven they don't explode. If Boeing had followed each of those incidents with a re-do where everything went perfectly, it wouldn't be a problem.
ekimekim··on Children's daily sugar consumption halved just a year after tax, study finds
Yeah this is really starting to cause problems as things like this sugar tax push companies into adding sweetener to their "normal" versions. I now can't simply buy a Coke and know it will taste like Coke - I need to inspect the packaging and check if it will taste disgusting or not.

It's fine that they exist but presenting them as being full sugar when they aren't is false advertising.

ekimekim··on RegreSSHion: RCE in OpenSSH's server, on glibc-based Linux systems
> Rust doesn't have an effect system nor a similar facility to flag what code is not signal-handler-safe.

My understanding is that a sound implementation of signal handling in Rust will require the signal handler to be Send, requiring it only has access to shared data that is Sync (safe to share between threads). I guess thread-safe does not nessecarily imply signal-safe, though.

And of course you could still call to a signal-unsafe C function but that requires an unsafe block, explicitly acknowledging that Rust's guarentees do not apply.

ekimekim··on Browser extension that globally blocks vertical video?
I use https://addons.mozilla.org/en-US/firefox/addon/redirect-shor... which does exactly this. It's a simple redirect rule that shows the same video but in the normal video player.
ekimekim··on Ruby's Timeout is dangerous and Thread.raise is terrifying (2015)
> Even processes are not safe if they modify state outside of themselves (files on the filesystem or whatever else).

All processes should be prepared for a sudden crash without corrupting state. Things get OOM killed, machines get unplugged, networks go offline. We have things like journals and write-ahead-logs and at-least-one messaging precisely because of these kinds of problems. If your process can't handle being terminated at any time then you have problems regardless of if it's wrapped in timeout code.

Doing this for a block of code within a process is a lot harder, because a) there's generally more surface area of externally-observable state, and b) code does not normally need to be prepared to handle it.

ekimekim··on &udm=14 – easy access to an AI-free Google search
From what I've heard, Google purposely ignores the Accept-Language header because they believe browsers with a mis-configured language (eg. the browser is set to use english when the user doesn't want english) is more common than browsers with a correctly configured language that differs from their geoip location (eg. someone in France who wants to view a site in english).
ekimekim··on Apple introduces M4 chip
> I actually rejected a job offer when heard I will be given a macbook pro.

For what it's worth, I've had a good success rate at politely asking to be given an equivalent laptop I can put linux on, or provide my own device. I've never had to outright reject an offer due to being required to use a Mac. At worst I get "you'll be responsible for making our dev environment work on your setup".

ekimekim··on Bollards: Why and What
ah I missed that, apologies.
ekimekim··on Bollards: Why and What
> I'd suggest that unless you have very atypical habits that put you in conflict with bicycles very often and cars very rarely, you are worrying about the wrong thing.

While you would be correct if only considering risk of death, this doesn't tell us anything about the incidence of non-fatal pedestrian-cyclist interactions and what the outcomes are. It would be perfectly rational to care more about cyclists if it was 100x more likely than a car crash and still carried a signifigant risk of injury, even if the risk of death is extremely low.

To be clear I actually agree with you that cars are still likely the higher risk, just pointing out a limitation in your data.

ekimekim··on Ask HN: Are there any open source forks of nomad and consul?
Most hosted options like GKE also fall into this category - networking, load balancers, and to a certain extent monitoring is all set up for you.
ekimekim··on Why is simple decoration so rare in recent work?
I think the author might be making the common assumption that other people hold the same preferences they do. In the footnotes they speculate that most people prefer decorated objects but buy plain ones "to appear normal". Is it really so bizzare to suggest that many people actually prefer the clean, simple aesthetic?

One example shows some patterned plates. If you told me I could buy those patterned plates for $1, and the same plate but perfectly white for $10, and no-one but me would ever see or use them, I would take the $10 plates every time. I find the patterns annoying and distracting, especially for a surface which I want to ensure is clean.

On the streetlight example, I think the difference there is less a change in aesthetic and more a change in cultural expectations around public works. If you built the ornate street lamps today, even if it was in style, it would likely be decried as "unnessecary spending".

I do think there's a reasonable point to make that in today's market of mass-production, any preference besides the single most mainstream, mass appeal one is extremely hard to find. I wish the author could find more options that suit their preferences, even if I personally don't share them.

ekimekim··on Londoners see what a scientist looks like up close in 50 photographs
Damn, from the title I was hoping for a series of images of the same scientist, each zoomed in more and more, until it's microscopic.
ekimekim··on Major data center power failure (again): Cloudflare Code Orange tested
At its core Kubernetes is mostly a HTTP API being used to sync state between nodes. I see no reason that part shouldn't work even across the world, albeit at the cost of slower syncing of state (eg. pods taking longer to be created after a scale-up).

That HTTP API is backed by etcd which uses Raft and that is where running over a large area is more likely to cause problems. One approach would be to keep the etcd instances in one region (and probably also co-locate the scheduler, controller manager there), while having far-flung worker nodes. This creates a risk of losing the control plane but in most cases services would keep running (but would be unable to react to any further issues until the control plane recovers).

You would also want to carefully design your workloads with topology constraints and region-specific services to avoid high application layer latencies though.

Overall it's a fun thought experiment. In practical terms I think cross-datacenter in a small geographic area would work fine but I probably wouldn't want to run a single worldwide cluster, both for the reasons above and for other scaling reasons.

ekimekim··on YAMLScript – Program in YAML
I was desperately scrolling down the page looking for the part that identifies it as a parody...but yeah it looks serious. And that's terrifying.
ekimekim··on Parsing URLs in Python
To expand on the sibling comments: This encoding (called Punycode) works by combining the character to encode (é) and the position the character should be in (the 7th position out of a possible 7) into a single number. é is 233, there are 7 possible positions, and it is in position 6 (0-indexed) so that single number is 233 * 7 + 6 = 1637. This is then encoded via a fairly complex variable-length encoding scheme into the letters "fsa".

See https://en.wikipedia.org/wiki/Punycode#Encoding_the_non-ASCI...

ekimekim··on New Federal Rule Caps Credit Card Late Fees at $8
I did this when I first moved to the US, and had zero credit history (which the system considered to mean "high risk"). The entire point is to improve your credit score.
ekimekim··on Protecting paths in macro expansions by extending UTF-8
What unix does is closer to [NonZeroU8] which is actually very helpful as can be seen in shell commands like find -print0 | xargs -0, since a NUL character is guarenteed to not be part of the actual arguments. You could do the same here, but I suspect the program in question does not support NUL characters in their strings for the same reason unix doesn't (because that's what C does).
ekimekim··on All you need is Wide Events, not "Metrics, Logs and Traces"
> If I transmit a statsd metric representing "CPU usage", I am still sampling it.

In practice this is how everyone does it, but in theory it should be possible to have a non-sampled view of CPU usage (defined as "time process is scheduled onto a CPU"). With the right kernel introspection, you could represent it as a series of spans covering each time slice where the process is scheduled. Perhaps with a concept of a "currently ongoing span" to account for the current time slice.

Do I think this would be more useful than the typical sampled metric? Probably not, outside some niche performance analysis workflows. But my point is that CPU is not actually continuous, and I struggle to think of any metric which cannot be represented without sampling if you REALLY need it.

ekimekim··on Testing how hard it is to cheat with ChatGPT in interviews
I think asking "controversial" tech questions like that can be a great signal, because it steers the conversation towards features of the system and discussion of tradeoffs. If the question is good, then it shouldn't matter what the answer is - the fact they HAVE an opinionated answer and arguments to back it up is the point.
ekimekim··on Ask HN: Would you fly on a Boeing 737 MAX?
To play devil's advocate (and let me be explicit: I think this would be a horrible idea) the benefit would be cheaper flights, which would in turn have benefits such as cheaper shipping costs (for air delivery), more people experiencing other cultures (which I believe, perhaps naively, would be a social good of its own), promote remote working (since it's now easier to fly people in for meetups etc), and boost tourism economies.

Increased/cheaper travel would also come with some bad externalities: Increased CO2 emissions, and possibly increased rates of cancer (high altitude is a high-radiation environment - not enough for the occasional flyer to worry about but it can add up). ...and of course the externality that lower safety controls means occasionally one of these more frequent flights will fall out of the sky.

One way to think about these kinds of questions is to reverse it - suppose flying had 10x stricter safety controls than it does today. Would the world be a better place as a result? What would be the downsides?

EDIT: I almost forgot perhaps the most important one: If flying is more convenient/cheaper, even if it's slightly less safe than currently, it is still FAR safer than driving and a shift from people driving to people flying means that relaxing flight safety may actually SAVE lives.

ekimekim··on Why are we templating YAML? (2019)
To add to the sibling comments, after going from a jsonnet-based setup to a Typescript-based one (via pulumi), the biggest thing I missed from jsonnet was the native object merge operations which are very useful for this kind of work as it lets you say "I want one of these, but with these changes" even when the objects are highly nested, and you can specify whether to merge or override for each individual key.

But ultimately this was a minor issue and I think it's far more important that you use something like this (whether a DSL or a mainstream PL) and that you're not trying to do string templating of YAML.

← PreviousPage 2 of 20Next →