URI:
       Adding search - gopherhole - My gopherhole source code.
  HTML git clone git://jay.scot/gopherhole
   DIR Log
   DIR Files
   DIR Refs
       ---
   DIR commit d4a5bb06f81e6a5a1c2d046a4310879396277eb1
   DIR parent 545707c8917e882ba0be38f8526be13e9a45037e
  HTML Author: Jay Scott <me@jay.scot>
       Date:   Wed, 10 Dec 2025 19:13:25 +0000
       
       Adding search
       
       Diffstat:
         M index.gph                           |       4 ++--
         A meta/search.dcgi                    |      20 ++++++++++++++++++++
         A meta/search.sh                      |      20 ++++++++++++++++++++
         D notes/geomyidae_001.txt             |       8 --------
         M notes/index.gph                     |      15 ++++-----------
         D notes/libre_freestyle_001.txt       |       7 -------
         A notes/notes_000.txt                 |      10 ++++++++++
         A notes/notes_001.txt                 |      20 ++++++++++++++++++++
         A notes/notes_002.txt                 |      11 +++++++++++
         A notes/notes_003.txt                 |       9 +++++++++
         D notes/openbsd_001.txt               |      17 -----------------
         M phlog/index.gph                     |       5 -----
         A phlog/txt/031.txt                   |      44 +++++++++++++++++++++++++++++++
       
       13 files changed, 140 insertions(+), 50 deletions(-)
       ---
   DIR diff --git a/index.gph b/index.gph
       @@ -11,16 +11,16 @@
        
        --[ PROJECTS
        
       -
        [1|Git repos for my projects, configs etc|scm/|server|port]
        [1|Dump of interesting things!|files/|server|port]
        
        
        --[ MY STUFF
        
       +[7|Search this gopherhole|meta/search.dcgi|server|port]
        
        [1|Phlog, old man shouts at clouds|phlog/|server|port]
       -[1|Notes, for things I always forget|notes/|server|port]
       +[1|Notes for random things|notes/|server|port]
        [0|Email me|meta/email.txt|server|port]
        [0|This server setup and stats|meta/system.cgi|server|port]
        
   DIR diff --git a/meta/search.dcgi b/meta/search.dcgi
       @@ -0,0 +1,20 @@
       +#!/bin/sh
       +# based on the bitreich search.
       +
       +search="$1"
       +
       +printf "[jay.scot]\n"
       +printf "[SEARCH]\n\n"
       +
       +if [ -z "${search}" ];
       +then
       +        printf "Please enter your search query.\n"
       +        printf "[7|Search|/meta/search.dcgi|server|port]\n"
       +else
       +        printf "Search Results\n\n"
       +        ./search.sh "${search}"
       +        printf "\n"
       +        printf "[7|Search again|/meta/search.dcgi|server|port]\n"
       +fi
       +
       +printf "[1|Turn yersel hame|/|server|port]\n"
   DIR diff --git a/meta/search.sh b/meta/search.sh
       @@ -0,0 +1,20 @@
       +#!/bin/sh
       +
       +if [ $# -lt 1 ];
       +then
       +        printf "usage: %s search\n" "$(basename "$0")" >&2
       +        exit 1
       +fi
       +
       +root="/home/jay/gopher"
       +content="phlog/txt/*.txt"
       +keyword="$1"
       +
       +for file in $root/$content; do
       +    if [ -f "$file" ]; then
       +        if grep -iq "$keyword" "$file"; then
       +                        header=$(grep '^--\[' "$file" | head -n 1 | sed 's/^--\[\(.*\)/\1/')
       +            printf "[0|%s|/phlog/txt/%s|server|port]\n" "$header" "$(basename "$file")"
       +        fi
       +    fi
       +done
   DIR diff --git a/notes/geomyidae_001.txt b/notes/geomyidae_001.txt
       @@ -1,8 +0,0 @@
       -Don't forget to set the hostname on geomyidae, else server will be wrong in the
       -gophermap!
       -
       -doas vi /etc/rc.d/geomyidae
       -
       -daemon_flags="-u _geomyidae -g _geomyidae -h <hostname> -b <base-path>"
       -
       -doas rcctl restart geomyidae
   DIR diff --git a/notes/index.gph b/notes/index.gph
       @@ -2,14 +2,7 @@
        [NOTES]
        
        
       ---[ OPENBSD
       -
       -
       -[0|Enable forwarding for SMTP service|/notes/openbsd_001.txt|server|port]
       -[0|Setting host on geomyidae|/notes/geomyidae_001.txt|server|port]
       -
       -
       ---[ MISC
       -
       -
       -[0|Libre Freestyle Reader 2 Unlock|/notes/libre_freestyle_001.txt|server|port]
       +[0|Using CURL Sequence Substitution|/notes/notes_003.txt|server|port]
       +[0|Libre Freestyle Reader 2 Unlock|/notes/notes_002.txt|server|port]
       +[0|Enable forwarding for SMTP service|/notes/notes_001.txt|server|port]
       +[0|Setting host on geomyidae|/notes/notes_000.txt|server|port]
   DIR diff --git a/notes/libre_freestyle_001.txt b/notes/libre_freestyle_001.txt
       @@ -1,7 +0,0 @@
       -The unlock code for a Libre Freestyle Reader 2 is:
       -
       -CAA1C
       -
       -Settings
       -  -> Professional Options
       -    -> Are you a healthcare professional? Yes
   DIR diff --git a/notes/notes_000.txt b/notes/notes_000.txt
       @@ -0,0 +1,10 @@
       +[jay.scot]
       +[openbsd]
       +
       +
       +Don't forget to set the hostname on geomyidae, else server will be wrong
       +in the gophermap!
       +
       +        doas vi /etc/rc.d/geomyidae
       +        daemon_flags="-u _geomyidae -g _geomyidae -h <hostname> -b <base-path>"
       +        doas rcctl restart geomyidae
   DIR diff --git a/notes/notes_001.txt b/notes/notes_001.txt
       @@ -0,0 +1,20 @@
       +[jay.scot]
       +[openbsd]
       +
       +
       +cat > /etc/mail/smtpd.conf << EOF
       +table aliases file:/etc/mail/aliases
       +table secrets file:/etc/mail/secrets
       +listen on lo0
       +
       +action "local" mbox alias <aliases>
       +action "relay" relay host smtp+tls://mailrelay@server:port auth <secrets>
       +
       +match for local action "local"
       +match for any action "relay"
       +EOF
       +
       +chmod 640 /etc/mail/secrets
       +chown root:_smtpd /etc/mail/secrets
       +echo "mailrelay username:password" > /etc/mail/secrets
       +
   DIR diff --git a/notes/notes_002.txt b/notes/notes_002.txt
       @@ -0,0 +1,11 @@
       +[jay.scot]
       +[health]
       +
       +
       +The unlock code for a Libre Freestyle Reader 2 is:
       +
       +CAA1C
       +
       +Settings
       +  -> Professional Options
       +    -> Are you a healthcare professional? Yes
   DIR diff --git a/notes/notes_003.txt b/notes/notes_003.txt
       @@ -0,0 +1,9 @@
       +[jay.scot]
       +[curl]
       +
       +
       +Using Curl Globbing or as they call it Sequence Substitution to download
       +all textfiles example:
       +
       +
       +curl -s gopher://jay.scot/0/phlog/txt/[001-030].txt -o "jayscot_#1.txt"
   DIR diff --git a/notes/openbsd_001.txt b/notes/openbsd_001.txt
       @@ -1,17 +0,0 @@
       -
       -cat > /etc/mail/smtpd.conf << EOF
       -table aliases file:/etc/mail/aliases
       -table secrets file:/etc/mail/secrets
       -listen on lo0
       -
       -action "local" mbox alias <aliases>
       -action "relay" relay host smtp+tls://mailrelay@server:port auth <secrets>
       -
       -match for local action "local"
       -match for any action "relay"
       -EOF
       -
       -chmod 640 /etc/mail/secrets
       -chown root:_smtpd /etc/mail/secrets
       -echo "mailrelay username:password" > /etc/mail/secrets
       -
   DIR diff --git a/phlog/index.gph b/phlog/index.gph
       @@ -2,11 +2,6 @@
        [PHLOG]
        
        
       ---[ OFFLINE
       -
       -curl -s gopher://jay.scot/0/phlog/txt/[001-030].txt -o "jayscot_#1.txt"
       -
       -
        [0|AI is everywhere, a wee rant                       2025-12-08|/phlog/txt/030.txt|server|port]
        [0|sfeed, fdm, rdrview and mutt                       2025-12-01|/phlog/txt/029.txt|server|port]
        [0|What's the crack?                                  2025-11-22|/phlog/txt/028.txt|server|port]
   DIR diff --git a/phlog/txt/031.txt b/phlog/txt/031.txt
       @@ -0,0 +1,44 @@
       +[jay.scot]
       +[030]
       +
       +
       +--[ Learning C
       +
       +
       +For my day job I use Terraform [0] for the majority of all tasks. Due to
       +this I picked up golang at a basic level and have been using that for
       +most on my own personal projects since then, but recently I wanted to
       +learn C. For C, I have only really used it for botching in fixes for
       +things, like adding something to dwm or the like. I have never actually
       +used it for a full project, so for the next few months I want to
       +properly learn C from the beginning and then use it as my go to for my
       +personal projects and be able to contribute to the many programs that I
       +use which, most of which are programmed in C.
       +
       +
       +So where do I start? Well, when looking up the best books to pick up I
       +came across an article from Fabien Sanglard [1] in which he listed the
       +way on which he learned C. So I have been using that as a starting point
       +to get up and running with C. I tried to was get a physical copy of K&R,
       +but it is quite a pricey book to get - even on sites like ebay, the
       +cheapest was more than £40, way out of my price range for a book. While
       +not ideal, I got my self a digital copy. I am working through the book,
       +and typing out every example and then completing every task they suggest
       +at the end of a chapter - so far so good.
       +
       +
       +At the back of my mind I wonder if it's still the best way to learn C,
       +should I bother with C89 or be learning C99? Does it even matter? Or if
       +I am wasting my time of going over the basics - I wonder if there is a
       +better way these days. Either way, over the last week I am having fun
       +with it, even though I am only getting about a hour a day with it after
       +work. I am a strong believer that if you nail the core fundamentals of
       +something then the rest becomes a lot easier, lets hope that is the case
       +here too!
       +
       +
       +0. gopher://gopherpedia.com/0/Terraform%20%28software%29
       +1. https://fabiensanglard.net/c/
       +
       +
       +.EOF