• a gopher use case

    From RS Wood@21:1/5 to All on Thu May 17 00:15:47 2018
    Thought I'd share that I had a systems need and gopher solved it nicely. In fact, I can't presently think of a more elegant way to solve it!

    I read a lot of newsfeeds via RSS, and frequently you come across an article you'd like to save - what to do when RSS feeds change constantly? So I made
    a little script into which you can pipe the article. The script sends the contents of the article to a text editor for trimming, asks a few questions
    for the purpose of categorizing, and then saves it into a folder tree that's being served up by pygopherd gopher server. The script prepends the date,
    so every article looks like 2018_05-08-blahblah_blah.txt. Pygopherd notices the new text file and auto-updates its cache so it gets served up almost instantaneously.

    Going back to find that snippet of text that seemed worth keeping is easy:
    just navigate the categories using a gopher browser!

    As a bonus, the script is useful for other things too: I now find myself sending short emails to it, for example.

    Software being used:
    mutt for email
    newsbeuter for RSS feed reader
    pygopherd gopher server
    and one ridiculously short bash script

    I'm super happy with the arrangement. I used to pipe them to a Usenet newsgroup, but that too spools off eventually. And using your email inbox
    as a repository is inelegant. Bonus points, if I want I can set up some
    easy search functions etc.

    For this purpose, gopher fit the bill perfectly. I can't imagine a simpler
    or more elegant system.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From FGK@21:1/5 to RS Wood on Thu May 24 06:58:24 2018
    Hello RS Wood,

    On 2018-05-17, RS Wood <rsw@therandymon.com> wrote:
    and one ridiculously short bash script

    I'm not very good at scripting. I'm just imagining you're using lynx -dump and echo $DATE at some point, but for the categories and, most of all, to render it properly in .txt (i mean just the article, not the whole webpage with menu, etc.) I'm quite lost.

    Would you mind share your script with us please so I can have a better insight of what to do? Thank you very much.

    ~f6k

    --
    % They say that f6k's OWI from SDF Public Access UNIX System.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From RS Wood@21:1/5 to FGK on Fri May 25 21:13:47 2018
    FGK <f6k@sdf.org> writes:
    On 2018-05-17, RS Wood <rsw@therandymon.com> wrote:
    and one ridiculously short bash script

    I'm not very good at scripting. I'm just imagining you're using lynx
    -dump and echo $DATE at some point, but for the categories and, most
    of all, to render it properly in .txt (i mean just the article, not
    the whole webpage with menu, etc.) I'm quite lost.

    Would you mind share your script with us please so I can have a better insight of what to do? Thank you very much.

    ~f6k


    Just realized I replied, rather than following up to the Newsgroup. For
    anyone else interested, here it is:

    First, you have to create the gopher directories in advance, ie set up your hierarchy. I just mkdir a couple of directories under /var/gopherhole/.
    The trick to cleaning up the file is passing it to an editor. I use JOE (in this case, the jstar variant), because it can edit text passed to it via
    stdin. (emacs, vim etc. don't like it and I haven't figured out why). So basically:

    1. take whatever text got passed to the script and dump it in a temporary
    file under /tmp
    2. Ask for a filename to give it
    3. Ask which directory to save it under
    4. Make a file name, consisting of date and the name the user chose
    5. Save it using cat

    Save the following in ~/bin as gopherize.sh. Chmod it u+x. Then, from any other app you can pipe text to it. I'm now using it for RSS feeds but also
    the occasional email, web pages I'm reading with lynx, etc. Any time you
    need a new category you need to manually create it and then edit the script
    so the new category shows up in your case statement.

    #! /bin/bash
    # Take some bit of text, save it as a text file so that gopher can serve
    # it up from an organized directory.

    TEMPTEXT='/tmp/temptext'

    while read line;
    do
    echo "$line" >> $TEMPTEXT
    done

    echo "Name of this future file (eg solar_prices_drop)."
    echo "Use one word; date will be prepended so we get"
    echo "something like 2018-05-08-solar_prices_drop."
    read NUGGETNAME < /dev/tty

    echo ""
    echo "In which gopher hole to save it?"
    echo "u] utilities"
    echo "w] wind"
    echo "b] battery storage"
    echo "s] solar"

    read WHICHHOLE < /dev/tty

    case $WHICHHOLE in
    u) GOPHERHOLE='/var/gopherhole/utilities/' ;;
    w) GOPHERHOLE='/var/gopherhole/wind/' ;;
    b) GOPHERHOLE='/var/gopherhole/batteries/' ;;
    s) GOPHERHOLE='/var/gopherhole/solar/' ;;
    *) GOPHERHOLE='/var/gopherhole/'
    esac


    NUGDATE=`date +%Y-%m-%d-%T`
    echo "Storing that gopher nugget at $GOPHERHOLE$NUGDATE-$NUGGETNAME"
    echo ""
    echo "Press the AnyFuckingKey to continue."
    read ANYFUCKINGKEY < /dev/tty

    jstar $TEMPTEXT

    cat $TEMPTEXT > $GOPHERHOLE$NUGDATE-$NUGGETNAME

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From FGK@21:1/5 to RS Wood on Sat May 26 13:13:54 2018
    On 2018-05-26, RS Wood <rsw@therandymon.com> wrote:
    Just realized I replied, rather than following up to the Newsgroup.

    Heh :) I hope you had my answer by mail (I had problems with your reply-to address) but, again, thank you very much for your share.

    ~f6k

    --
    They say that f6k's OWI from SDF Public Access UNIX System.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From RS Wood@21:1/5 to FGK on Sat May 26 21:58:26 2018
    On 2018-05-26, FGK <f6k@sdf.org> wrote:
    On 2018-05-26, RS Wood <rsw@therandymon.com> wrote:
    Just realized I replied, rather than following up to the Newsgroup.

    Heh :) I hope you had my answer by mail (I had problems with your reply-to address) but, again, thank you very much for your share.

    I did! Glad to help, and glad for improvements if anybody has any. I've learned shell scripting by trial and error and there's lots of room for improvement, always!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)