HNHacker News
TopNewBestAskShowJobs

johnnymellor

26 karma · joined December 13, 2013

submissionscomments
johnnymellor··on Linking to text fragments with a bookmarklet
This would be useful in Chrome for Android (which doesn't yet have this feature built-in), but activating bookmarklets on Android (via https://paul.kinlan.me/use-bookmarklets-on-chrome-on-android...) clears the text selection. So instead I've put together an alternative bookmarklet that lets you select the text to link to after activating the bookmarklet: https://gist.github.com/johnmellor/ef5ecf555f28b324b045e0c93...
johnnymellor··on Show HN: Transductive regular expressions for text editing
If I understand correctly the following ttre expression does what you're asking for:

  ":'(':(\\')|[^"'])*":'
johnnymellor··on Show HN: Radius – A Meetup.com alternative
Many communities would like to have a page/ical that lists all the events going on in that community. But event organisers are often busy, and by the time they've posted on WhatsApp and Facebook and Meetup they won't necessarily bother to post here too, especially when there are multiple organisers within a community, and due to the chicken and egg problem of it only being worth posting here if all of the community's other events are also listed here.

What would help is if engaged community members can collaboratively list events that event organisers have posted elsewhere, so that community members can find all the community's events in one place (here) even if the event organisers don't bother to post them here themselves. This raises a few auth complications, e.g. if the event organiser wants to post their event ideally they'd be able to take ownership of the placeholder event uploaded by the community member. But if you can solve those, seeing all their events in one place might be a compelling reason for communities to organically switch over to your platform (at which point event organisers might well also follow).

johnnymellor··on Lumiere: A space-time diffusion model for realistic video generation
At least on Chrome for Android, you can long-press to trigger the hover effect. Works on many websites. (There are inconvenient side-effects like selecting text, but it's better than nothing.)
johnnymellor··on CLI tools hidden in the Python standard library
Oh, and multi-line statements will be supported from Python 3.13 (https://github.com/python/cpython/issues/103124)
johnnymellor··on CLI tools hidden in the Python standard library
Not supporting multi-line statements is just because pdb doesn't bother to parse the statement to work out if it is an incomplete multi-line statement. That could be easily fixed (I have a prototype patch for that using `code.compile_command`).

The scope problems are more fundamental:

The pdb REPL calls[1] the exec builtin as `exec(code, frame.f_globals, frame.f_locals)`, which https://docs.python.org/3/library/functions.html#exec documents as:

"If exec gets two separate objects as globals and locals, the code will be executed as if it were embedded in a class definition."

And https://docs.python.org/3/reference/executionmodel.html#reso... documents that:

"The scope of names defined in a class block is limited to the class block; it does not extend to the code blocks of methods - this includes comprehensions and generator expressions since they are implemented using a function scope."

This is a fundamental limitation of `exec`. You can workaround it by only passing a single namespace dictionary to exec instead of passing separate globals and locals, which is what pdb's interact command does[2], but then it's ambiguous how to map changes to that dictionary back to the separate globals and locals dictionaries (pdb's interact command just discards any changes you make to the namespace). This too could be solved, but requires either brittle ast parsing or probably a PEP to add new functionality to exec. I'll file a bug against Python soon.

[1]: https://github.com/python/cpython/blob/25a64fd28aaaaf2d21fae...

[2]: https://github.com/python/cpython/blob/25a64fd28aaaaf2d21fae...

johnnymellor··on Why do recipe writers lie about how long it takes to caramelize onions? (2012)
Midjourney's rendering looks pretty tasty: https://pasteboard.co/NBhdMl3AsAAR.png
johnnymellor··on HN is up again
You can make the omnibox forget about URLs and search terms you've used a lot by selecting them with the down key then pressing Shift+Delete (https://superuser.com/a/189334).
johnnymellor··on We think this cool study we found is flawed. Help us reproduce it
Yes, it's a very desirable trait in https://en.m.wikipedia.org/wiki/Quasi-Monte_Carlo_method

Quasi-Monte Carlo has a rate of convergence close to O(1/N), whereas the rate for the Monte Carlo method is O(N^(−0.5))

For such applications it's best to use quasi-random numbers (a.k.a. low-discrepancy sequences) such as the Halton sequence or the Sobol sequence instead of pseudorandom numbers.

johnnymellor··on A basic introduction to NumPy's einsum
Einops looks nice! It reminds me of https://github.com/deepmind/einshape which is another attempt at unifying reshape, squeeze, expand_dims, transpose, tile, flatten, etc under an einsum-inspired DSL.
johnnymellor··on Coming to Chrome: a new way to use tabs
For TST in Chrome I've been very happy with Tabs Outliner (https://chrome.google.com/webstore/detail/tabs-outliner/eggk...). As well as a great tree, you can mix live tabs/windows with frozen ones that don't consume RAM, and this is all reliably persisted across restarts.

Tabs Outliner is a separate window, since Chrome extensions can't add sidebars, so rather than using it as a tabbar replacement I tend to have multiple windows with less than 10 tabs, and open Tabs Outliner when I want a coherent overview (e.g. to quickly skim through my tab titles before closing them in bulk).

johnnymellor··on 300ms tap delay removed on Chrome for Android
In Chrome for Android, just tick Settings > Accessibility > Force enable zoom