Show HN: Full text search on 630M US court cases
Simple judyrecords continuation search from command line. Requires sed, netcat, stunnel and flex.<p><pre><code>    setup:    
    flex -8iCrf 045.l;
    cc  -std=c89 -Wall -pedantic -pipe lex.yy.c -static -o yy045; 
    flex -8iCrf 046.l;
    cc  -std=c89 -Wall -pedantic -pipe lex.yy.c -static -o yy046;  
    stunnel 1.cfg
    echo 127.39.100.156 www.judyrecords.com &gt;&gt; &#x2F;etc&#x2F;hosts;
    usage:
    1.sh query &gt; results.htm
    1.sh &lt; results.htm &gt;&gt; results.htm
    
        #!&#x2F;bin&#x2F;sh 
        # http&#x2F;1.1 pipelining: only allowed 3 req then connection closes :(
        x0=$(printf &#x27;\r\n&#x27;);
        x1=www.judyrecords.com;
        x2=$(printf &#x27;host: &#x27;${x1}&#x27;\r\n&#x27;);
        x4=$(printf &#x27;connection: close\r\n\r\n&#x27;);
        case $# in :)
        ;;0) # get next page
        x5=$(sed -n &#x27;1{s&#x2F;.*x3 &#x2F;&#x2F;;s&#x2F; .*&#x2F;&#x2F;p;};
        &#x2F;Go to next page&#x2F;{s&#x2F;.*href=\&quot;&#x2F;&#x2F;;s&#x2F;\&quot;.*&#x2F;&#x2F;p;}&#x27;);
        x6=$(echo &quot;${x5}&quot;|sed -n \$p);
        x5=$(echo &quot;${x5}&quot;|sed -n 1p);
        test &quot;${x5}&quot; -a &quot;${x6}&quot;||exit 1;
        sed &quot;s&#x2F; *&#x2F;&#x2F;&quot; &lt;&lt;eof|nc -vv ${x1} 80|yy045;
        GET ${x6} HTTP&#x2F;1.1
        ${x2}
        cookie: ${x5}
        ${x4}
    eof
        ;;*) # get cookie (x3), then get 1st page
        S=$(echo &quot;$@&quot;|yy046);
        x3=$(sed &quot;s&#x2F; *&#x2F;&#x2F;&quot; &lt;&lt;eof|nc -vv ${x1} 80|sed -n &quot;s&#x2F;.*session=&#x2F;session=&#x2F;;s&#x2F;\;.*&#x2F;${x0}&#x2F;p&quot;;
        GET &#x2F;addSearchJob?search=&quot;$S&quot; HTTP&#x2F;1.1
        ${x2}
        ${x4}
    eof
        );echo &quot;&lt;!-- x3 ${x3} --&gt;&quot;|sed &quot;s&#x2F;${x0}&#x2F;&#x2F;g&quot;;
        echo &quot;&lt;base href=https:&#x2F;&#x2F;${x1} &#x2F;&gt;&quot;;
        sed &quot;s&#x2F; *&#x2F;&#x2F;&quot; &lt;&lt;eof|nc -vv ${x1} 80|yy045
        GET &#x2F;getSearchResults&#x2F;?page=1 HTTP&#x2F;1.1
        ${x2}
        cookie: ${x3}
        ${x4}
    eof
        esac;
        exit
    
        1.cfg:
    
        debug=debug 
        pid=&#x2F;tmp&#x2F;1.pid
        foreground=no
        [ judyrecords ]
        accept=127.39.100.156:80 
        client=yes
        connect=54.39.100.156:443
        options=NO_TICKET
        options=NO_RENEGOTIATION
        renegotiation=no
        sni=
        sslVersion=TLSv1.3
    
        045.l:
        
        &#x2F;* chunked transfer decode *&#x2F; 
        &#x2F;* do not use when carving out attachments, e.g., PDFs *&#x2F;
         int fileno (FILE *);
        xa &quot;\15&quot;|&quot;\12&quot;
        xb &quot;\15\12&quot; 
        %option noyywrap nounput noinput 
        %%
        ^[A-Fa-f0-9]+{xa}
        {xa}+[A-Fa-f0-9]+{xa}
        {xb}[A-Fa-f0-9]+{xb}
        %%
        int main(){ yylex();exit(0);}
    
        046.l:
    
        &#x2F;* URL encode *&#x2F;
          int fileno(FILE *);
          #define p(x,y) {putchar(37);putchar(x);putchar(y);}
        %option nounput noinput noyywrap
        %%
        \x20 p(50,48); &#x2F;* space *&#x2F;
        \x21 p(50,49); &#x2F;* exclamation mark *&#x2F;
        \x22 p(50,50); &#x2F;* double quote *&#x2F;
        \x23 p(50,51); &#x2F;* pound sign *&#x2F;
        \x24 p(50,52); &#x2F;* dollar sign *&#x2F;
        \x25 p(50,53); &#x2F;* percent sign *&#x2F;
        \x26 p(50,54); &#x2F;* ampersand *&#x2F;
        \x27 p(50,55); &#x2F;* single quote *&#x2F;
        \x28 p(50,56); &#x2F;* opening parenthesis *&#x2F;
        \x29 p(50,57); &#x2F;* closing parenthesis *&#x2F;
        \x2A p(50,42); &#x2F;* asterisk *&#x2F;
        \x2B p(50,43); &#x2F;* plus sign *&#x2F;
        \x2C p(50,44); &#x2F;* comma *&#x2F;
        
        \x2F p(50,47); &#x2F;* forward slash *&#x2F;
        
        \x3A p(51,58); &#x2F;* colon *&#x2F;
        \x3B p(51,59); &#x2F;* semi-colon *&#x2F;
        \x3C p(51,60); &#x2F;* less than *&#x2F;
        \x3D p(51,61); &#x2F;* equals sign *&#x2F;
        \x3E p(51,62); &#x2F;* greater than *&#x2F;
        \x3F p(51,63); &#x2F;* question mark *&#x2F;
        \x40 p(52,64); &#x2F;* cuneiform *&#x2F;
        
        \x5B p(53,91); &#x2F;* opening bracket *&#x2F;
        \x5C p(53,92); &#x2F;* backslash *&#x2F;
        \x5D p(53,93); &#x2F;* closing bracket *&#x2F;
        \x5E p(53,94); &#x2F;* caret *&#x2F;
        
        \x60 p(53,96); &#x2F;* backquote *&#x2F;
        
        \x7B p(53,123); &#x2F;* opening brace *&#x2F;
        \x7C p(53,124); &#x2F;* vertical bar *&#x2F;
        \x7D p(53,125); &#x2F;* closing brace *&#x2F;
        \15
        %%
         int main(){ yylex();exit(0);}</code></pre>