Live data from Hacker News

Zq: An easier and faster alternative to jq

brimdata.io

221–230 of 237 posts

Re: Zq: An easier and faster alternative to jq

#221
post #207
post #191

Earlier quoted context omitted.

You could take a look at jless [1], it allows interactive selections/browsing in JSON documents. [1] https://jless.io/

Do you know a way to copy the current selection in jless to the paste buffer? I find myself narrowing down a query for jq using jless but then having to manually remember the query to then jump to my terminal.

You can use `yq` to copy a jq-style path to currently focused node to your clipboard! (I’m the author of jless.)

There are a couple other copy variants as well:

https://jless.io/user-guide.html#copying

Re: Zq: An easier and faster alternative to jq

#222

Earlier quoted context omitted.

> an implicit loop As an occasional awk user, I'd love if you expand on this. Maybe it will help clear things up for me. You're not referring to the fact that awk operates on every line independently, are you?

My mental image of awk has always been something along these lines: for line in readfile() for block in script: if block.match(line) run_block(block) end endfor endfor Where the "for line in readfile()" is the "implicit loop", and the blocks are the "condition { .. }" blocks. The actual flow is a little bit more complex and has some exceptions e.g. (BEGIN/END), but this is about the gist of it.

Thanks. Yes, I agree that my mental image is pretty much the same but it's nice to see it expressed in Python modulo end keywords ))

Re: Zq: An easier and faster alternative to jq

#223

Earlier quoted context omitted.

> an implicit loop As an occasional awk user, I'd love if you expand on this. Maybe it will help clear things up for me. You're not referring to the fact that awk operates on every line independently, are you?

To expand on the other reply, there are a couple more implicit loops. There's a loop over all of the command line arguments/files, then a loop for every line in each of those files, then there is kind of a loop over the whitespace delimited fields of each of those lines. The main thing that helped me understand AWK was that every block in a script is just a pattern/action pair. When I saw snippets like ... | awk '{pr…

  > The AWK Programming Language
I see it's public domain and discussed here on HN: https://news.ycombinator.com/item?id=13451454

I'll go over it, thank you very much for the suggestion.

Re: Zq: An easier and faster alternative to jq

#224

Earlier quoted context omitted.

This is unrelated to the argument but using references that aren't references made that really confusing to read. In any case, what I meant by the "economics" of it is that in general a person can only afford to work for free for so long before they need to pay bills, eat, have and/or acquire a standard of living that isn't poverty. If they have a day job where they are writing this software in their free time, how l…

You say that this is unrelated yet your follow-up reinforces my initial impression. How does one afford to work for free? One has a day job. How does someone who volunteers for search-and-rescue afford it? That’s obviously a ridiculous question—they are volunteers so they necessarily must do something from nine to five. Or be independently wealthy. But how does one avoid burnout as a double-worked programmer? I think…

When I said "this is unrelated" I was commenting SOLELY on your writing style.

> How does one afford to work for free? This is exactly my point. The work isn't done for free, the person is spending their own money and time which takes away from a limited pool of resources they own. If they're insanely rich, they could probably "afford" to do this work until they die.

But you're making a mistake in your reasoning relating "volunteers", "free work", and "day jobs." Here is what I think you are missing in this assessment: A worker for a company/day job works with an obligation via contract for compensation for their time from their employer. A volunteer works without a contractual obligation of compensation for their time from the community that benefits from their work. In this latter case while there is no contractual obligation for a society/community to compensate the volunteer, it does not forbid it. Does someone who works as a volunteer search-and-rescue deserve to be compensated? I'd say yes, in fact, they do. They are providing a service.

Now I'll get ahead of the next possible argument. "But there's not enough work or compensation for them to make a living!" This is two parts:

1. For not enough work - This is only true because of the example chosen and our human tendency to draw broad analogies. There can definitely be enough work in multiple domains (and especially in software) but also what about volunteer firefighters? 2. Not enough compensation - This is because people with the means to compensate the work, simply are not doing that. And it's not a good faith argument to tell me that in the original case enough people with enough money aren't using the project to compensate it's continued development and maintenance.

To sum up all of the above: Yes, work like this is volunteer work, and it says a lot that societies and communities do not compensate this work. Simply because they don't compensate that work doesn't mean it's not able to be compensated. And there are key differences between this relationship of work and compensation that make it different from the colloquial "work" as in a day job. As this is an entity reserving your time under contract.

Now for burnout as a double-worked programmer. I think you're right on these two points. Obviously the second situation is not ideal. If someone wants to do it, let them. There are plenty of open source projects still maintained by stretched thin developers. Is this a tenable solution long term? No in the vast majority of cases and that's my point!

Re: Zq: An easier and faster alternative to jq

#225
For me, transforming JSON on the command line was a pain, another DSL to learn. Now, I can just use Babashka/ Clojure + one or two functions from Cheshire https://github.com/dakrone/cheshire where I need to. If I needed a standalone tool, I would perhaps reach for https://github.com/borkdude/jet by the same author, Michiel Borkent, as Babashka or use jq that everybody else would find more familiar.

Re: Zq: An easier and faster alternative to jq

#226

jq is incredibly powerful and I'm using it more and more. Even better, there is a whole ecosystem of tools that are similar or work in conjunction with jq: * jq (a great JSON-wrangling tool) * jc (convert various tools’ output into JSON) * jo (create JSON objects) * yq (like jq, but for YAML) * fq (like jq, but for binary) * htmlq (like jq, but for HTML) List shamelessly stolen from Julia Evans[1]. For live links see…

Hi, lover of jq and author of fq here! Just wanted to mention that fq is jq so you can do things like `fq 'grep("Authorization: Bearer.*") | split("\n") | ...' file.pcap`.

Also i'm working and prototyping some kind of http decoding support that will make things like select on headers and automatic/manual decoding body possible.

Re: Zq: An easier and faster alternative to jq

#227

Earlier quoted context omitted.

Even the fact that a particular piece of software is used by a specific IP address is enough PII that it's covered under GDPR by most viewpoints. The fact that Microsoft is collecting even more data doesn't excuse telemetry in PowerShell at all . I would simply wish for no telemetry to happen at all without user consent. If Microsoft wants information about how people use their software or how stable it is and not en…

> " Even the fact that a particular piece of software is used by a specific IP address is enough PII that it's covered under GDPR by most viewpoints. " I draw your attention to the link I posted, and the purple background call out box with the exclamation mark icon and the heading "Note" which says: "Application Insights uses the hosts IP address to determine the geographic location. The IP address is never included…

> The IP address is never included in the telemetry data or stored in the database.

It nevertheless is transferred to the origin server (otherwise, how would TCP work), and that is enough for it to be considered under GDPR!

> we felt that by making telemetry opt-in it would bias and limit our telemetry in a way that would make less useful to our users

Well, that still doesn't override the GDPR. The GDPR is law, precisely in the spirit to prevent un-consented tracking!

Re: Zq: An easier and faster alternative to jq

#228
post #49

Earlier quoted context omitted.

Pity he quit before Github opened up sponsorships.

How would Github sponsorship help pay for the time of someone at a finance company earning who knows where between 200-500k?

My bad. I guess earning ~$100k is in-sufficient.

https://changelog.com/posts/i-just-hit-100000-per-year-on-gi...

Re: Zq: An easier and faster alternative to jq

#229
post #101

Earlier quoted context omitted.

Here because.... I didn't know of ctrl-R. What a life changer (although I had an alias for "hg" to "history | grep" :) )

Please check FZF [1] and it’s integration with ctrl-r. It’s a huge productivity boost and I cannot live without it. [1] https://github.com/junegunn/fzf

I think I actually HAVE fzf installed, thus my first experience w/ Ctrl-R was even better! I really haven't fully grok'ed fzf yet though, probably should look up some guides.

Re: Zq: An easier and faster alternative to jq

#230

Earlier quoted context omitted.

How would Github sponsorship help pay for the time of someone at a finance company earning who knows where between 200-500k?

My bad. I guess earning ~$100k is in-sufficient. https://changelog.com/posts/i-just-hit-100000-per-year-on-gi...

Cool, I think I read that also! But, yeah it is on the low-end for a skilled engineer working for US companies, and also I'm thinking it's on the high-end / an outlier for github sponsors.
Post reply on HN