HNHacker News
TopNewBestAskShowJobs

spappal

53 karma · joined February 6, 2018

submissionscomments
spappal··on iPhone Duo
The algebra proving why "halving long side H and flipping maintains aspect ratio" implies a ratio of 1:sqrt(2):

    H/W = W/(H/2)       (halving long side H and flipping maintains aspect ratio)
        = 2W/H          (multiply numerator and denominator by 2)
    H²  = 2W²           (multiply both sides by HW)
    H   = √2·W ≈ 1.41 W (take the positive square root; H, W > 0)
spappal··on FFmpeg 101 (2024)
That's a helpful tutorial, thanks.
spappal··on JSONB has landed
Align with the rest of the system, when sqlite is used as a component in a system which mainly speaks json.

Performance, when records are complex and usually not accessed.

Ease, avoiding/postponing table design decisions.

Flexibility, for one of many corner-cases (since sqlite is a very broad tool).

Incremental enhancement, e.g. when starting with sqlite as replacement to an ndjson-file and incrementally taking advantage of transactions and indexes on fields [1,2,3].

For example, several of these could apply when doing structured logging to a sqlite database.

    [1]: https://www.sqlite.org/expridx.html
    [2]: https://www.sqlite.org/gencol.html
    [3]: https://antonz.org/json-virtual-columns/
    See also: https://www.sqlite.org/json1.html
spappal··on Boring Python: Code quality
I got good use of the run-time type checking of typeguard [0] when I recently invoked it via its pytest plugin [2]. For all code visited in the test suite, you get a failing test whenever an actual type differs from an annotated type.

[0]: https://github.com/agronholm/typeguard/

[1]: https://typeguard.readthedocs.io/en/latest/userguide.html#us...

spappal··on Rga: Ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz
Firefox supports custom search engines, the most bang for the buck custom search engine must be https://duckduckgo.com/?q=%s with keyword being the letter d. Then you get all these 13000+ bangs without having to configure the custom search engines. E.g. write "d !drive term" in url bar. And "d !w hacker news" sends you directly to https://en.wikipedia.org/wiki/Hacker_News
spappal··on Implementation plan for speeding up CPython
The author of that macro PEP [0] is the same Mark Shannon behind the speedup proposal under discussion.

[0]: https://www.python.org/dev/peps/pep-0638/

spappal··on iPhone 12 and iPhone 12 Pro
The reason for magnetic field strength falling off as 1/r^3 is interesting: the biot-savart law says that magnetic field falls off as 1/r^2 from a magnetic source, but in reality sources tend to be better approximated by magnetic dipoles than magnetic monopoles. A "north pole" is always accompanied by a "south pole", and at distance there are "interaction effects" such that a part of the field strength is "canceled out".

https://en.wikipedia.org/wiki/Magnetic_dipole

https://en.wikipedia.org/wiki/Magnetic_monopole

spappal··on Array Programming with NumPy
> the properties of the hashes [g]it uses

Git uses SHA-1, a hardened version since 2017, and are now doing per-repo upgrades to SHA-256 [0]. Lots of repos are presumably still on SHA-1 (and users on older versions of git).

As of 2020, chosen-prefix attacks against SHA-1 are now practical. [verbatim from 1] But I don't think second preimage attacks are practical yet.

Linus Torvalds argued in 2006 basically that it's irrelevant whether git's hash function is second preimage resistant. Selective quoting:

> remember that the git model is that you should primarily trust only your _own_ repository [2]

> [a malicious] collision is entirely a non-issue: you'll get a "bad" repository that is different from what the attacker intended, but since you'll never actually use his colliding object, it's _literally_ no different from the attacker just not having found a collision at all [2]

All that is just to say: git originally chose its hashes for the above mentioned "git model", thus didn't 100 % care about second preimage resistance. For your suggested search engine, depending on how the database is collected you might not be able to trust "your own repository" (if it's crowdsourced I could register another codebase with the same hash as Linux). A second preimage resistant hash function would be a requirement for the suggested use case.

[0]: https://git-scm.com/docs/hash-function-transition/

[1]: https://en.wikipedia.org/wiki/SHA-1#cite_ref-8

[2]: https://marc.info/?l=git&m=115678778717621&w=2

spappal··on Ask and Show HN: Ever coded for love? Willing to share?
Since toast is discussed on HN: I remember this video [0] nicely explaining some nice engineering of an interesting toaster.

[0]: https://www.youtube.com/watch?v=1OfxlSG6q5Y

spappal··on Some Fundamental Theorems in Mathematics (2019) [pdf]
Compact summaries are useful when revisiting something that was learnt before. Such a document might be more useful for mathematics than most subjects, since many have studied maths but stopped using it, and those teachings are generally still true and relevant.

The doc would be at least 20 % more useful to me if the pdf had a table of contents. Should be easy to include assuming that it was written with latex. Opinion: when writing a lengthy latex document, the extra 0.5 % of work required to add automated pdf metadata (table of contents, clickable references) has outsized usability effects.

I stumbled upon typos:

* "Basel problem formula": pi should be squared.

* The "more general" statement related to Bayes theorem lacks a right parenthesis.

spappal··on Guietta – Python module to create simple GUIs
And PEP 8 doesn't mention sorting the imports. There are even counterexamples which aren't alphabetically sorted. It does mention grouping though.

Since Python imports can have side effects, the order can matter. But to the extent that it doesn't break anything, alphabetically sorted groups seems deterministic and readable.

I think this might be the most popular implementation for auto-sorting: https://pypi.org/project/isort/

spappal··on Facial Recognition Leads To False Arrest Of Black Man In Detroit
See also: the paper "Why Most Published Research Findings Are False". Previously on HN: https://news.ycombinator.com/item?id=1825007
spappal··on Sharedrop – Easy P2P file transfer powered by WebRTC
This was spotted on HN 3 weeks ago: https://github.com/schollz/croc
spappal··on When U.S. air force discovered the flaw of averages (2016)
P(simultaneously within middle 50 % of n independent distributions) = 0.5^n = 2^(-n), like my parent comment says.

But interestingly, every relevant comment here either got something wrong about the final frequency or percentage, or corrected the wrong thing. (Parent comment, grandparent, 2 aunts and 1 cousin.)

0.5^10 = 2^-10 = 1/(2^10) = 1/1024 [i.e. exactly 1 person per 1024] ~= 0.00097656 ~= 0.09766 %.

spappal··on When U.S. air force discovered the flaw of averages (2016)
0.9^9
spappal··on Ask HN: What is the most beautiful piece of code you've ever read?
Wayback Machine to the rescue: https://web.archive.org/web/20121023081714/https://kturtleco...

I recommend adding bookmarklets for Wayback Machine: https://en.wikipedia.org/wiki/Help:Using_the_Wayback_Machine...

spappal··on Google T5 scores 88.9 on SuperGLUE Benchmark, approaching human baseline
> remember that deaf-blind people exist [... ...] able to understand language

I got curious if/how deafblind people learn to communicate in the first place, if they are completely deafblind from birth. If humans can learn not just communication but language without either vision or hearing, that seems to suggest either extreme adaptability or language learning being quite decoupled from vision and hearing. From an evolutionary standpoint, I imagine that both deafness and blindness are probably uncommon enough that language learning could have explicit dependencies on both hearing and vision.

I found an old-looking video about communication with deafblind people. At the linked timestamp is a woman who is deafblind since age 2.

https://youtu.be/usaf3bVVvjY?t=840

spappal··on The Secret History of Dune
I read Chiang's Exhalation [0] prompted by your question. So much story in so few (6505) words! Great use of a crafted universe to tell a story relevant to us. That's the beauty of sci-fi as I understand it. Worth the 30 minutes.

[0]: http://www.nightshadebooks.com/Downloads/Exhalation%20-%20Te...

spappal··on John Carmack on the Joe Rogan Experience [video]
This doesn't really get us closer to the speed of light, but we have broken lots of speed records in the last 50 years:

https://en.wikipedia.org/wiki/List_of_vehicle_speed_records

spappal··on Give Firefox a chance
> Firefox just doesn't have nearly the security credentials that Chrome does at the moment

I think this claim deserves a justification. Not saying you're wrong but I'm interested in how to compare browser security.

(Counteranecdote: the HN-popular article [0] which explained the Firefox zero-day, mentioned in it's last paragraph a Chrome zero-day from March 2019.)

[0] https://www.zdnet.com/article/mozilla-patches-firefox-zero-d...

spappal··on Hackers ransack Citrix, make off with 6TB+ of emails, biz docs, secrets
I would be interested in knowing how cyber warfare and cyber espionage are viewed from a perspective of diplomacy or power play between nations (or corporations). Does anyone know of interesting articles?
spappal··on Show HN: Jobs Done – A ritual app for ending the work day inspired by Deep Work
I agree that Deep Work is worth a read. Quite a few meaningful ideas in quite few pages. The end-of-day shutdown is one of the ideas that stuck in me. After a workday my mind is usually buzzing a bit too much for most activities. Focusing on winding down helps very much. Having accepted the point made by the author in combination with it being such a small thing to say the phrase when walking from work means that I often remember to say the phrase and then instantly accept that I should focus the last drops of work-related attention on disconnecting from work in a good way. Helps me a lot!
spappal··on A mysterious grey-hat is patching people's outdated MikroTik routers
This reminded me of last years "BrickerBot" malware [0] by grey-hat The Janit0r / The Doctor who bricked IoT devices with the stated purpose of preventing the same devices from being hacked by botnet-malware, which allegedly puts the whole internet at risk.

[0] https://www.bleepingcomputer.com/news/security/brickerbot-au...

spappal··on An artwork by Banksy shredded itself after selling for $1.3M at Sotheby’s
The light appears to not come from the inside:

https://www.youtube.com/watch?v=Std3LfVx41c&t=33

spappal··on Show HN: Hacking slot machines with a buttonhole camera and brute-force search
This article [0] explains nicely the story of Claude Shannon et al trying to win at roulette.

[0] http://nautil.us/issue/50/emergence/claude-shannon-the-las-v...

spappal··on Show HN: Hacking slot machines with a buttonhole camera and brute-force search
Agreed, I just tried it. Two good examples for this are the ones in the Wikipedia page [0]. The size in the page is maybe a bit large, if it requires a too large angle of eye crossing: hit Ctrl - a few times to zoom out.

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

spappal··on The Future of Notebooks: Lessons from JupyterCon
> Over time, I expect editors like VSCode to edit Jupyter notebooks natively.

PyCharm has support for Jupyter notebooks [1], but for now it's not very good [2]. Two weeks ago Jetbrains released this official comment [2]:

Hi, we are aware of the problems our Jupyter support has and we aren't going to fix them, because the current support is going to retire. Currently we are working on another support of Jupyter notebook (even 2!), which hopefully will be better and much more usable. We plan to make it ready for 2018.3 PyCharm release, so stay tuned.

My note: The current PyCharm is version 2.2.

[1] https://www.jetbrains.com/help/pycharm/using-ipython-noteboo...

[2] https://intellij-support.jetbrains.com/hc/en-us/community/po...

spappal··on Python Fire – Generates CLIs from any Python object
recognize adds type hints [0], which is what the desired library would use to verify input / select suitable UI elements etc.

[0]: https://docs.python.org/3/library/typing.html

spappal··on Google changes its messaging strategy again: Goodbye to Allo, double down on RCS
> Please read about the impact of Jio in India.

I read this piece [1] which centers on Jios impact on the telecom industry. It states that the rate of digitalization has been boosted, but doesn't really detail the societal impact. Do you recommend any particular article?

[1]: https://www.ft.com/content/3f1fe4d6-e4e0-11e7-a685-5634466a6...

spappal··on Signal Foundation
This is their latest blog post on the topic: https://signal.org/blog/private-contact-discovery/
Page 1 of 2Next →