News for hackers. Stuff that matters.
Re:Google's morale crisis is about to get worse by 1vuio0pswjnm7 on Monday March 04, 2024 @04:17AM (#39588471)
Text-only, no Javascript; works where archive.is is blocked

     #!/bin/sh
     tr @ '\34' \
     |sed 's/articleBody/@/;s/}/@/g' \
     |tr @ '\12' \
     |sed -n 's/\\n/@/g;s/’/'"'"'/g;
     s/—/-/g;s/…/.../g;
     s/&#822[01];/\"/g;s/\"$//;s/^\":\"//p' \
     |tr -d '\240' \
     |tr @ '\12' \
     |tr '\34' @

     curl -si40A "" https://www.theverge.com/2024/3/3/24089843/google-morale-crisis-about-to-get-worse|1.sh > 1.txt
     firefox ./1.txt (overkill)
     less 1.txt
Re:Google's morale crisis is about to get worse by mmh0000 on Monday March 04, 2024 @11:31AM (#39592292)
I like that you think Firefox is the overkill in all of that. At least, your username compliments this post quite well.

I would also like to thank you for sending me down a pointless rabbit hole which led to this cleaner madness:

  curl -sL https://www.theverge.com/2024/3/3/24089843/google-morale-crisis-about-to-get-worse | grep -Pio 'application/ld\+json">\K[^<]+' | jq -r '.articleBody'
Re:Google's morale crisis is about to get worse by 1vuio0pswjnm7 on Monday March 04, 2024 @06:42PM (#39597624)
FWIW

I only use curl and firefox in HN examples. I do not use these programs myself.

sed and tr are each small, fast and ubiquitous. Found by default in GNU/Linux and BSD userland for the last 30 years. Both found in GNU/Linux and BSD multicall binaries.

I'm not a Perl RE user. Neither busybox nor NetBSD grep has a -P option.

Extracting text from HTMLJSON, as a one-off, on the computers I own (older, smaller, underpowered) might look something like

   echo https://www.theverge.com/2024/3/3/24089843/google-morale-crisis-about-to-get-worse \
   |yy025|nc -vv h6 80 > 1.htm

   yy059 < 1.htm|sed -n '/articleBody/{p;q;}'|yy032|less
   or
   yy059 < 1.htm|grep -m1 articleBody|yy032|less
h6 is a loopback-bound forward proxy

Static binaries

   81.6 KiB nc
   45.9 KiB yy025
   45.9 KiB yy032
   45.9 KiB yy059
By comparison

   234.2 KiB GNU grep (dynamically-linked to libpcre2)
   614.3 KiB libpcre2-8.so.0.11.2
   370.0 KiB libjq.so.1.0.4 (dynamically-linked to jq)
   607.6 KiB libonig.so.5.4.0 (dynamically-linked to libjq)
Re:Google's morale crisis is about to get worse by 1vuio0pswjnm7 on Tuesday March 05, 2024 @04:36PM (#39609442)
There are 37,291,836 SLOC in Firefox. Over 37 million lines of code. That's probably larger than the Linux kernel. The program requires hundreds of megabytes of disk space. It is overkill to use such a program to read a small text file. Are there faster alternatives that require less storage space, memory and CPU.

https://4e6.github.io/firefox-lang-stats/