HNHacker News
TopNewBestAskShowJobs

yalue

363 karma · joined June 22, 2011

https://github.com/yalue/
submissionscomments
yalue··on Tiny ELF Files: Revisited in 2021
Better yet, another commenter [1] found that you can clobber the number of section header entries, as long as the size of a section header entry is 0. So, now the smallest size is two bytes shorter: 112 bytes for a full "Hello, world!", with an 8-byte "alignment" field to spare!

I'll need to update this article. The only annoying part will be scribbling over the hexdump output again.

[1] https://news.ycombinator.com/item?id=28849023

yalue··on Tiny ELF Files: Revisited in 2021
Interesting! So, it looks like you can clobber the number of section header entries, because, with this alignment, the _size_ of a section header is 0. Cool!
yalue··on Tiny ELF Files: Revisited in 2021
Odd. For some reason, my version of nasm didn't do that, and instead opted for the lengthier 10-byte instruction shown in the article's objdump output. Maybe it's just an older version of nasm.
yalue··on Negative Mount Pleasant (2018) [audio]
Eh, mabe they don't quite have the same feel they did when they had more regular, long episodes, but they still made the "Missing Hit" episode after being bought, which was excellent and widely popular. The recent-ish qanon episode was also decent and interesting, IMO.
yalue··on Radeon Open Compute 3.0
If you have a system with ROCm installed, support for compiling PyTorch on AMD has already been upstreamed. The PyTorch source code ships with a script for building a version using HIP (basically the script converts PyTorch's CUDA code to HIP and adjusts some build settings). So, if you're running a system with ROCm installed and are willing to compile PyTorch from source you can run PyTorch on AMD (admittedly that's several caveats and you're also limited to Linux in order to use ROCm).
yalue··on AMD lands Google, Twitter as customers with newest server chip
I'd say it's likely because NVIDA's CUDA compiler produces code for NVIDIA GPUs, and AMD would have a lot of (questionably legal) reverse engineering ahead of them in order to support the same code on their own GPUs.

If you're asking why AMD doesn't make a compiler for CUDA source code that targets their own GPUs--that's basically what ROCm currently does. They're pushing their CUDA alternative, called "HIP", which is essentially just CUDA code with a find-and-replace of "cuda" with "hip". (And other similarly minor changes.) They have an open source "hipify" program that does this automatically (https://github.com/ROCm-Developer-Tools/HIP/tree/master/hipi...).

So, basically, AMD GPUs are already sort of CUDA compatible: just run your CUDA code through hipify, then compile it using the HIP compiler, and run it on a ROCm-supported system (which, for now is the most spotty of all of these steps IMO).

yalue··on One Program Written in Python, Go, and Rust
The specific thing, IMO, is the fact that the interface itself is specified in the Go standard library along with plenty of utilities for working with it.

Java does have similar things, but, as far as I know, they're limited to the UI libraries and far more complicated (e.g. https://docs.oracle.com/javase/7/docs/api/java/awt/Image.htm...). Imagine if everyone who read or wrote image files in Java were guaranteed to conform to a dirt-simple "Image" interface with only three methods--with optimizations available but strictly optional.

For someone who's just tinkering or just wants to dump some cool bitmaps, the ability to write an "At(...)" function in Go and be looking at a PNG within a few seconds is just great fun to have in the standard library.

yalue··on One Program Written in Python, Go, and Rust
The "image" interface is one of my favorite parts of Go's standard library, and I think it's one of the best showcases of Go's "interface" feature. Want to save something as an image? Just implement three functions, two of which are trivial boilerplate and the third of which is just "return the color at this coordinate". You don't even need to manage the buffer of image data yourself this way. For example, if you want an image full of noise, just make your "get color" function return a random value every time it's called. I've used this myself for things like simple fractals.

And,on top of all that, once you've written code satisfying the image interface, the standard library even includes functions for saving your image as one of several possible image formats. And, due to the fact that the interface itself is specified by the standard library, virtually all third-party image encoding or decoding libraries for Go use it, too. So, every image reader or writer I've seen for Go, even third-party ones, can be drop-in replacements for one another.

Anyway, it's not Go's standard use case, but as someone who loves fractals and fiddles with images all the time it's one of my favorite parts of the language.

yalue··on Optimizing Inefficiency: the quest for the worst sorting algorithm
This is true, but note that the problem in general doesn't specify that the ints are only 16-bit. It's already well established that "linear time" sorting algorithms exist (e.g. radix sort) for numbers that are all a bounded size. However, the key is still that the length of each number must be bounded, because that ensures that the length of the input relates to the number of numbers in the list to be sorted, rather than to the length of the largest number. (The Wikipedia article on radix sort gets this right... Just not the one on abacus sort)
yalue··on Optimizing Inefficiency: the quest for the worst sorting algorithm
I agree, and wrote a lengthy comment below about why this "algorithm" would actually be considered exponential time using the accepted definition of time complexity in theoretical CS.
yalue··on Optimizing Inefficiency: the quest for the worst sorting algorithm
I was going to comment on this already, but even that's way too "fast" based on the accepted notion of time complexity in theoretical CS... abacus sort should technically be an exponential-time algorithm! (And yes, I disagree with the wikipedia article on this topic, which lists several "possible" time complexities, all of which I consider incorrect.)

The reason being that the accepted definition of time complexity in formal literature is standardized not based on the number of "things" in the input (numbers in a list, nodes in a graph, etc.), but on the length of the input string. This is a common pitfall when people reason about time complexity. Here's why this applies to abacus sort:

1. Abacus sort contains integers in its input string--and based on the conventions of formal time complexity, these can not be encoded in unary (if unary encodings were allowed, then several famous NP-Complete algorithms, e.g. bin packing, would have polynomial time solutions based on the length of their input)

2. The value of an integer is exponentially related to its length. For example, making a binary integer only one bit longer can double its value, making it two bits longer will quadruple its value, etc.

3. The input to a sorting algorithm like abacus sort is a list of numbers. Even if there are n numbers, the number of "beads" you need to simulate is exponentially proportional to the length of the longest single number.

4. Even if you think that the number of beads can be simulated with an infinite number of threads, or something, you'd still need to decode the (at least) binary input to a unary number of beads, which will take an exponentially-related amount of memory.

Of course, all this is not to say the algorithm isn't cool in practice, for numbers in ranges that reasonable people care about. It's similar to a weakly-NP-complete problem (https://en.wikipedia.org/wiki/Weak_NP-completeness) like integer bin packing, where the time complexity is dependent on the longest number and therefore technically exponential, but in practice solved for any reasonable ranges of values in polynomial time.

Edit: By the way, this is why the naive prime-number-checking algorithm (check divisibility of a value v by all values up to sqrt(v) is not an efficient algorithm even though many people incorrectly think it's O(sqrt(n))!

It technically takes exponential time relative to the length of bits in the number, so it's basically useless for guaranteeing primality of something like a 4096-bit number.

yalue··on Google cancels AI ethics board in response to outcry
(Note that I'm not trying to straw-man you here, because I know you're only talking about the specific instance of this panel, which I've already agree was a farce to begin with. However,...) I still think it's harmful to society as a whole to try to use someone's views on any given topic as an excuse to refuse to work with them on something unrelated.

Say, for instance, that you're asked by a supervisor to collaborate with a Muslim living in a middle eastern country on writing a piece of software. For the sake of argument, say that this particular person believed that the laws recently enacted in Brunei were in line with the commands of Islam, and therefore just. (For the sake of argument only--obviously not everybody in those categories is like this at all--but clearly at least some must be or we wouldn't have situations like this recent one.) Would it be right to refuse to work with this person on writing say, some python code, when the topic of "sharia law" is never going to be a factor? Furthermore, by your argument, would you be willing to trust this person's judgement on software architecture when they have exhibited a, in your view, extreme lack of good judgement in another field?

Second, you can even take this argument to a higher level. You admit that the opposing party has a reason to believe what they believe, and I'd imagine that you'd even grant that they probably believe that their reasons for their particular position are good reasons. Leaving aside whether the positions themselves are good or not, how do you evaluate whether someone's reasons for holding a particular position are good? After all, a religious person may believe that one day an omniscient being will call them to answer for why they failed to keep holy commands in their life. To the holder of such a view, that's a pretty good reason to do some twisted stuff. If anything, (if their religion is right) such a reason for them holding their particular position (fear of eternal condemnation) may even be better to them than your reasons for your position are to you!

yalue··on Google cancels AI ethics board in response to outcry
Sure, but if they're not debating that topic, why should it be an issue? Not that I think such a person belongs on the panel, but the reason they're not invited should be, as you said, that they have few or no qualifications to discuss either ethics or AI.

The fact that they don't agree with the others on LGBT rights should only be an issue if they insist on trying to espouse their unrelated viewpoints using the panel, in which case by all means kick them off.

yalue··on Google cancels AI ethics board in response to outcry
You're right about all of that, but shouldn't a meaningful board at least make some show of trying to include diverse opinions? The key word of course is "meaningful", and I think you're right on the money that Google wasn't interested in having a panel to discuss meaningful issues in the first place; it seems more likely that they wanted to be able to point to a source of "external" "unbiased" opinions to justify what they were planning to do already.

(Obviously the people who complained about a prominent right-wing figure would just argue something hypocritical like "only the right kind of diversity of opinion", but that's beside the point; the panel was a dumb idea to begin with, coming from a group with so much of a stake in trying to advance AI for the sake of advertising)

yalue··on Griping about Go
It actually did get significantly better in Go 1.8, in early 2017. See https://golang.org/doc/go1.8 ("The overhead of deferred function calls has been reduced by about half.").

However, I think this change was mostly just an optimization for common cases with few arguments or no closures (e.g. "defer f.Close()").

yalue··on RIAA Lawyers Botched a Big One Against flvto.biz – So What’s Next?
I'm pretty sure youtube-dl just invokes ffmpeg in the background to extract the audio for you; all it means is that you don't need to remember the exact ffmpeg commands.
yalue··on Gogs – A simple, stable and extensible self-hosted Git service
Having set up both, Gogs is much easier to set up than gitlab, and I don't know how the install instructions are similar. Gogs' are, from https://gogs.io/docs/installation/install_from_binary, essentially "download and run". The binary build they provide even has sqlite3 support out of the box, so you don't even need to install a database if you're only working with a small group. Also, gogs is far more performant than gitlab, and will happily run on an older raspberry pi.
yalue··on Docker cannot be downloaded without logging into Docker Store
Probably the slightly better term here would be "weasel words". (Or better yet, "bullshit")
yalue··on Diversity and Discrimination in Open Source
Looks like it, yes. Just refreshed the front page in the past ~30 seconds. This got dozens of new comments in that time frame, but the link is no longer present at all.
yalue··on Bleve: full-text search and indexing for Go
It isn't common, and the code example wouldn't even compile because "err" is assigned but never used. I imagine that they included the "err" variables to show that they're available, but didn't want to clutter the example with error checks.

You can ignore error codes in go by assigning them to the special variable "_", but, outside of very short toy examples, it is a huge warning sign for terrible code. It's certainly not common to ignore errors in Go.

yalue··on Linux System Call Table
Sometimes, yes, you'll need to write your own syscall wrappers. For example, there isn't a gettid (get thread ID) function in Glibc, but you can work around this by calling the syscall directly.

The other case where this is useful is if you're wanting to write userspace assembly without calling a C library. This may be especially useful when you're writing a compiler, or if you're trying to write small shellcodes for some reason.

yalue··on An update on our commitment to fight terror content online
That's the thing, though. Extremist videos are already against the rules, can be reported by users, and removed if the reports have merit.

Whether it's exaggerated "by the right-wing press" or not (I find it concerning despite being left-leaning and not the press), I don't like the notion of any politically-aligned parties having an outsized role in deciding what's "appropriate".

yalue··on An update on our commitment to fight terror content online
I would say that this is the only use for this particular feature, because actual calls to violence and extremist messages are already against the rules on youtube and can simply be reported by users.

Like you, I also find the Alex Jones and his ilk to be disturbing and harmful, and consider it a bad sign that people like you and me need to qualify any statement against censorship by explicitly saying we aren't part of the American far right.

yalue··on C64 Yourself: Browser-based image converter to C64 color palette
Have you considered adding the ability to use dithering on this site? I made a similar tool a while back (to convert an image to an arbitrary color palette), and one of the main things I learned was how powerful dithering can be.

For example, here are two images I created using my old tool to convert an image to the C64 color palette. Unlike the website, my tool isn't currently capable of doing the double-wide horizontal pixels, but it still illustrates the effect I think:

Without dithering: http://imgur.com/nQL0y6i With dithering: http://imgur.com/jfwUgnC

If you're interested, Wikipedia has a great example (with code) of the Floyd-Steinberg dithering algorithm, for example: https://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dither..., which I imagine wouldn't be too hard to integrate into your site.

yalue··on McDonald’s Universal Icons for 109 Countries [pdf]
I noticed that, too. Unfortunately it seems like it's going to take several more years to shake off the aggressive anti-fat lobbying and paid "research" by the sugar industry. Also, I'd imagine McDonalds would be much less willing to warn its customers against their offerings high in sugar or refined carbohydrates.
yalue··on Revolution Pi – Industrial PC Based on Raspberry Pi
On the website, you mentioned that you run stock Raspbian with a real-time patch on the devices. I'm mostly curious about the real-time extensions you're using. Did you write the patch in-house? What real-time capabilities are supported on it? Is it just a better scheduler, or do you also include things like locking protocols?

This isn't a particularly important question; I'm just a grad student in real-time research so I like learning about what gets used in practice. Thanks!

yalue··on Cmd/compile: Go 1.8 regression: sync/atomic loop elided
I agree that this sounds more like "volatile", but it still makes sense that programmers should be able to rely on atomic operations for inter-thread communication.

According to the comments on the bug report, this behavior is inspired by C++'s <atomic> library, which guarantees cross-thread visibility.

yalue··on Cmd/compile: Go 1.8 regression: sync/atomic loop elided
Variable writes that look like they have no side effects may actually be intended for another thread to read (but hopefully most reasonable programs don't do this without some good explanation). However, many concurrency models say that this method of inter-thread communication is Okay to optimize out, because most threading libraries (including Go's) make no guarantees about the order in which threads are scheduled. Therefore, removing the "writing" thread entirely is equivalent to it never being scheduled.

However, this is not the case for atomic operations (which are generally specifically intended for communication via shared variables). This optimization of removing the writing thread entirely isn't allowed if atomic operations are used, because those actually do come with a guarantee that other threads will get to see the update in finite time.

Go was incorrectly "optimizing" the atomic operations out entirely. It's a fairly subtle bug, actually, but still likely a big deal for the few programs communicating via shared variables.

yalue··on Apocalypse whatever: 4chan's religion of nihilism
It's too bad that the author conflates /pol/ (known to many other 4chan users as a "containment board" for the most racist users) with the entirety of the site.

While pol may be the most active board on 4chan for the time being, it hasn't always been and may not always continue to be (sadly, painting the entire site as a club for nihilistic Trump supporters makes it less likely to attract different users). Much of the rest of the website offers a great discussion format for focused topics, and I wish I could admit to enjoying the other sections of 4chan without needing to qualify my statements by explaining that the entire site isn't dedicated to racism and porn.

yalue··on Show HN: Accelerating SHA256 by 100x in Golang on ARM
This article is referring specifically to ARM64 assembly which is actually quite a bit more RISC-y than previous versions of the ARM ISA. In favor of simplicity, many of the more complex ARMv7 instructions (such as the block loads/stores) were removed in ARMv8. I'd still agree that ARM is not very RISC anymore, but the ongoing move to ARM64 takes it quite a bit back in that direction.
← PreviousPage 2 of 3Next →