Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.infosystems.gopher > #228 > unrolled thread
| Started by | RS Wood <rsw@therandymon.com> |
|---|---|
| First post | 2018-05-17 00:15 +0000 |
| Last post | 2018-05-26 21:58 -0400 |
| Articles | 5 — 2 participants |
Back to article view | Back to comp.infosystems.gopher
a gopher use case RS Wood <rsw@therandymon.com> - 2018-05-17 00:15 +0000
Re: a gopher use case FGK <f6k@sdf.org> - 2018-05-24 06:58 +0000
Re: a gopher use case RS Wood <rsw@therandymon.com> - 2018-05-25 21:13 -0400
Re: a gopher use case FGK <f6k@sdf.org> - 2018-05-26 13:13 -0500
Re: a gopher use case RS Wood <rsw@therandymon.com> - 2018-05-26 21:58 -0400
| From | RS Wood <rsw@therandymon.com> |
|---|---|
| Date | 2018-05-17 00:15 +0000 |
| Subject | a gopher use case |
| Message-ID | <j6uuse-sa3.ln1@raspberry.therandymon.com> |
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.
[toc] | [next] | [standalone]
| From | FGK <f6k@sdf.org> |
|---|---|
| Date | 2018-05-24 06:58 +0000 |
| Message-ID | <slrn3v9kpgcokh.qam.f6k@faeroes.freeshell.org> |
| In reply to | #228 |
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.
[toc] | [prev] | [next] | [standalone]
| From | RS Wood <rsw@therandymon.com> |
|---|---|
| Date | 2018-05-25 21:13 -0400 |
| Message-ID | <87h8mvdxro.fsf@therandymon.com> |
| In reply to | #233 |
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
[toc] | [prev] | [next] | [standalone]
| From | FGK <f6k@sdf.org> |
|---|---|
| Date | 2018-05-26 13:13 -0500 |
| Message-ID | <slrn3uk4pgj8v2.5p.f6k@sdf.lonestar.org> |
| In reply to | #234 |
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.
[toc] | [prev] | [next] | [standalone]
| From | RS Wood <rsw@therandymon.com> |
|---|---|
| Date | 2018-05-26 21:58 -0400 |
| Message-ID | <2vfpte-sea.ln1@raspberry.therandymon.com> |
| In reply to | #235 |
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!
[toc] | [prev] | [standalone]
Back to top | Article view | comp.infosystems.gopher
csiph-web