Readit News logoReadit News
FujiApple commented on Writing simple tab-completions for Bash and Zsh   mill-build.org/blog/14-ba... · Posted by u/lihaoyi
paradox460 · 7 months ago
I've started using jdx's usage[1] for my clis. It integrates neatly into clap, and can be used stand alone in scripts. It can generate completions, argparse, manpages, and more

I'm still on the fence if replacing the argparse blocks in my fish scripts is worth the hassle, but against things like old school optparse, it's far better

[1]: https://usage.jdx.dev/

FujiApple · 7 months ago
I’ve recently been building a similar tool [1] which defines a specification for CLIs, though the goals are slightly different to the tool you mention I think. I just added support for fish as it happens.

[1] https://github.com/fujiapple852/claptrap

FujiApple commented on Rust CLI with Clap   tucson-josh.com/posts/rus... · Posted by u/rajman187
FujiApple · 8 months ago
Something I’ve been working on recently is a command line tool [1] to bring clap declarative command line parsing to shell scripts. Unfinished WIP but largely functional.

[1] https://github.com/fujiapple852/claptrap

FujiApple commented on Show HN: Bracket City – A daily, exploded (?) crossword puzzle   bracket.city... · Posted by u/brgross
FujiApple · a year ago
Great concept. I was on mobile and agree the custom keyboard is far from ideal. As others have said I also found it to be overly US-centric. Keen to see how this develops, feels like a winning idea!
FujiApple commented on Schrödinger's IPv6 Cat   labs.ripe.net/author/hish... · Posted by u/minusf
UI_at_80x24 · a year ago
Quasi related; how does one find out if your ISP is using CGNAT?

I'm rather lucky in that my ISP recently started offering IPv6 (and somehow my workstation appears to be using it by as the default), but none of the other PC's on my network do. (Win11 change perhaps?)

FujiApple · a year ago
You can, with several caveats, detect which hop(s) on the path perform NAT by using some trickery [1]:

> NAT devices are detected by observing a difference in the expected and actual checksum of the UDP packet that is returned as the part of the Original Datagram in the ICMP Time Exceeded message. If they differ then it indicates that a NAT device has modified the packet. This happens because the NAT device must recalculate the UDP checksum after modifying the packet (i.e. translating the source port) and so the checksum in the UDP packet that is nested in the ICMP error may not, depending on the device, match the original checksum.

[1] https://github.com/fujiapple852/trippy/releases/tag/0.11.0

FujiApple commented on How Raw sockets behave differently in macOS and Linux   swagnik.netlify.app/posts... · Posted by u/adityaathalye
swagnikdutta · a year ago
I guess I was tunnel visioned and lost clarity (and also, common sense). While searching for reasons why the code (from Graham King’s blog) had worked on Linux and not on macOS, a stack overflow answer [1] from 2015, from a person who had also been on the same journey, directed me to that page [2] — that talked about raw socket peculiarities in FreeBSD. So I dived straight into FreeBSD docs.

[1]- https://stackoverflow.com/a/32599757/3728336

[2] - https://cseweb.ucsd.edu/~braghava/notes/freebsd-sockets.txt

FujiApple · a year ago
OP, you may find this [1] “trick” useful. It allows you to dynamically determine the correct byte order for the various IPv4 headers for the platform and thus avoid the need to statically decide on the byte ordering for each platform you intend to target.

You may also find this [2] table useful, it shows which platforms allow the combination of IPPROTO_ICMP + IP_HDRINCL so it may be used without elevated privileges.

In general, my experience of raw sockets is that they are not very “raw” at all, the OS can and does still perform a variety of modifications and additions to what you send and receive, in highly platform specific and often poorly documented ways. In particular, TCP and raw sockets should generally be avoided.

[1] https://github.com/fujiapple852/trippy/blob/master/crates/tr...

[2] https://github.com/fujiapple852/trippy/issues/101#issuecomme...

FujiApple commented on The journey of an internet packet: Exploring networks with traceroute   sebastianmarines.com/post... · Posted by u/marinesebastian
wang_li · 2 years ago
Traceroute doesn't even show you a path. It shows you a bunch of devices that happened to have a packet when its TTL expired. Every item listed in traceroute's output is a different packet and can take a different path towards the destination.

On a different subject, why are people writing blogs about topics that are in the "literature" already?

FujiApple · 2 years ago
It’s not guaranteed to be accurate, but tracing using the UDP/dublin strategy with a fixed dest port and varying src port per round can help to identify and visualize valid ECMP flows. I recently wrote some guidance [1] on using Trippy in this way.

[1] https://github.com/fujiapple852/trippy?tab=readme-ov-file#ud...

FujiApple commented on The Tao of Unicode Sparklines (2021)   blog.jonudell.net/2021/08... · Posted by u/fanf2
sonofhans · 2 years ago
This is a great hack, but it makes bad sparklines. It’s probably about as good as you can get with unicode, so props to Jon.

Sparklines have a few important properties which these do not exhibit. They’re typically higher resolution, with more data per inch. Also the slopes from point to point, and the whitespace under the typical graph/sparkline, help readability.

FujiApple · 2 years ago
I recently had to look at the implementation of the Sparkline [1] widget in Ratatui which uses a similar Unicode technique but scales nicely for sparklines with larger vertical size.

[1] https://github.com/ratatui/ratatui/blob/20c88aaa5b9eb011a522...

FujiApple commented on Ask HN: What are you working on (August 2024)?    · Posted by u/david927
FujiApple · 2 years ago
Exploring adding the (novel?) concept of forward and backward packet loss heuristics to Trippy [1] as discussed here [2].

[1] https://github.com/fujiapple852/trippy/issues/860

[2] https://news.ycombinator.com/item?id=38591945

FujiApple commented on Slack AI Training with Customer Data   slack.com/trust/data-mana... · Posted by u/mlhpdx
noman-land · 2 years ago
Discord is not a better option than Slack. They are basically the same thing. Matrix is a better option from a privacy standpoint, just not from a UX one.
FujiApple · 2 years ago
I recently tried Zulip [1] again after a few years and the UX is much improved on web and mobile, worth a look (it is OSS and you can self host).

[1] https://zulip.com/

FujiApple commented on APNIC: Big Tech’s use of carrier-grade NAT is holding back internet innovation   theregister.com/2022/01/2... · Posted by u/aragonite
FujiApple · 2 years ago
This Tailscale blog [1] from 2020 has been posted on HN many times before I’m sure but is worth highlighting again as it does a great job outlining the technical complexities that CGNAT (and NAT in general) introduce.

I have my head in this space at the moment as I’m trying to implement NAT detection (as pioneered by Dublin traceroute [2]) into Trippy [3].

[1] https://tailscale.com/blog/how-nat-traversal-works

[2] https://dublin-traceroute.net/

[3] https://github.com/fujiapple852/trippy/issues/1104

u/FujiApple

KarmaCake day227June 7, 2019View Original