HNHacker News
TopNewBestAskShowJobs

JNRowe

7,427 karma · joined February 3, 2014

username at gmail.com ; Feel free to get in touch.

[ my public key: https://keybase.io/jnrowe; my proof: https://keybase.io/jnrowe/sigs/orH3nyNqAK4vkIpcxn2HRihHPV2HX80SyDwM9cR5xnw ]

submissionscomments
JNRowe··on Entering text in the terminal is complicated
That's pretty cool, gonna steal the idea.

I can implement that specific case with a couple of lines in zsh. Something like:

    autoload -Uz zed
    icommit() {
      () {
        zed $1
        git commit -F $1  # -a too, if you must ;)
      } =(:)  # Or maybe even =(< commit_template.txt)
    }
Then icommit, via zed¹, will initiate an inline editor with all the power of ZLE available. Hit C-x C-w to write and commit, or C-c to abort. Obviously, you'd want some error checking and the like².

Beauty of this basic implementation is that the keymap is fully controllable in zed as it is simply a new ZLE widget. It works with emacs or vi mode out of the box, and is fully customisable beyond that.

You could make the interface generic by writing your own ZLE widget, so that it can be called directly from within the line editor and remove the need for wrapping commands like I did above.

¹ https://github.com/zsh-users/zsh/blob/master/Functions/Misc/...

² This at least uses, and cleans up, a temp file to handle the commit message so it isn't completely useless.

JNRowe··on Systemd Looks to Replace sudo with run0
Close to nine-hundred comments¹ when Lennart posted about run0 on mastodon² a couple of months ago.

¹ https://news.ycombinator.com/item?id=40205714

² https://mastodon.social/@pid_eins/112353324518585654

JNRowe··on Remnants of a legendary typeface have been rescued from the Thames
We've had centuries of embankment works along the Thames¹, a fair bit concentrated around the areas you'd expect to find type like this². There must be a phenomenal amount of history that was purposely covered around there. Given the scale of the works you'd have to imagine there is a significant chunk of non-London history to be found there too(the scale of granite imports from Cornwall being an obvious example).

I'm less optimistic about the possibility of more large scale digs though, as the Golden Jubilee bridge history³ points out the area is an also an exciting zone for stumbling in to unexploded ordnance and you always seem to be within few metres of a tube line or Victorian sewer.

[It is the reason I love those plucky Crossrail⁴ developers who've felt the anger from the havoc they've left across London over the few past decades. We get incredible large scale engineering works to lust over, coupled with really wacky archaeological digs tagging along for the ride.]

¹ https://en.wikipedia.org/wiki/Embanking_of_the_tidal_Thames

² https://en.wikipedia.org/wiki/Thames_Embankment - Both the "home" of the type in Hammersmith and Fleet were the targets of embankment work in the 19th century

³ https://en.wikipedia.org/wiki/Hungerford_Bridge_and_Golden_J...

⁴ https://en.wikipedia.org/wiki/Crossrail

JNRowe··on Xmake: A cross-platform build utility based on Lua
There is the largely feature compatible muon¹ re-implementation that doesn't require Python, it is packaged in a few distributions too. As in all things of this nature there are some caveats².

It is actually pretty useful to have installed alongside meson, even if just for access to the manpages as documentation.

¹ https://git.sr.ht/~lattis/muon

² https://muon.build/releases/edge/docs/status.html

JNRowe··on The File Filesystem (2021)
Not PMunch, but bindings¹ and statusbar².

Nimble has a couple of fuse projects and wrappers registered too.

¹ https://github.com/PMunch/libfuse-nim

² https://github.com/PMunch/statusbar

JNRowe··on PumpkinOS, a Re-Implementation of PalmOS
Just to muddy the waters some more there was also an EC variant¹ of the 030 without the MMU.

The EC variant was available right through to the 060, and I'd be curious to know how prevalent the line was. I suspect the EC versions far outnumbered the "full" chips, because they appeared in all kinds of industrial systems. I'm basing that entirely on working for a company that was still shipping products with MMU-less 68k and coldfire this century, not any real data.

¹ https://en.wikipedia.org/wiki/Motorola_68030#Variants

JNRowe··on Wireproxy: WireGuard client that exposes itself as a HTTP/SOCKS5 proxy
That is the situation that lead to me to wireproxy; I had a need to use Cloudflare Warp, and no desire to entrust their apt repository with updates to my system.

Added to that their official client has heaps of functionality I have no use for, and wireproxy does everything I want for this usecase with a comparatively tiny amount of code(5MB vs 400MB built). I started the evening with a wg-quick generated config that required root, and ended it using a simple unprivileged daemon that I can toggle easily.

JNRowe··on Overview: What are Cpp2 and cppfront? How do I get and build cppfront?
Sutter's 2022 cppcon talk¹ is a great introduction to the topic, both the problems it attempts to solve and solutions it was/is settling on. One of those few talks that left me genuinely enthused about the topic.

[It is probably worth watching for the Compiler Explorer interjection toward the end alone -- Matt Godbolt Appreciation Society]

¹ https://www.youtube.com/watch?v=ELeZAKCN4tY

JNRowe··on Show HN: Flatito, grep for YAML and JSON files
I always enjoy these side diversions, because they're full of "Huh, WTFs". In English I'd never heard anyone call it anything but "a stitch"¹ colloquially or ETAP as an actual condition, but sure enough side ache features in the list of alternatives on Wikipedia.

Oddly, Wiktionary has an article for sideache² and a link to that page if you look for side stitch. Makes me curious how often that is the case now. [/me sniped]

¹ https://en.wikipedia.org/wiki/Side_stitch

² https://en.wiktionary.org/wiki/sideache

JNRowe··on Spent brewer's yeast as a biosorbent for metal recovery from polymetallic waste
Marmite has an XO version¹, which is aged for a month instead of a couple of days. Not sure I want to try ten year old mitey, but you're here to tell the tale so it must be okay ;)

¹ https://www.marmite.co.uk/products/marmite-xo-yeast-extract-...

JNRowe··on Gimp 3.0.0-RC1
The 2.99.18 release received a lot of commentary a few weeks ago, although a fair chunk of it was the predictable rehash of every gimp comment section.

¹ https://news.ycombinator.com/item?id=39465614

JNRowe··on Pipexec – Handling pipe of commands like a single command
I use mutlios and even I'm not that attached to it. The majority of my use is combined with process substitution, and could be replaced with common-ish tools like pee¹(or pipexec for more complex cases). The only occasion when I'm thankful for it is if I want to use a shell function as a target, but there are workarounds for that too.

As a noclobber user the footgun is largely hidden to me, but I feel its presence. multios without globbing support would be less useful, but would still work for most of my use cases. Scanning my shell history I see various cases of relying on zsh's ability to apply sorting and filtering to globs with multios' input redirection, but only a couple where I want that in output redirection. The input instances could easily be rewritten using cat and globbing.

Even with multios unset the behaviour is different between zsh and bash. For example, nomultios disables all the expansion, so zsh behaves like more like dash with ': >t{1,2}' creating a file instead producing an error like bash does.

[FWIW, I google'd multiios to link the option in mt original comment. It really feels like it needs double-i, and I read the single i name the same way you do.]

---

I'd be one of those people whose desire for dgsh-like functionality wanes. If it was slight DSL that I could "upgrade" pipelines to I'd probably use it, but not enough to warrant working on it or switching other tooling to support it.

The end of result of this morning's pipeline was breaking my jobs up, and applying some judicious use of nq² to keep track of it. I'd follow your advice and move on to more specialist tools if the job grew significantly or if it became a regular occurrence.

¹ https://joeyh.name/code/moreutils/

² https://git.vuxu.org/nq/about/

JNRowe··on Pipexec – Handling pipe of commands like a single command
Yep deadlocks, you're correct. From the paper:

"Modern Unix systems offer named pipes, also known as fifos, which can be used to hand-craft arbitrary process communication topologies. However, if combined one-to-many and many-to-one piping are setup by using named pipes, another problem will occur. Due to the limited buffering offered by typical programs, deadlocks can easily occur when a process consuming data from many producers with more than one input, blocks waiting for input from one of the processes feeding it. This can cause a second feeding process to block, waiting to send its output to another one of the consumer process’s inputs, and, thereby, blocking the upstream process feeding both processes that provide data to the consumer one."

dspinellis has commented on another dgsh discussion¹(along with you). Interestingly, with a light comparison to pipexec².

I stumbled upon pipexec trying to find a battle tested solution to extend a data munging task where I was relying on zsh's multios³, mostly because orchestrating the interactions with a coproc'd jq for output were fighting me. There is something both frustrating and soothing about finding a seven year old comment pointing out why my path was doomed before I'd even started; people have solved the problem already, plus people far smarter than me also found the trap.

¹ https://news.ycombinator.com/item?id=13352659

² https://news.ycombinator.com/item?id=13358090

³ https://zsh.sourceforge.io/Doc/Release/Redirection.html#Mult...

JNRowe··on GoboLinux
For people -- admittedly, like me -- who have a strong knee-jerk reaction to GoboLinux's design the twenty year old "I am not clueless"¹ document contains a fair amount of interesting background and reasoning on the concepts. I don't think I've overcome the reaction entirely, but it isn't so strong anymore ;)

¹ https://gobolinux.org/doc/articles/clueless.html

JNRowe··on Show HN: Justpath – a simple utility to explore the PATH environment variable
General point about comfort noted, but they don't do the same thing.

$^path(N) is an equivalent to your perl expression. The snippet throwaway84846 posted also removes duplicates and collapses symlinks from /usr-merge for example.

JNRowe··on AAC and Debian
If you run "apt source" for the package you'll see it - like lots of other packages - point you to the git repository when the packaging is maintained in a public git repository. The Vcs-Tag field in the package lists is the magic that triggers that message.
JNRowe··on European Court of Human Rights bans weakening of secure end-to-end encryption
I wholeheartedly recommend How Parliament Works¹ for people who want a deep dive on these points. It is nowhere near as dry as you'd imagine for a five hundred page book about parliament.

While used copies are super cheap I'd also recommend picking up a current revision. Recent years have seen far more use(or attempts to use) some of the more obscure tools of both houses. The updates include more explanation of those topics, along with descriptions of recent cases before the courts.

¹ https://www.amazon.co.uk/dp/1032015012

JNRowe··on The history of Digital Research's Gemdos for the Atari ST (1986)
dmr's reference manual¹ used it, see section 9.10.

Matt Dillon's DICE would have been popular on the Amiga then, and it looks like it also favored parens. The latest tarball of DICE² is pretty fun for a spelunking session, if you're feeling nostalgic. It makes for an interesting mix as it pulls in a few contemporaneous non-Dillon tools with varying styles.

¹ https://www.bell-labs.com/usr/dmr/www/cman.pdf

² http://apollo.backplane.com/FreeSrc/dice-1.15.tgz

JNRowe··on Ask HN: Why is it so hard to download podcasts?
Many people have given their "why," but I'll give another "how".

castget¹ is a simple tool that does exactly what you want, just add a feed URL and it pulls all the episodes. It has a nice catchup mode so you can add feeds that you've listened to elsewhere without pulling all the old episodes too. hpodder² is another tool I've used in the past, but I can't remember why I switched.

Depending on how much you like cobbling together your own solution html-xml-utils³ makes it incredibly easy to script a solution. For example, "curl feed | hxselect -c -s '\n' 'enclosure::attr(url)'" would list just the URLs. feedparser⁴ is a battle tested solution for processing feeds if you'd prefer a proper parsing solution over a hacky shell script(it will correctly handle different formats without any extra work for example).

¹ https://castget.johndal.com/

² https://github.com/jgoerzen/hpodder/

³ https://www.w3.org/Tools/HTML-XML-utils/

⁴ https://github.com/kurtmckee/feedparser

JNRowe··on Spectrum Analyser, a Sinclair ZX Spectrum reverse engineering tool
There is a fun SDL remake¹, packages available in Debian and a few other distributions too.

¹ https://gitlab.com/roever/toppler/

JNRowe··on Show HN: gtrash – A Trash CLI manager: safe alternative to rm command
Wow, that looks great!

The restore interface is really clean, I like it a lot. I'll admit I wasn't super interested when I first clicked(I was just checking to see how it compares to other tools), but the screencast sells the interface extremely well.

Full tip of the hat for the documentation in general; the intro and screencast are great, and the more thorough documentation below the fold is fantastic too!

JNRowe··on How I'm able to take notes in mathematics lectures using LaTeX and Vim (2019)
Given that we're in a vim story, I'll reply with a little vim tip…

Vim has digraph support built-in¹, so for your example the first few digraphs are In, p*, >=, h*. It is also how I typed the ellipsis on the first line of this comment(,.), and the superscript footnotes(1S and 2S).

A more complete Unicode solution for vim is available in Christian Brabandt's excellent plugin².

¹ https://vimhelp.org/digraph.txt.html

² https://github.com/chrisbra/unicode.vim

JNRowe··on Ray tracing made possible on 42-year-old ZX Spectrum
A fair chunk of interesting commentary and starry-eyed nostalgia from the discussion of the creator's excellent write up - https://news.ycombinator.com/item?id=39118349
JNRowe··on Low-Power Wi-Fi Extends Signals Up to 3 Kilometers
I was thinking that number seemed crazy, as it is closer to ~10k at 3km for me(near Cambridge, UK). However, using that site and checking a few friends houses I see Cairo isn't that unusual; ~400k in Camden, 750k in Paris' 11th. And, making a couple of guesses at denser places led me to 1.7 million in Mumbai.

If anything it makes more amazed that regular wifi works as well it does between the house and garden, and I'll try to remember that next time I'm bemoaning its magic.

JNRowe··on Compiling Pattern Matching
Link: https://infoscience.epfl.ch/record/109881?ln=en
JNRowe··on ArVid: Russians squeezed 4 hard drives into one VHS tape in the 90s
Given the number of upvotes and comments on a story about MC a few days ago¹, they're not that dead now.

¹ https://news.ycombinator.com/item?id=39075316

JNRowe··on Oh My Zsh
All four of the $HIST* parameters are perfectly functional without export.
JNRowe··on David Mills, the internet's Father Time, dies at 85
This story was discussed a few days ago¹, including with some fond personal recollections from users. There was a link posted to Vint Cerf's story collection² too. Also, a link to the source of Mills' fuzzball OS was posted³.

¹ https://news.ycombinator.com/item?id=39051246

² https://news.ycombinator.com/item?id=39063732

³ https://news.ycombinator.com/item?id=39052051

JNRowe··on Oh My Zsh
What felt like an initial thirty second throwaway comment yesterday has turned in to a pile of replies that feel like a poorly conceived Ted talk now, forgive me for that.

The dividing line between variables that should be prefixed by export are ones that are generally useful to child processes and ones that are not.

For example, $PATH is useful and should be exported. You probably want scripts you start to have access to all the things you have installed, not just the locations of the default search path:

    PATH= =zsh -fc 'print -l $path'
$HISTFILE/$PROMPT/etc control current shell behaviour and are unlikely to be of any use to child processes executed by the shell, and do not need to be exported. Remembering, of course, that they'll be set by any new interactive shells anyway as they too will read their startup files when launched.

Oftentimes it doesn't make much difference. However, some such as $CDPATH can cause non-obvious bugs when they're exported, and some such as $HISTFILE can cause data corruption or even loss when the planets align against you.

JNRowe··on Oh My Zsh
For the first; Unless your bash config overrides the environment variable you've set it will use $HISTFILE from the calling shell, which is why "HISTFILE=<location>" without the export fixes it. You can test it with:

    export HISTFILE=trash
    bash --norc
    echo hello
    exit
    cat trash
It isn't just intermingling either, bash may truncate the file depending on how it is configured too. You can see this by performing the same procedure as above but starting with 1000 lines in the trash file, bash will truncate the file to 500 lines by default on exit. It shouldn't happen in your case as you're also exporting HISTSIZE, but it can if you have a lot of multiline history events as bash treats them differently to zsh.

The point wasn't just about HISTFILE really though, very few of the shells own configuration variables are useful in child processes. (LC_* and PATH being the obvious exceptions that spring to mind.)

---

For the second; The doc I linked to above shows how to use zkbd to handle terminal differences in a clean way. Run the wizard, and then you can use the $key array as in $key[Home]. The neat thing to do with zkbd is have the wizard run on startup when it can't find its definitions file, that way you'll get correct behaviour whenever you play with a new terminal type.

Another option is to use the terminfo database¹ directly, if you trust it to be correct for your terminals. "zmodload terminfo", and then the database is available through the $terminfo array as in $terminfo[khome] or using the echoti function².

¹ https://zsh.sourceforge.io/Doc/Release/Zsh-Modules.html#The-...

² terminfo(5) contains the mappings, but they're often far less readable than the $key array. $terminfo[kpp] vs $key[PageUp], for example.

← PreviousPage 2 of 21Next →